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

Support skipping stages in scripted pipelines for nice visualization in blue ocean and classic UI stage view

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Created as response to comments of https://issues.jenkins-ci.org/browse/JENKINS-37781 as the visualization of skipped stages is very, very nice for declarative pipelines in Blue Ocean.

      1. Allow to skip stages in scripted pipelines leading to equally nice visualization in Blue Ocean: The current approaches mentioned by Mike Kobit in https://issues.jenkins-ci.org/browse/JENKINS-37781?focusedCommentId=294965&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-294965 and James Dumay in https://issues.jenkins-ci.org/browse/JENKINS-37781?focusedCommentId=294966&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-294966 lead to either misleading or just less obvious visualization...
      2. Improve visualization of stage view: instead of showing skipped stages (declarative pipelines) as always being green and allegedly executed, make them e.g. gray.

        Attachments

          Issue Links

            Activity

            Hide
            reinholdfuereder Reinhold Füreder added a comment -

            While I am not sure if this is the correct/perfect/recommended place for this question, it admittedly fits to this issue and I can actually give you a little hint

            My approach for this is to have a skipableStage step in my shared Jenkins pipeline library that wraps the default/standard stage step, so the usage is almost like normally:

            ...
            acmeSharedLibrary.skipableStage("stage name") {
               ... // normal stage implementation
            }
            ...
            

            ... and the steps implementation in pseudo code is:

            stage(stageName) {
              if (currentBuild.result) {
                echo "Skipping stage '${stageName}' due to build result '${currentBuild.result}'..."
                Result result = Result.fromString(currentBuild.result)
                markStageSkippedForResult(stageName, result) // via the aformentioned workaround
              } else {
                body() // which is the closure block of this "skippableStage"
              }
            }
            
            Show
            reinholdfuereder Reinhold Füreder added a comment - While I am not sure if this is the correct/perfect/recommended place for this question, it admittedly fits to this issue and I can actually give you a little hint My approach for this is to have a skipableStage step in my shared Jenkins pipeline library that wraps the default/standard stage step, so the usage is almost like normally: ... acmeSharedLibrary.skipableStage( "stage name" ) { ... // normal stage implementation } ... ... and the steps implementation in pseudo code is: stage(stageName) { if (currentBuild.result) { echo "Skipping stage '${stageName}' due to build result '${currentBuild.result}' ..." Result result = Result.fromString(currentBuild.result) markStageSkippedForResult(stageName, result) // via the aformentioned workaround } else { body() // which is the closure block of this "skippableStage" } }
            Hide
            michaelneale Michael Neale added a comment -

            (can't leave this unassigned for some reason). 

            Show
            michaelneale Michael Neale added a comment - (can't leave this unassigned for some reason). 
            Hide
            reinholdfuereder Reinhold Füreder added a comment -

            Michael Neale I am a bit surprised by being the new assignee of this issue, as I am not sure what you are expecting from me. Considering the admittedly rather long history of this issue and its distractions/deviations I think I can only try to do a little update:

            Show
            reinholdfuereder Reinhold Füreder added a comment - Michael Neale I am a bit surprised by being the new assignee of this issue, as I am not sure what you are expecting from me. Considering the admittedly rather long history of this issue and its distractions/deviations I think I can only try to do a little update: the issue's title/goal is still completely the same and correct and IMHO the "only" (or main) thing certainly missing is a stable/public API for org.jenkinsci.plugins.pipeline.modeldefinition.Utils.markStageSkippedForConditional(STAGE_NAME) (as this is annotated with @Restricted(NoExternalUse.class) ) In the course of doing that other questions from https://issues.jenkins-ci.org/browse/JENKINS-47286?focusedCommentId=334032&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-334032 might be answered as well... (I think item #2 "mouse hover" was actually fixed; see https://issues.jenkins-ci.org/browse/JENKINS-47286?focusedCommentId=360479&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-360479 )
            Hide
            reinholdfuereder Reinhold Füreder added a comment - - edited

            Assigning this back to Michael Neale with the update/summary comment above...

            Show
            reinholdfuereder Reinhold Füreder added a comment - - edited Assigning this back to Michael Neale with the update/summary comment above...
            Hide
            michaelneale Michael Neale added a comment -

            can't seem to unassign it. 

             

            Show
            michaelneale Michael Neale added a comment - can't seem to unassign it.   

              People

              • Assignee:
                michaelneale Michael Neale
                Reporter:
                reinholdfuereder Reinhold Füreder
              • Votes:
                10 Vote for this issue
                Watchers:
                40 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: