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

Changes to parameters block applied inconsistently

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None

      Given a declarative pipeline Jenkinsfile, modifications to the parameters block seem to take place inconsistently.  Attached are four jenkinsfiles numbered 1-4.  ive included step by step instructions below to reproduce the issues I've seen.  The two main issues I've seen are that changes to existing parameters seem to require multiple builds to actually apply, and that the last parameter in a build cannot ever actually be removed.  

       

      1. Apply and run Jenkinsfile.1.  This will create a build plan with a single string parameter PARAM.  This seems to work fine.
      2. Apply and run Jenkinsfile.2.  This file switches the type of the PARAM parameter from a string to a boolean.  It also adds a second parameter PARAM2 of type string.  The first build using the second jenkinsfile will echo the old default value for PARAM but the new default value for PARAM2.  Viewing the 'Parameters' tab of the build will display only PARAM, display the old default value, and say that it is of type string despite it being switched to a boolean.
      3. Rerun the build with the same jenkinsfile.  (This can be done either by 'Build With Parameters' which will display the correct params and default values or by a trivial change to the jenkinsfile).  The second run with Jenkinsfile.2 will result in the default boolean value for PARAM to be used.  The 'Parameters' tab for this build will display the correct parameters, types, and values.
      4. Apply and run Jenkinsfile.3.  This file removes the PARAM parameter (but still references it in the task in an echo).  The parameters tab will display both parameters despite PARAM being removed.  The build step will echo the default value for PARAM despite it being removed.
      5. Rerun the build with the same jenkinsfile (as in step 3, either manually or by a trivial change to the jenkinsfile).  The parameters tab will have PARAM removed and the build step that echoes PARAM will echo null.  
      6. Apply and run Jenkinsfile.4.  This file removes the parameters block entirely.  The parameters tab will still display PARAM2, and PARAM2's default value will be echoed despite the param being removed.   This behaves much like removing PARAM did in step 4, except for the next step
      7. Rerun the build with the build with the same jenkinsfile.  Unlike removing PARAM, PARAM2 is still displayed in 'Build With Parameters' and rerunning the build still echoes the default value for PARAM2 despite it not being in the Jenkinsfile.

       

      In case anyone is wondering, I know that some of the steps in here are kind of weird steps to take in the normal usecase of jenkinsfiles.  I stumbled across these issues while attempting to isolate a different bug (already reported as JENKINS-43486) where I was trying to change param types from string to boolean or vice versa and remove params.  

        1. Jenkinsfile.1
          0.2 kB
        2. Jenkinsfile.2
          0.3 kB
        3. Jenkinsfile.3
          0.2 kB
        4. Jenkinsfile.4
          0.2 kB

            abayer Andrew Bayer
            dkesler David Kesler
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: