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

All stages show up as UNSTABLE when only one stage should

    XMLWordPrintable

Details

    • 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

    Description

      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).

      Attachments

        Issue Links

          Activity

            kon 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.

            kon 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.
            brianjmurrell 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.

            brianjmurrell 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.

            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.

            brianjmurrell 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.
            dnusbaum 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 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).

            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.

            brianjmurrell 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.

            People

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

              Dates

                Created:
                Updated:
                Resolved: