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

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

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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:
      PARAM1=$PARAM1
      PARAM2=$PARAM2
      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?)

        Attachments

          Activity

          rusty Russell Weber created issue -
          rusty Russell Weber made changes -
          Field Original Value New Value
          Attachment image-2020-06-18-16-39-18-616.png [ 51676 ]
          rusty Russell Weber made changes -
          Description 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:
          PARAM1=$PARAM1
          PARAM2=$PARAM2
          See attached photo:
          !image-2020-06-18-16-30-18-984.png!

          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?)
          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:
           PARAM1=$PARAM1
           PARAM2=$PARAM2
           See attached photo:
          !image-2020-06-18-16-39-18-616.png!

          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?)

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            rusty Russell Weber
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: