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

Managed Scripts does not use Token macros

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: imod
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/managedscripts/ScriptBuildStep.java
          http://jenkins-ci.org/commit/managed-scripts-plugin/c6150ef1d11125e9a9530b75e7bc5224b6add353
          Log:
          [FIXED JENKINS-18004] add support for TokenMacros

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: imod Path: pom.xml src/main/java/org/jenkinsci/plugins/managedscripts/ScriptBuildStep.java http://jenkins-ci.org/commit/managed-scripts-plugin/c6150ef1d11125e9a9530b75e7bc5224b6add353 Log: [FIXED JENKINS-18004] add support for TokenMacros
          Hide
          mpower_dodtsair Mike Power added a comment -

          Wow thanks, that was really fast, and a release of the plugin too. Thanks very much.

          Token macro is integrated and working great.

          Show
          mpower_dodtsair Mike Power added a comment - Wow thanks, that was really fast, and a release of the plugin too. Thanks very much. Token macro is integrated and working great.
          Hide
          domi Dominik Bartholdi added a comment -

          no problem, I just wondered why I had implemented this in such a bad way...

          Show
          domi Dominik Bartholdi added a comment - no problem, I just wondered why I had implemented this in such a bad way...

            People

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

              Dates

              • Created:
                Updated:
                Resolved: