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

Update default value of job parameter after change in Jenkinsfile

    XMLWordPrintable

Details

    Description

      Changes to the parameter defaultValue in Jenkinsfile are not reflected in existing Jenkins job after executing the job.

      • use following parameter definition:
      properties([
          parameters([
              string(name: 'EXCLUDE', defaultValue: 'pattern', description: 'description'),
          ]),
      ]) 
      • add new job and run it for the first time, go to job configuration - the job should now have this parameter with "pattern' default value
      • change in the Jenkinsfile pattern to "pattern2"
      • run the job again and go to job configuration - the job will still have the old value "pattern"

      Attachments

        Activity

          pkruk Piotr Krukowiecki created issue -
          pkruk Piotr Krukowiecki made changes -
          Field Original Value New Value
          Description Changes to the parameter *defaultValue* in Jenkinsfile are not reflected in existing Jenkins job after executing the job.
           * use following parameter definition:

          {code:java}
          properties([
              parameters([
                  string(name: 'EXCLUDE', defaultValue: 'pattern', description: 'Exclude jobs that match this regexp'),
              ]),
          ]) {code}
           * add new job and run it for the first time, go to job configuration - the job should now have this parameter with "pattern' default value
           * change in the Jenkinsfile pattern to "pattern2"
           * run the job again and go to job configuration - the job will still have the old value "pattern"
          Changes to the parameter *defaultValue* in Jenkinsfile are not reflected in existing Jenkins job after executing the job.
           * use following parameter definition:

          {code:java}
          properties([
              parameters([
                  string(name: 'EXCLUDE', defaultValue: 'pattern', description: 'description'),
              ]),
          ]) {code}
           * add new job and run it for the first time, go to job configuration - the job should now have this parameter with "pattern' default value
           * change in the Jenkinsfile pattern to "pattern2"
           * run the job again and go to job configuration - the job will still have the old value "pattern"

          I'm sorry. It looks like I had a syntax error in my Jenkinsfile. After fixing it, Jenkins is picking up my changes in defaultValue.

          pkruk Piotr Krukowiecki added a comment - I'm sorry. It looks like I had a syntax error in my Jenkinsfile. After fixing it, Jenkins is picking up my changes in defaultValue.

          Closing

          pkruk Piotr Krukowiecki added a comment - Closing
          pkruk Piotr Krukowiecki made changes -
          Resolution Not A Defect [ 7 ]
          Status Open [ 1 ] Closed [ 6 ]

          People

            Unassigned Unassigned
            pkruk Piotr Krukowiecki
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: