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

Handle skipped stages and parallels in the Pipeline Graph

    • Blue Ocean 1.2-beta3, Blue Ocean 1.2-beta4

      Ready for release

      This improvement is completed and scheduled for release in 1.2. Check the roadmap page for updates.

      Context
      The Pipeline team have added the ability to "skip" stages in the Pipeline (JENKINS-37781).

      Scope

      • Skipped stages are shown as not built
      • Declarative Pipeline will not provide flow nodes for skipped parallels so we can always assume that there won't be any skipped parallels.
      • If the first stage is skipped then the pipeline should start from a "Start" node.
      • If the last stage is skipped then the pipeline should end with a "End" node.
      • Ensure that the editors start/end nodes match the style in this mockup

      Mockup

          [JENKINS-39628] Handle skipped stages and parallels in the Pipeline Graph

          James Dumay added a comment - - edited

          thuybdojenkins could you please open up a new feature request for skipping with an example Pipeline? Reiterating the use case you have here would be good (generally we do not accept feature requests on already resolved tickets for other features)

          James Dumay added a comment - - edited thuybdojenkins could you please open up a new feature request for skipping with an example Pipeline? Reiterating the use case you have here would be good (generally we do not accept feature requests on already resolved tickets for other features)

          Thuy Do added a comment -

          michaelneale I attached the pipeline view in my comment.  Do you need the groovy script I use?  If so, I will include in the new feature request as suggested by jamesdumay.

          Here is a snippet of a stage in my pipeline.  Other stages are similar.

          stage("dps") {

              when {
                  expression { return params.enableDps }
              }

              steps {
                  timeout(time: 10, unit: 'HOURS') {
                      ecdmItestRun(
                          vmIp : "${params.vmIp}",
                          itestPath : "itests/restapi/dps",
                          itestName : "DPS",
                          additionalArgs : "-Prun-its,run-its-irvine"
                          )
                  }
              }
          }

          Thuy Do added a comment - michaelneale I attached the pipeline view in my comment.  Do you need the groovy script I use?  If so, I will include in the new feature request as suggested by jamesdumay . Here is a snippet of a stage in my pipeline.  Other stages are similar. stage("dps") {     when {         expression { return params.enableDps }     }     steps {         timeout(time: 10, unit: 'HOURS') {             ecdmItestRun(                 vmIp : "${params.vmIp}",                 itestPath : "itests/restapi/dps",                 itestName : "DPS",                 additionalArgs : "-Prun-its,run-its-irvine"                 )         }     } }

          Ruud P added a comment -

          Is this working also for Parallel stages on different nodes?  I am facing at this moment some strange behavior,

          if  one of the when statements is false:

          Blue ocean shows "Queued Waiting for next available executor on ....." until the end of the complete parallel execution,  but i see in the console everything is running

          If all when statements are true i dont see anny issue

          below a small example code

           parallel {

                  stage(A') {
                    when {expression {params.A}}
                      steps {node(label: 'A') {bla bla }}}
                  stage('Bt') {
                    when {expression {params.B}}
                      steps {node(label: 'B') {bla bla}}}
                  stage('C') {
                    when {expression {params.C}}
                      steps {node(label: 'C') {bla bla}}}

          }

           

          Ruud P added a comment - Is this working also for Parallel stages on different nodes?  I am facing at this moment some strange behavior, if  one of the when statements is false: Blue ocean shows "Queued Waiting for next available executor on ....." until the end of the complete parallel execution,  but i see in the console everything is running If all when statements are true i dont see anny issue below a small example code  parallel {         stage(A') {           when {expression {params.A}}             steps {node(label: 'A') {bla bla }}}         stage('Bt') {           when {expression {params.B}}             steps {node(label: 'B') {bla bla}}}         stage('C') {           when {expression {params.C}}             steps {node(label: 'C') {bla bla}}} }  

          Michael Neale added a comment -

          ruudp I don't think it works in parallel yet (feel free to open a new ticket though)

          Michael Neale added a comment - ruudp I don't think it works in parallel yet (feel free to open a new ticket though)

          Nat Sr added a comment -

          jamesdumay sophistifunk Hi guys, I wonder instead of adding "when{....}" to determine whether the stage will be skipped or not, can we have user input feature to ask if they want to skip the stage or not. Do we have this feature too?

          Nat Sr added a comment - jamesdumay sophistifunk Hi guys, I wonder instead of adding "when{....}" to determine whether the stage will be skipped or not, can we have user input feature to ask if they want to skip the stage or not. Do we have this feature too?

          Josh McDonald added a comment -

          I imagine you'd achieve that easily enough with an input step to set a variable?

          Josh McDonald added a comment - I imagine you'd achieve that easily enough with an input step to set a variable?

          Michael Neale added a comment -

          comscience15 not explicitly no - but like Josh says, could have an input step in an earlier stage that captures some environment variable that is then referred to in 'when'. A parametrised job could also provide the same variable I think. Can't put an input inside a 'when' (I think). 

          Michael Neale added a comment - comscience15 not explicitly no - but like Josh says, could have an input step in an earlier stage that captures some environment variable that is then referred to in 'when'. A parametrised job could also provide the same variable I think. Can't put an input inside a 'when' (I think). 

          Ruud P added a comment -

          it is fixed with an update of jenkins, at this moment this works fine for me

          Ruud P added a comment - it is fixed with an update of jenkins, at this moment this works fine for me

          Nat Sr added a comment -

          sophistifunk michaelneale Thanks for your feedback. Yes, it is easy to set a variable. My thought is just about if there is a complicated case which is sometimes is outside the set up variable. So if we can get it with user input too, it would be great. 

          Nat Sr added a comment - sophistifunk michaelneale Thanks for your feedback. Yes, it is easy to set a variable. My thought is just about if there is a complicated case which is sometimes is outside the set up variable. So if we can get it with user input too, it would be great. 

          Lars Nielsen added a comment -

          The graph in scripted pipelines does not show the line flowing around the skipped stage, but through it, like executed steps.

          The steps are shown as "No steps" and the full job log is displayed.

          Lars Nielsen added a comment - The graph in scripted pipelines does not show the line flowing around the skipped stage, but through it, like executed steps. The steps are shown as "No steps" and the full job log is displayed.

            sophistifunk Josh McDonald
            jamesdumay James Dumay
            Votes:
            10 Vote for this issue
            Watchers:
            21 Start watching this issue

              Created:
              Updated:
              Resolved: