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

Managed Scripts does not use Token macros

XMLWordPrintable

      When calling a managed script with a set of arguments manage scripts does not properly resolve token macro expressions. Consider the following config.xml snip:

      <org.jenkinsci.plugins.managedscripts.ScriptBuildStep plugin="managed-scripts@1.0.2"><buildStepId>org.jenkinsci.plugins.managedscripts.ScriptConfig1368825822834</buildStepId><buildStepArgs><string>${ENV,var="JOB_NAME"}</string><string>${ENV,var="JOB_NAME"}</string><string>${ENV,var="JOB_NAME"}</string></buildStepArgs></org.jenkinsci.plugins.managedscripts.ScriptBuildStep>

      Notice how it passes in the JOB_NAME as a token macro expression. Here is the contents of the script it is calling:
      echo "hello world"
      echo A $1
      echo B $2
      echo C $3

      And here is the resulting output:
      [workspace] $ /bin/sh /app/jenkins/temp/build_step_template7647665088307017903.sh
      hello world
      A
      B
      C

      Notice no arguments were passed to the script, and $1, $2, $3 resolved to nothing.

      In this case I used token macro to resolve an ENV variable which makes for an easy demonstration. But I also want to be able to use token macro to resolve a property in a properties file.

            domi Dominik Bartholdi
            mpower_dodtsair Mike Power
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: