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

support some handling for skipped stages

    Details

    • Similar Issues:

      Description

      It would be really nice to support some steps in case a stage is skipped due to the when block. I understand the motivation in JENKINS-47577 not executing some post block for this. However, without some support for this, one cannot send an e-mail when a stage is skipped or inform other tools about this, that monitor pipelines for example.

      In my case this would render the really nice descriptive pipelines rather useless and I would have to stick to the scripted pipelines which results in a lot more code.

        Attachments

          Issue Links

            Activity

            Hide
            abayer Andrew Bayer added a comment -

            I've thought some about this sort of thing - I'm considering maybe adding a finally post condition (which would also be helpful for JENKINS-41519, I think) that would always be run, regardless of build status, stage execution, etc, and would always be run after all other post conditions. But I'm not sure that directly addresses your use case - maybe a skipped post condition?

            In general, I really need to rewrite post entirely behind the scenes - there are a bunch of limitations its current implementation creates. Sigh. =)

            Show
            abayer Andrew Bayer added a comment - I've thought some about this sort of thing - I'm considering maybe adding a finally post condition (which would also be helpful for JENKINS-41519 , I think) that would always be run, regardless of build status, stage execution, etc, and would always be run after all other post conditions. But I'm not sure that directly addresses your use case - maybe a skipped post condition? In general, I really need to rewrite post entirely behind the scenes - there are a bunch of limitations its current implementation creates. Sigh. =)
            Hide
            aklemp Andreas Klemp added a comment -

            A finally post would suffice if I could get the status (e.g. failure, success, skipped). However, the resulting conditions would contradict the descriptive nature, I think.

            As I understand (in addition to your comment in JENKINS-47577) that you propose it like this?

            stage ('foo') {
              when {
                ...
              }
              steps {
                ...
              }
              post {
                ...
                # run as usual when the stage is not skipped because of the when condition
              }
              skipped {
                ...
                # run when the stage is skipped because of the when condition
              }
              finally {
                ...
                # run in all cases after post/skipped or only after post when not skipped?
              }
            }

             

            Show
            aklemp Andreas Klemp added a comment - A finally post would suffice if I could get the status (e.g. failure, success, skipped). However, the resulting conditions would contradict the descriptive nature, I think. As I understand (in addition to your comment in JENKINS-47577 ) that you propose it like this? stage ( 'foo' ) { when { ... } steps { ... } post { ... # run as usual when the stage is not skipped because of the when condition } skipped { ... # run when the stage is skipped because of the when condition } finally { ... # run in all cases after post/skipped or only after post when not skipped? } }  

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                aklemp Andreas Klemp
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: