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

Directive Generator: `when` is missing `isRestartedRun()`

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Labels:
      None
    • Environment:
      Jenkins:
      - Core 2.127
      - Experimental UC plugins
      - Declarative at 1.3.0-SNAPSHOT, which was master at commit eeb92e42
    • Similar Issues:

      Description

      Summary
      When using the Directive Generator, the generator for when is missing isRestartedRun().

      Steps to recreate
      1. Go to the Declarative Directive Generator via http://1.2.3.4:8080/job/your-pipeline-job/directive-generator/

      2. Pick the Sample Directive: when

      3. Look in the dropdown for When Condition. I was expecting to see `isRestartedRun`, but it's not there.

        Attachments

          Issue Links

            Activity

            Show
            abayer Andrew Bayer added a comment - PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/279
            Hide
            bdevcich Blake Devcich added a comment - - edited

            Is there documentation how this this isRestartedRun is used? If I put this in the when block of stage 1 and restart at stage 3 will it skip the stage 1 block or will it actually do stage 1 first, and then stage 3 and so on?

            I ask because I'm looking for a way to always run an earlier stage (to do some setup) no matter what stage is selected as the restart point.

            https://jenkins.io/doc/book/pipeline/syntax/#when makes no mention of this feature.

            Show
            bdevcich Blake Devcich added a comment - - edited Is there documentation how this this isRestartedRun is used? If I put this in the when block of stage 1 and restart at stage 3 will it skip the stage 1 block or will it actually do stage 1 first, and then stage 3 and so on? I ask because I'm looking for a way to always run an earlier stage (to do some setup) no matter what stage is selected as the restart point. https://jenkins.io/doc/book/pipeline/syntax/#when makes no mention of this feature.
            Hide
            abayer Andrew Bayer added a comment -

            It allows you to only fire a stage if it's part of a restarted run (or, of course, with not, you can have it do the reverse). But this still only applies for stages from the restart point onward - if you restart at stage 3, stages 1 and 2 will always be skipped regardless.

            Show
            abayer Andrew Bayer added a comment - It allows you to only fire a stage if it's part of a restarted run (or, of course, with not , you can have it do the reverse). But this still only applies for stages from the restart point onward - if you restart at stage 3, stages 1 and 2 will always be skipped regardless.
            Hide
            bdevcich Blake Devcich added a comment -

            Thanks Andrew! So just to confirm there's no way to always run a setup stage when a pipeline is restarted?

            The only thing I can think of right now is to have a function that is called in the beginning of every stage that is executed only on a restart.

            Show
            bdevcich Blake Devcich added a comment - Thanks Andrew! So just to confirm there's no way to always run a setup stage when a pipeline is restarted? The only thing I can think of right now is to have a function that is called in the beginning of every stage that is executed only on a restart.
            Hide
            abayer Andrew Bayer added a comment -

            Blake Devcich - correct. It's an interesting idea, though - probably would be worth opening a JIRA for that as a new feature.

            Show
            abayer Andrew Bayer added a comment - Blake Devcich - correct. It's an interesting idea, though - probably would be worth opening a JIRA for that as a new feature.
            Hide
            abayer Andrew Bayer added a comment -

            This'll be in the next release (1.3.2)

            Show
            abayer Andrew Bayer added a comment - This'll be in the next release (1.3.2)

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                kshultz Karl Shultz
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: