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
            benkeil83 Ben Keil added a comment -
            Show
            benkeil83 Ben Keil added a comment - Take a look at  https://github.com/comquent/imperative-when
            Hide
            vizzard Aron Smyk added a comment - - edited

            Works like a charm! Great find Ben Keil, thanks!

            Since the solution was 15 lines of Shared Library I hope it will be implemented.

            Show
            vizzard Aron Smyk added a comment - - edited Works like a charm! Great find Ben Keil , thanks! Since the solution was 15 lines of Shared Library I hope it will be implemented.
            Hide
            grafi71 Grzegorz Kotarski added a comment -

            I can confirm too, it works very nice, good work!

            Show
            grafi71 Grzegorz Kotarski added a comment - I can confirm too, it works very nice, good work!
            Hide
            reinholdfuereder Reinhold Füreder added a comment - - edited

            Ben Keil Great + thanks!

            Some questions and comments WRT https://github.com/comquent/imperative-when:

            1. James Dumay org.jenkinsci.plugins.pipeline.modeldefinition.Utils.markStageSkippedForConditional(STAGE_NAME) is annotated with @Restricted(NoExternalUse.class) => I assume one therefore should not and cannot rely on this method being available forever. However, since this approach seems to work very well or would be at least an acceptable workaround for scripted pipelines, how are the chances that this will be get part of the official API (via removing this annotation?) or might even get used/wrapped by a new official API?
              • When trying out the other similarly named methods in org.jenkinsci.plugins.pipeline.modeldefinition.Utils (i.e. markStageFailedAndContinued, markStageSkippedForFailure, markStageSkippedForUnstable, markStageSkippedForConditional) the behaviour is rather surprising and "proofs" the aforementioned annotation => so let's just stay with org.jenkinsci.plugins.pipeline.modeldefinition.Utils.markStageSkippedForConditional(STAGE_NAME)
            2. James Dumay The mouse over hovering text in blue ocean shows "common.state.skipped": Since I also get this in a little declarative pipeline prototype I guess this is a minor bug (missing translation, or – maybe even better/preferable – missing to state the reason for the skipping) and not a side effect of (ab-)using this method in the wrong context?
            3. @ All: I am wondering why the body closure evaluation is coded with delegation based on config map in this example!?
            4. @ All: The STAGE_NAME is an unknown property in class section of shared library (that is not in "vars" section) but works in "Jenkinsfile" – I guess that is due to some transformation magic applied on "vars" section?
            5. @ All: Is that unfortunately leading to such SEVERE log lines:
              2018-04-06 11:04:03 SEVERE [io.jenkins.blueocean.rest.impl.pipeline.PipelineNodeGraphVisitor <init>]   Could not find execution for run ACME-Pipeline#2347
              • Update: No that is another Jenkins pipeline or Blue Ocean bug, because it also happens for builds that do NOT use this method/approach; or that even do not skip any stages...
            Show
            reinholdfuereder Reinhold Füreder added a comment - - edited Ben Keil Great + thanks! Some questions and comments WRT https://github.com/comquent/imperative-when: James Dumay org.jenkinsci.plugins.pipeline.modeldefinition.Utils.markStageSkippedForConditional(STAGE_NAME) is annotated with @Restricted(NoExternalUse.class) => I assume one therefore should not and cannot rely on this method being available forever. However, since this approach seems to work very well or would be at least an acceptable workaround for scripted pipelines, how are the chances that this will be get part of the official API (via removing this annotation?) or might even get used/wrapped by a new official API? When trying out the other similarly named methods in org.jenkinsci.plugins.pipeline.modeldefinition.Utils (i.e. markStageFailedAndContinued , markStageSkippedForFailure , markStageSkippedForUnstable , markStageSkippedForConditional ) the behaviour is rather surprising and "proofs" the aforementioned annotation => so let's just stay with org.jenkinsci.plugins.pipeline.modeldefinition.Utils.markStageSkippedForConditional(STAGE_NAME) James Dumay The mouse over hovering text in blue ocean shows "common.state.skipped": Since I also get this in a little declarative pipeline prototype I guess this is a minor bug (missing translation, or – maybe even better/preferable – missing to state the reason for the skipping) and not a side effect of (ab-)using this method in the wrong context ? @ All: I am wondering why the body closure evaluation is coded with delegation based on config map in this example!? @ All: The STAGE_NAME is an unknown property in class section of shared library (that is not in "vars" section) but works in "Jenkinsfile" – I guess that is due to some transformation magic applied on "vars" section? @ All: Is that unfortunately leading to such SEVERE log lines: 2018-04-06 11:04:03 SEVERE [io.jenkins.blueocean.rest.impl.pipeline.PipelineNodeGraphVisitor <init>]   Could not find execution for run ACME-Pipeline#2347 Update: No that is another Jenkins pipeline or Blue Ocean bug, because it also happens for builds that do NOT use this method/approach; or that even do not skip any stages...
            Hide
            chrismaes Chris Maes added a comment -

            This issue is not solved. The skipping of stages in blue ocean view is well supported in Pipeline syntax, but not in scripted pipelines.

            The workaround proposed in https://github.com/comquent/imperative-when works correctly, but since I am using https://github.com/jenkinsci/JenkinsPipelineUnit it seems quite impossible for me to get my unit-tests working.

            Show
            chrismaes Chris Maes added a comment - This issue is not solved. The skipping of stages in blue ocean view is well supported in Pipeline syntax, but not in scripted pipelines. The workaround proposed in https://github.com/comquent/imperative-when  works correctly, but since I am using https://github.com/jenkinsci/JenkinsPipelineUnit  it seems quite impossible for me to get my unit-tests working.

              People

              • Assignee:
                jamesdumay James Dumay
                Reporter:
                reinholdfuereder Reinhold Füreder
              • Votes:
                4 Vote for this issue
                Watchers:
                28 Start watching this issue

                Dates

                • Created:
                  Updated: