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

Restart from Stage doesn't restore global variable

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • None
    • Jenkins ver. 2.121.2 with up-to-date plugins

      The attached Jenkinsfile can be used to reproduce this issue.

      Running the Pipeline the first time, everything works as expected:

      run a)
      ------

      [Pipeline] {
      [Pipeline] timestamps
      [Pipeline] {

      [Pipeline] stage
      [Pipeline] { (one)

      [Pipeline] script
      [Pipeline]

      { [Pipeline] echo 00:00:06.159 simpletest-17 [Pipeline] }

      [Pipeline] // script

      [Pipeline] }
      [Pipeline] // stage

      [Pipeline] stage
      [Pipeline] { (two)
      [Pipeline] script
      [Pipeline]

      { [Pipeline] echo 00:00:09.465 simpletest-17 [Pipeline] echo 00:00:10.274 simpletest-17 [Pipeline] }

      [Pipeline] // script

      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // timestamps

      [Pipeline] }
      [Pipeline] // node

      [Pipeline] End of Pipeline
      Finished: SUCCESS

       

      If it is restarted from stage 'two', the value of the global Map member is null. I would expect to have the value from the last run there:

       

      run b) - restart from stage two
      -------------------------------
      [Pipeline] timestamps
      [Pipeline] {
      [Pipeline] stage
      [Pipeline]

      { (one) Stage "one" skipped due to this build restarting at stage "two" [Pipeline] }

      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (two)
      [Pipeline] script
      [Pipeline]

      { [Pipeline] echo 00:00:07.975 simpletest-18 [Pipeline] echo 00:00:08.408 null --8<-- i would expect to get 'simpletest-17' instead of 'null' --8<-- [Pipeline] }

      [Pipeline] // script
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // timestamps
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      Finished: SUCCESS

       

            Unassigned Unassigned
            manut Manuel Traut
            Votes:
            21 Vote for this issue
            Watchers:
            25 Start watching this issue

              Created:
              Updated:
              Resolved: