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

Parameters disappear from pipeline job after running the job

    Details

    • Type: Bug
    • Status: Reopened (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: job-dsl-plugin
    • Labels:
      None
    • Environment:
      Jenkins ver. 2.53,
      Build Pipeline Plugin 1.5.6
      Pipeline
    • Similar Issues:

      Description

       

       

       

      Steps to reproduce

      1. I have created Pipeline job
      2. During creation I checked up "This project is parameterized" checkbox and added two Choice parameters
      3. I have run the job and it failed
      4. I checked the configuration of the job and parameters are no longer there and "This project is parameterized"  checkbox is no longer checked up.

        Attachments

          Issue Links

            Activity

            Hide
            abayer Andrew Bayer added a comment -

            So if you're not using Job DSL, please open a separate JIRA. If you're using the properties step in Scripted Pipeline or the parameters directive in Declarative, those do try to preserve job properties and build parameters defined outside of the pipeline, but Job DSL is still going to wipe out whatever is in the properties and parameters when it runs its seed job. Also, don't ever call properties step more than once in a pipeline - you're gonna run into a bunch of potential pitfalls there.

            Show
            abayer Andrew Bayer added a comment - So if you're not using Job DSL, please open a separate JIRA. If you're using the properties step in Scripted Pipeline or the parameters directive in Declarative, those do try to preserve job properties and build parameters defined outside of the pipeline, but Job DSL is still going to wipe out whatever is in the properties and parameters when it runs its seed job. Also, don't ever call properties step more than once in a pipeline - you're gonna run into a bunch of potential pitfalls there.
            Hide
            ss_vinoth22 vinoth SS added a comment -

            Andrew Bayer Any update on this issue? was there any upgrade in the plugin to fix this issue, Or do we need to go with Alexander's Wrokaround? I tried with latest JOB DSL 1.74 plugin as well it is still having the issue. Please do update the roadmap/ fix

            Show
            ss_vinoth22 vinoth SS added a comment - Andrew Bayer Any update on this issue? was there any upgrade in the plugin to fix this issue, Or do we need to go with Alexander's Wrokaround? I tried with latest JOB DSL 1.74 plugin as well it is still having the issue. Please do update the roadmap/ fix
            Hide
            akom Alexander Komarov added a comment - - edited

            Aaron D. Marasco, to my knowledge there is no way to get current job properties in the format suitable for properties{}.   

            The only way I can see of doing this would be to access the individual getters on currentBuild.rawBuild.parent (an instance of WorkflowRun ) and then transform their current values into arguments to properties{}.  This would certainly be brittle, and if you use Script Security, this will require approval.

             

            Show
            akom Alexander Komarov added a comment - - edited Aaron D. Marasco , to my knowledge there is no way to get current job properties in the format suitable for  properties{} .    The only way I can see of doing this would be to access the individual getters on  currentBuild.rawBuild.parent (an instance of WorkflowRun ) and then transform their current values into arguments to  properties{}.   This would certainly be brittle, and if you use Script Security, this will require approval.  
            Hide
            aarondmarasco_vsi Aaron D. Marasco added a comment -

            Just stumbled on this bug as well, wondering why I lose my JobDSL parameters after a run. Alexander Komarov has a great workaround above, but I really need what Michal Rysanek is asking for - a way to get the current properties so I can add to them.

            Show
            aarondmarasco_vsi Aaron D. Marasco added a comment - Just stumbled on this bug as well, wondering why I lose my JobDSL parameters after a run. Alexander Komarov has a great workaround above, but I really need what Michal Rysanek is asking for - a way to get the current properties so I can add to them.
            Hide
            mrysanek Michal Rysanek added a comment - - edited

            Last comment/question - is there any way to read the properties LinkedHashMap?  I would like to expand on Alexander Komarov's workaround - read/store the live properties, add/modify one then write them back into the actual live object; this way I wouldn't have to force others to use my processes in the pipeline (I develop libraries for other developers to use in their builds, and need to set SOME properties, but don't want to stomp on theirs). Alternately providing a "properties <<" or a "properties.append([somepropertylist])" might be less destructive to other people already using the current behavior to intentionally wipe previous properties.

            Show
            mrysanek Michal Rysanek added a comment - - edited Last comment/question - is there any way to read the properties LinkedHashMap?  I would like to expand on Alexander Komarov 's workaround - read/store the live properties, add/modify one then write them back into the actual live object; this way I wouldn't have to force others to use my processes in the pipeline (I develop libraries for other developers to use in their builds, and need to set SOME properties, but don't want to stomp on theirs). Alternately providing a "properties <<" or a "properties.append( [somepropertylist] )" might be less destructive to other people already using the current behavior to intentionally wipe previous properties.

              People

              • Assignee:
                Unassigned
                Reporter:
                dzieciou Maciej Gawinecki
              • Votes:
                17 Vote for this issue
                Watchers:
                22 Start watching this issue

                Dates

                • Created:
                  Updated: