Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIXED JENKINS-56488] Handle quotes in Dockerfile path #164

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

[FIXED JENKINS-56488] Handle quotes in Dockerfile path #164

wants to merge 2 commits into from

Conversation

zhogov
Copy link

@zhogov zhogov commented Mar 8, 2019

No description provided.

Copy link
Member

@dwnusbaum dwnusbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Can you please add a regression test to DockerDSLTest along the lines of DockerDSLTest.build() specifically for a Dockerfile with spaces in it?

@@ -86,6 +86,8 @@ class Docker implements Serializable {
def arg = parsedArgs[i]
if ((arg == '-f' || arg.startsWith('--file')) && i < (parsedArgs.length - 1)) {
dockerfile = arg.startsWith('--file=') ? arg.split('=')[1] : parsedArgs[i+1]
// Trim leading and trailing quotes
dockerfile = dockerfile.replaceAll('''^'|'$|^"|"$''', "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be a little clearer to use a / string. Also, do we need to make sure we don't trim mismatched quotes like 'foo"? Maybe better to use something like this:

Suggested change
dockerfile = dockerfile.replaceAll('''^'|'$|^"|"$''', "")
dockerfile = dockerfile.replaceAll(/^('|")(.*)(\1)$/, "$2")

@jglick
Copy link
Member

jglick commented Jun 28, 2022

I suspect this has already been fixed and so this PR can be closed @rsandell?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants