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

All stages show up as UNSTABLE when only one stage should

    • Blue Ocean 1.2-beta2, Blue Ocean 1.2-beta3, Blue Ocean 1.2-beta4, Blue Ocean 1.2, Blue Ocean 1.3, Blue Ocean 1.4 - beta 1
    • Blue Ocean 1.17.0, Pipeline: API 2.34, Pipeline: Basic Steps 2.18, Pipeline: Graph Analysis 1.10, Pipeline: Groovy 2.70, Pipeline: Declarative 1.3.9, JUnit: 1.28, Warnings Next Generation 5.2.0

      Problem
      When there is a build which has a stage that marks the build as unstable, all the stages, parallels and steps are marked incorrectly as unstable than just the unstable stage, parallel and step that caused the Pipeline to be unstable.

      To reproduce

      1. Build the multibranch pipeline "kzantow/failure-project" from github
      2. Look at the "michaelneale" branch
      3. Note that all stages are unstable (check the api json, all stages are UNSTABLE but should not be, only the final stage should be).

          [JENKINS-39203] All stages show up as UNSTABLE when only one stage should

          Devin Nusbaum added a comment -

          Given the core changes have been released, I am closing this issue. As noted in my blog post, if you are still having problems with a Pipeline step from specific please file a new issue with the component set to that plugin (after checking for duplicates), clearly describing which step has the problem and under what circumstances it occurs, and link to the developers section of the post as a reference for how the maintainer might be able to address the problem.
           

          Devin Nusbaum added a comment - Given the core changes have been released, I am closing this issue. As noted in my blog post, if you are still having problems with a Pipeline step from specific please  file a new issue  with the component set to that plugin (after checking for duplicates), clearly describing which step has the problem and under what circumstances it occurs, and link to the developers section of the post  as a reference for how the maintainer might be able to address the problem.  

          Just created the issue for Pipeline: Stage View Plugin -> https://issues.jenkins-ci.org/browse/JENKINS-58783

          Jonathan Araña Cruz added a comment - Just created the issue for Pipeline: Stage View Plugin -> https://issues.jenkins-ci.org/browse/JENKINS-58783

          Vincent Yan added a comment - - edited

          Thanks for the hard work. I've just recently started to use Jenkins but on a older version. Then came along this issue while I was googling about the stage result issue. Glad there's already a solution in the recent version!  Appreciate it!

          Vincent Yan added a comment - - edited Thanks for the hard work. I've just recently started to use Jenkins but on a older version. Then came along this issue while I was googling about the stage result issue. Glad there's already a solution in the recent version!   Appreciate it!

          Was this more than just a visualisation problem or was this actually making stage B run it's post->unstable steps if stage A was UNSTABLE and set the overall build status to UNSTABLE?  Because that would be very bad/wrong.

          Brian J Murrell added a comment - Was this more than just a visualisation problem or was this actually making stage B run it's post -> unstable steps if stage A was UNSTABLE and set the overall build status to UNSTABLE ?  Because that would be very bad/wrong.

          Pete W added a comment -

          Devin's blog post explains this issue and the fix well brianjmurrell

          The fix doesn't make B Stage run, or not run - it still leaves it down to the implementor to choose if they want B to run or not

          Pete W added a comment - Devin's blog post explains this issue and the fix well brianjmurrell The fix doesn't make B Stage run, or not run - it still leaves it down to the implementor to choose if they want B to run or not

          I have read Devin's blog post.  It does not answer my question AFAIU.  But you might think it could because you misunderstood my question.

          My question was not about whole stages running or not running.  Both stages A and B are running.  B was SUCCESSFUL and A was UNSTABLE.  What I am seeing however is that B's post->unstable is being run even though B was successful.

          I am trying to determine if that mis-behaviour is a component of this bug or if this is something different/new.

          Brian J Murrell added a comment - I have read Devin's blog post.  It does not answer my question AFAIU.  But you might think it could because you misunderstood my question. My question was not about whole stages running or not running.  Both stages A  and B  are running.  B  was SUCCESSFUL  and A  was UNSTABLE .  What I am seeing however is that B 's post -> unstable is being run even though B was successful. I am trying to determine if that mis-behaviour is a component of this bug or if this is something different/new.

          Devin Nusbaum added a comment -

          brianjmurrell Declarative post conditions look at the overall build result, so if a step like unstable or junit marks the build as unstable in stage A and the Pipeline continues executing, unstable post conditions in later stages such as B will execute (unless the build result becomes worse than unstable, e.g. failure). As far as I know Declarative has always worked this way. Before the fix for this issue, both stage A and stage B would have been shown as being unstable in Blue Ocean, but after the fix for this issue, only stage A is shown as unstable (the overall build result was shown as unstable both before and after the fix).

          Devin Nusbaum added a comment - brianjmurrell Declarative post conditions look at the overall build result, so if a step like unstable or junit marks the build as unstable in stage A and the Pipeline continues executing, unstable post conditions in later stages such as B will execute (unless the build result becomes worse than unstable, e.g. failure). As far as I know Declarative has always worked this way. Before the fix for this issue, both stage A and stage B would have been shown as being unstable in Blue Ocean, but after the fix for this issue, only stage A is shown as unstable (the overall build result was shown as unstable both before and after the fix).

          dnusbaum Whoa!  Are you serious (and sure of what you are saying)?  It seems very un-intuitive, at best, that the status of any individual given stage should be able to alter the status of any other stage.  I would absolutely agree that the outer pipeline {} block's post should be executed per the overall build result, but most certainly not any individual stage.

          I suppose there must be some, can't imagine a use-case where that is useful.  On the contrary, if one has a parallel block of test stages, why would I want the unstable post block of test stage A to run when test stage A passed, but test stage B failed?

          Ultimately, I suppose this should move to a new ticket.  I will open one.  But I probably need to mock up a minimal reproducer before I do.

          Brian J Murrell added a comment - dnusbaum Whoa!  Are you serious (and sure of what you are saying)?  It seems very un-intuitive,  at best , that the status of any individual given stage should be able to alter the status of any other stage.  I would absolutely agree that the outer pipeline { } block's post should be executed per the overall build result, but most certainly not any individual stage. I suppose there must be some, can't imagine a use-case where that is useful.  On the contrary, if one has a parallel block of test stages, why would I want the unstable post block of test stage A to run when test stage A passed, but test stage B failed? Ultimately, I suppose this should move to a new ticket.  I will open one.  But I probably need to mock up a minimal reproducer before I do.

          Brian J Murrell added a comment - - edited

          dnusbaum Can you please respond to the previous comment?  Is it really the expected behaviour that all stages in a parallel block execute their post > failure blocks when even just 1 other stage in the parallel group fails?  The result being that stages that actually were successful don't actually process their own post > successful block but instead process their own post -> failure block?

          Quite frankly, this behaviour is hideous.  In my case, a stage is not actually even failing.  In a block of 3 parallel stages if just one of them invokes a catchError(stageResult: 'UNSTABLE', buildResult: 'SUCCESS'), the remaining stages take their post > failure exit path, even though they are SUCCESSFUL, and even though the stage that invoked the catchError() takes it's own post > successful path!

          I cannot imagine how this is not a bug.  This makes catchError(stageResult: 'UNSTABLE', buildResult: 'SUCCESS') quite useless in fact if it can bomb the exit of other stages.

          Brian J Murrell added a comment - - edited dnusbaum  Can you please respond to the previous comment?  Is it really the expected behaviour that all stages in a parallel block execute their post > failure blocks when even just 1 other stage in the parallel group fails?  The result being that stages that actually were successful don't actually process their own post > successful block but instead process their own post -> failure block? Quite frankly, this behaviour is hideous.  In my case, a stage is not actually even failing.  In a block of 3 parallel stages if just one of them invokes a catchError(stageResult: 'UNSTABLE', buildResult: 'SUCCESS') , the remaining stages take their post > failure exit path, even though they are SUCCESSFUL, and even though the stage that invoked the catchError() takes it's own post > successful path! I cannot imagine how this is not a bug.  This makes catchError(stageResult: 'UNSTABLE', buildResult: 'SUCCESS') quite useless in fact if it can bomb the exit of other stages.

          Kalle Niemitalo added a comment - - edited

          JENKINS-57801 has been filed about declarative Pipeline stage post conditions being affected by the result of the whole pipeline.

          Kalle Niemitalo added a comment - - edited JENKINS-57801 has been filed about declarative Pipeline stage post conditions being affected by the result of the whole pipeline.

            dnusbaum Devin Nusbaum
            michaelneale Michael Neale
            Votes:
            233 Vote for this issue
            Watchers:
            237 Start watching this issue

              Created:
              Updated:
              Resolved: