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

Parameterized trigger plugin evaluates null or unset variables as their symbol name.


      I have 2 jobs Job A and Job B.

      1. Job A does some logic and then injects some variables into the build via the inject variable plugin. The only variable that is set is $PARAM1, and occasionally $PARAM2
      2. Job A then runs a parameterized trigger for Job B. Job B requires two parameters: PARAM1 and PARAM2.  Both parameters of this job default to blank strings.  The trigger is parameterized and passes the following "pre-defined" parameters to Job B as follows:
      See attached photo:

      3. While parsing the parameters for Job B, because PARAM2 is not defined. Instead of passing a blank string to Job B, PARAM2 is set to the literal string '$PARAM2'.
      4. This then causes a world of chaos in Job B because not only is PARAM2 not set to a blank string, but it is also set to a wildly incorrect value.
      Echoing out these values in Job B will show the following:
      The parameter PARAM1="I was set and injected in the last job"
      The parameter PARAM2="$PARAM2"

      The fix for this seems simple enough and that is to evaluate all symbols that aren't set as either blank strings "" or refuse to set the variable in the downstream project allowing the default parameter to take precedence (Maybe configurable?)

            Unassigned Unassigned
            rusty Russell Weber
            1 Vote for this issue
            2 Start watching this issue