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

Provide currentBuild.isRestartedRun and .isRestartedStage global variables

XMLWordPrintable

    • Declarative backlog

      On a restarted stage, there is a when condition, isRestartedRun() that can be used to run or not a stage.  But there isn't anything that can be used to execute a bit different on a restart than in the original run.  This leads to workarounds like:

          stages {
              stage('Schedule') {
                  when

      {                 not\{ isRestartedRun() }

                  }
                  agent any
                  steps

      {                     myCommand 'isRestartedRun: false'             }

              }
              stage('Restart') {
                  when

      {                 isRestartedRun()             }

                  agent any
                  steps

      {                     myCommand 'isRestartedRun: true'             }

              }

       

      It would be much simpler and clearer to be able to just check for currentBuild.isRestartedRun wherever global variables are accessible

            Unassigned Unassigned
            fnasser Fernando Nasser
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: