• Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • None
    • Jenkins Parameterized Trigger plugin ver. 2.7
      Jenkins ver. 1.397
      Ubuntu 10.04.1 LTS

      I have crated a new job and when using the parameterized trigger it is passing a literal '$VAR' instead of expanding $VAR.

      Here is some output from the job that is setting the variable (GIT_DESCRIBE):

      [workspace] $ /gsc/bin/bash -xe /tmp/hudson7947017773698263236.sh
      ++ git describe --tags
      + GIT_DESCRIBE=0.28-103-g0661244
      + export GIT_DESCRIBE
      + env
      + grep GIT_DESCRIBE
      GIT_DESCRIBE=0.28-103-g0661244
      Description set: 0.28-103-g0661244

      Using a predefined parameter I have "GIT_DESCRIBE=${GIT_DESCRIBE}" (without quotes) in the text field.

      Then the receiving job has the value of GIT_DESCRIBE as "${GIT_DESCRIBE}". If I start this job an enter a value for the GIT_DESCRIBE parameter as "0.28-103-g0661244" not only does it work but it also passes this value correctly onto the third/final job.

      P.S. I've never submitted a bug for Hudson/Jenkins before so please let me know if I am not doing this correctly.

          [JENKINS-8952] Not Expanding Environment Variable

          Nathan Nutter added a comment -

          This is only affecting newly created jobs. Jobs from before the plugin upgrade continue to pass the parameters correctly.

          Nathan Nutter added a comment - This is only affecting newly created jobs. Jobs from before the plugin upgrade continue to pass the parameters correctly.

          Nathan Nutter added a comment -

          Problem persists on Jenkins 1.401.

          Nathan Nutter added a comment - Problem persists on Jenkins 1.401.

          Nathan Nutter added a comment -

          Looks like it is just not expanding shell variables set during an 'Exceute Shell' build step.

          Nathan Nutter added a comment - Looks like it is just not expanding shell variables set during an 'Exceute Shell' build step.

          cjo9900 added a comment -

          looks to be the same as point 2 in
          https://issues.jenkins-ci.org/browse/JENKINS-12415

          2. Exported variable from shell not passed to called jobs.
          When doing export BUILD_JAVA=1 from a shell script this does not get passed back into the job environment setting so these are only used within the context of that shell script and spawned processes.
          To show this add a second shell build step and print the environment variables using env an then check for the exported item, you will see it is not present.

          To pass these values along to later build steps print them to a file in the standard parameter format of KEY=VALUE and then use the EnvInject plugin build step to add them to the run environment from the file created

          Suggest closing the error as there is no real changes that can be made to change the current behaviour as it is a known core issue with a solution as defined above

          cjo9900 added a comment - looks to be the same as point 2 in https://issues.jenkins-ci.org/browse/JENKINS-12415 2. Exported variable from shell not passed to called jobs. When doing export BUILD_JAVA=1 from a shell script this does not get passed back into the job environment setting so these are only used within the context of that shell script and spawned processes. To show this add a second shell build step and print the environment variables using env an then check for the exported item, you will see it is not present. To pass these values along to later build steps print them to a file in the standard parameter format of KEY=VALUE and then use the EnvInject plugin build step to add them to the run environment from the file created Suggest closing the error as there is no real changes that can be made to change the current behaviour as it is a known core issue with a solution as defined above

          ikedam added a comment -

          Shell script cannot export variables to subsequent build steps.
          Use https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin instead.

          ikedam added a comment - Shell script cannot export variables to subsequent build steps. Use https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin instead.

          Nathan Nutter added a comment -

          Thanks for the follow up and suggestion.

          Nathan Nutter added a comment - Thanks for the follow up and suggestion.

            huybrechts huybrechts
            nnutter Nathan Nutter
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: