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

Current Build Parameters doesn't pass custom job parameters

      I have recognized that using Current Build Parameters when triggering another job doesn't pass custom job parameters.

      Job A and B have both a parameter called "DAILY_BUILD". Using Current Build Parameters doesn't pass DAILY_BUILD to job B.

          [JENKINS-29031] Current Build Parameters doesn't pass custom job parameters

          I met the same problem in Jenkins ver. 1.621 and Parameterized Trigger plugin 2.27.

          Environment variables like $BUILD_NUMBER are passed to downstream jobs, but predefined parameters with current job parameters are not.

          Kazuyuki Ohgushi added a comment - I met the same problem in Jenkins ver. 1.621 and Parameterized Trigger plugin 2.27. Environment variables like $BUILD_NUMBER are passed to downstream jobs, but predefined parameters with current job parameters are not.

          it appears that only server-side environment variables are being parsed as parameters and all other values are being passed as literals.

          As an example if I were set the following "predefined variables" for any given job
          ```
          FOO=$BAR
          GIT_COMMIT=$GIT_COMMIT
          ```

          The $GIT_COMMIT value would be evaluated with $FOO being treated as literal $BAR.

          I have tried:
          ```
          foo=baz
          export FOO=foo
          ```

          using each of the above separately ultimately results in the same. the job being triggered will receive FOO=$BAR where $BAR is not evaluated (and does not show baz or foo).

          Andrew Hammett added a comment - it appears that only server-side environment variables are being parsed as parameters and all other values are being passed as literals. As an example if I were set the following "predefined variables" for any given job ``` FOO=$BAR GIT_COMMIT=$GIT_COMMIT ``` The $GIT_COMMIT value would be evaluated with $FOO being treated as literal $BAR. I have tried: ``` foo=baz export FOO=foo ``` using each of the above separately ultimately results in the same. the job being triggered will receive FOO=$BAR where $BAR is not evaluated (and does not show baz or foo).

          Regina Obe added a comment -

          I have the same issue after upgrading from 1.595 and related plugins. I tried downgrading Parameterized trigger plugin to 2.25 (which was one that used to work), but that did not fix the issue.
          Is there some other plugin I need to downgrade or should I downgrade my Jenkins?

          Regina Obe added a comment - I have the same issue after upgrading from 1.595 and related plugins. I tried downgrading Parameterized trigger plugin to 2.25 (which was one that used to work), but that did not fix the issue. Is there some other plugin I need to downgrade or should I downgrade my Jenkins?

          Regina Obe added a comment -

          I just ended up downgrading back to old jenkins and that fixed my issue. I won't upgrade until this issue is fixed or there is an easy work around.
          Only work aorund I found was to make my build parameters matrix parameters, but that requires changing a good chunk of my matrix jobs and suboptimal.

          Regina Obe added a comment - I just ended up downgrading back to old jenkins and that fixed my issue. I won't upgrade until this issue is fixed or there is an easy work around. Only work aorund I found was to make my build parameters matrix parameters, but that requires changing a good chunk of my matrix jobs and suboptimal.

          B Hicks added a comment -

          My Jenkins server is also affected by this bug. Parameterized projects are not passing those parameters to chained projects even when "Current build parameters" are included for the target project. This is infuriating as this bug has effectively broken most of my build jobs.

          B Hicks added a comment - My Jenkins server is also affected by this bug. Parameterized projects are not passing those parameters to chained projects even when "Current build parameters" are included for the target project. This is infuriating as this bug has effectively broken most of my build jobs.

          Victor L added a comment -

          Me too. Had to downgrade from 1.651.2 back to 1.642.4.

          Victor L added a comment - Me too. Had to downgrade from 1.651.2 back to 1.642.4.

          Artem Bityutskiy added a comment - - edited

          This kind of stuff happens very often with Jenkins and plugins. Really frustrating.

          Anyway, this turns out to be the way Jenkins community fixed the security issue:
          https://wiki.jenkins-ci.org/display/SECURITY/Jenkins+Security+Advisory+2016-05-11

          Just run Jenkins with this Java option and you'll have the old behavior back:
          -Dhudson.model.ParametersAction.keepUndefinedParameters=true

          In my setup I basically edited /etc/sysconfig/jenkins:
          JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.model.ParametersAction.keepUndefinedParameters=true"

          HTH

          Artem Bityutskiy added a comment - - edited This kind of stuff happens very often with Jenkins and plugins. Really frustrating. Anyway, this turns out to be the way Jenkins community fixed the security issue: https://wiki.jenkins-ci.org/display/SECURITY/Jenkins+Security+Advisory+2016-05-11 Just run Jenkins with this Java option and you'll have the old behavior back: -Dhudson.model.ParametersAction.keepUndefinedParameters=true In my setup I basically edited /etc/sysconfig/jenkins: JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.model.ParametersAction.keepUndefinedParameters=true" HTH

          Any chance of getting a fix soon? Assignee s last activity was May 13th...

          Alexander Dvorsky added a comment - Any chance of getting a fix soon? Assignee s last activity was May 13th...

          One way to overcome this is to use Parameters from properties file instead of Predefined parameters.
          Let's say that I want to pass VERSION variable to the next build.

          echo "VERSION=$VERSION" > my_properties

          After that I specified my_properties file name in use properties from file field.

          Vladimir Kozyrev added a comment - One way to overcome this is to use Parameters from properties file instead of Predefined parameters . Let's say that I want to pass VERSION variable to the next build. echo "VERSION=$VERSION" > my_properties After that I specified my_properties file name in use properties from file field.

            huybrechts huybrechts
            cschulz C. S.
            Votes:
            7 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: