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

Restarting stages

    XMLWordPrintable

    Details

    • Sprint:
      Pipeline - April 2018
    • Similar Issues:

      Description

      Use cases

      • Restarting a successful stage so to rollback or redeploy code
      • When long running Pipelines fail intermittently for environmental purposes the developer must be able to restart the execution of the stage that failed within the Pipeline. This allows the developer to recoup time lost running the pipeline to the point of failure.

      In scope

      • Declarative pipeline only
      • Restart the stage with the same parameters/scm/actions as the previous run
      • No management of workspace
      • Need to be able to union the previous run and the current runs flownodes to produce a visualisation for Blue Ocean
        • Implication is we do not have to copy flow nodes to the new run
      • Add a when condition that will evaluate as true only when on a restarted 

      Out of scope

      • Automatically stash/unstash the workspace
      • Scripted pipeline (technical limitation)

      Open questions

      • Should we be keeping stash data for every run? What is the option of least surprise?
        • JD thinks that keeping stashes around by default is the least surprising option - that way they do not have to turn anything on to make the feature work.
        • AB says this might blow out the storage requirements

      Notes
      There is less complexity and edge cases needed to be handled by making this functionality a Declarative Pipeline feature only.

      Technical notes
      Split off from JENKINS-33846 since Andrew Bayer removed the component from that one, and I do not want this lost:

      For Declarative Pipelines, in principle you could skip some early stage's and just start running on a later one, using FlowCopier.

      This would be instead of using a checkpoint step, and would not be dependent on Groovy internals. While it is less flexible in some respects, it is no less flexible than it could be given the restrictions Declarative already imposes. This behavior would more closely match what you get from, say, the Build Pipeline plugin, but with the benefits of Jenkins Pipeline: stashes, exact SCM revisions, etc.

      (Conversely, you could also offer the ability to run a build skipping some of the later stages, somewhat analogously to running ant some-non-default-target.)

        Attachments

          Issue Links

            Activity

            Hide
            hoppej Jan Hoppe added a comment -

            I might be wrong, but I don't get how to switch off the restart stage option.

            My pipelines currently don't work correctly after restarting a stage (I check out git only at first stage...)

            Show
            hoppej Jan Hoppe added a comment - I might be wrong, but I don't get how to switch off the restart stage option. My pipelines currently don't work correctly after restarting a stage (I check out git only at first stage...)
            Hide
            abayer Andrew Bayer added a comment -

            There currently isn't a way to disable stage restart, but that's a good idea for us to add - could you create a new ticket for that? Thanks!

            Show
            abayer Andrew Bayer added a comment - There currently isn't a way to disable stage restart, but that's a good idea for us to add - could you create a new ticket for that? Thanks!
            Hide
            ben5556 Subbu K added a comment -

            Blake Devcich I am looking for exactly what you asked. Have you figured out a way to achieve this ? Thanks!

            Show
            ben5556 Subbu K added a comment - Blake Devcich I am looking for exactly what you asked. Have you figured out a way to achieve this ? Thanks!
            Hide
            jazzyjayx Jay Spang added a comment -

            Jan Hoppe Andrew Bayer please update this thread if you created a ticket to disable stage restart. We desperately need this.

            This feature does not work at all with my pipelines (it does not run on the same node as the original run), so it's generating false positives and wreaking havoc with my customers. I'm considering implementing some custom CSS to hide the silly thing before it causes us any more grief!

            Show
            jazzyjayx Jay Spang added a comment - Jan Hoppe Andrew Bayer please update this thread if you created a ticket to disable stage restart. We desperately need this. This feature does not work at all with my pipelines (it does not run on the same node as the original run), so it's generating false positives and wreaking havoc with my customers. I'm considering implementing some custom CSS to hide the silly thing before it causes us any more grief!
            Hide
            bdevcich Blake Devcich added a comment -

            Subbu K - No, we haven't found a way around this, so we're not taking advantage of stage restarting. I have use boolean parameters which can be unchecked to skip stages - which works as a sort of poor mans stage restarting.

            To expand on my previous example, I have check boxes as Job parameters for Stage B, C, D. I always want Stage A to run so there's no check box for that. If I want to restart Stage D, I uncheck the boxes for Stages B, C. Each stage in the pipeline checks the true/false value before running the stage.

            It's not ideal, and it's not really taking advantage of this feature, but it works pretty well.

            I also did create https://issues.jenkins-ci.org/browse/JENKINS-53167, so you might want to watch that.

            Show
            bdevcich Blake Devcich added a comment - Subbu K - No, we haven't found a way around this, so we're not taking advantage of stage restarting. I have use boolean parameters which can be unchecked to skip stages - which works as a sort of poor mans stage restarting. To expand on my previous example, I have check boxes as Job parameters for Stage B, C, D. I always want Stage A to run so there's no check box for that. If I want to restart Stage D, I uncheck the boxes for Stages B, C. Each stage in the pipeline checks the true/false value before running the stage. It's not ideal, and it's not really taking advantage of this feature, but it works pretty well. I also did create https://issues.jenkins-ci.org/browse/JENKINS-53167 , so you might want to watch that.

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                jglick Jesse Glick
              • Votes:
                63 Vote for this issue
                Watchers:
                110 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: