Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-7108

Running a parametrized build with Copy Artifact's Build Selector breaks Ant functionality on Windows

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Component/s: ant-plugin
    • Labels:
      None
    • Environment:
      Hudson Master running on Ubuntu Lucid
      Hudson Slave running on Windows Server 2003 x64, controlled by Hudson Windows Slave Service
    • Similar Issues:

      Description

      I have a Hudson job where the build needs to be parametrized. One of the required parameters for the build is the version of an artifact from another build. For this, I use "Build selector for Copy Artifact" as one of the user parameters for a build. The problem is that this causes an un-escaped xml tag to be passed in as an environment variable to an Ant build task.

      For example, we have a Copy Artifact parameter by the name "build_selector". The ant target is "test". The ant build task then executes the following: cmd.exe /C '"ant.bat -file build.xml -Dbuild_selector=<StatusBuildSelector/> test && exit %%ERRORLEVEL%%"'. This results in an error message "The system cannot find the file specified.". This is occurring on my Hudson slave running Windows Server 2003 x64. Please let me know if I can provide any additional information in getting this issue resolved. Thank you.

        Attachments

          Issue Links

            Activity

            Hide
            thenava thenava added a comment -

            Hello mindless, the escaping issue seems to be taken care of on my Windows machine. I ran a test job with a parameter test_param. Here is the output:

            Started by user anonymous
            [ant_files] $ cmd.exe /C '"ant.bat -file build.xml "-Dtest_param=test^<to see if redirecting is ^>escaped" test && exit %%ERRORLEVEL%%"'
            Buildfile: build.xml

            test:
            [echo] hello, world
            [echo] test^<to see if redirecting is ^>escaped

            BUILD SUCCESSFUL
            Total time: 0 seconds
            Finished: SUCCESS

            It looks good, except do you know why these carets are showing up? Thanks!

            Show
            thenava thenava added a comment - Hello mindless, the escaping issue seems to be taken care of on my Windows machine. I ran a test job with a parameter test_param. Here is the output: Started by user anonymous [ant_files] $ cmd.exe /C '"ant.bat -file build.xml "-Dtest_param=test^<to see if redirecting is ^>escaped" test && exit %%ERRORLEVEL%%"' Buildfile: build.xml test: [echo] hello, world [echo] test^<to see if redirecting is ^>escaped BUILD SUCCESSFUL Total time: 0 seconds Finished: SUCCESS It looks good, except do you know why these carets are showing up? Thanks!
            Hide
            mindless Alan Harder added a comment -

            Hm.. the ^ chars are expected.. in my testing, without ^ for escaping, the < was still interpreted as redirection, even when the param has " " around it. I tested on Windows XP.

            What windows version are you using?
            Can you try the above cmd.exe ..... command from a command prompt? What happens with/without the ^ char?

            Show
            mindless Alan Harder added a comment - Hm.. the ^ chars are expected.. in my testing, without ^ for escaping, the < was still interpreted as redirection, even when the param has " " around it. I tested on Windows XP. What windows version are you using? Can you try the above cmd.exe ..... command from a command prompt? What happens with/without the ^ char?
            Hide
            mindless Alan Harder added a comment -

            I see your windows version in the "environment" above.. so, please test from command prompt to see if something is different when running in Hudson, or behavior is actually different for different windows versions..

            Show
            mindless Alan Harder added a comment - I see your windows version in the "environment" above.. so, please test from command prompt to see if something is different when running in Hudson, or behavior is actually different for different windows versions..
            Hide
            mindless Alan Harder added a comment -

            thenava (or anyone), any updates?

            Show
            mindless Alan Harder added a comment - thenava (or anyone), any updates?
            Hide
            mindless Alan Harder added a comment -

            I'm marking this as fixed.. if anyone sees new problems due to this escaping for ant on windows, please open a new issue. thanks.

            Show
            mindless Alan Harder added a comment - I'm marking this as fixed.. if anyone sees new problems due to this escaping for ant on windows, please open a new issue. thanks.

              People

              • Assignee:
                mindless Alan Harder
                Reporter:
                thenava thenava
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: