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

Declarative plugin adds extra step for failed step but doesn't mark it as error

    XMLWordPrintable

Details

    Description

      Running following code:

      pipeline {
          agent label: ''
          stages {
              stage ('Build') {
                  steps{
                    sh 'echo1 "Building"'
                  }
              }
              stage ('Test') {
                  steps{
                    sh 'echo "Test"'
                  }
              }
              stage ('Deploy') {
                  steps{
                    sh 'echo "Building"'
                  }
              }
          }
      }
      

      Only step in Build stage fails, declarative plugin adds extra print step to print there was failure however this step is not marked as error resulting in failure to mark the stage as error using StatusAndTiming.computeChunkStatus() api, which reports status of stage based on last step. That is if last sep was success, that means all is well. svanoort, this also shows up 'Build' stage as success in stage view plugin.

      Intent of declarative plugin is to report error that running that stage failed, this extra step it injects should have step.getError() return an error, that is FlowNode.getError().getError() returns a well known throwable to identify stage failed to run, StageExecutionFailure or something like that? Otherwise it defeats the purpose of marking stage as failure using StatusAndTiming.computeChunkStatus() API.

      Attachments

        Issue Links

          Activity

            vivek Vivek Pandey created issue -
            vivek Vivek Pandey made changes -
            Field Original Value New Value
            Link This issue blocks JENKINS-39463 [ JENKINS-39463 ]
            vivek Vivek Pandey made changes -
            Description Running following code:

            {code:java}
            pipeline {
                agent label: ''
                stages {
                    stage ('Build') {
                        steps{
                          sh 'echo1 "Building"'
                        }
                    }
                    stage ('Test') {
                        steps{
                          sh 'echo "Test"'
                        }
                    }
                    stage ('Deploy') {
                        steps{
                          sh 'echo "Building"'
                        }
                    }
                }
            }
            {code}

            Only step in Build stage fails, declarative plugin adds extra print step to print there was failure however this step is not marked as error resulting in failure to mark the stage as error using StatusAndTiming.computeChunkStatus() api, which reports status of stage based on last step. That is if last sep was success, that means all is well. [~svanoort], this also shows up 'Build' stage as success in stage view plugin.

            Intent of declarative plugin is to report error that running that stage failed, this extra step it injects should have step.getError() return an error object otherwise it defeats the purpose.
            Running following code:

            {code:java}
            pipeline {
                agent label: ''
                stages {
                    stage ('Build') {
                        steps{
                          sh 'echo1 "Building"'
                        }
                    }
                    stage ('Test') {
                        steps{
                          sh 'echo "Test"'
                        }
                    }
                    stage ('Deploy') {
                        steps{
                          sh 'echo "Building"'
                        }
                    }
                }
            }
            {code}

            Only step in Build stage fails, declarative plugin adds extra print step to print there was failure however this step is not marked as error resulting in failure to mark the stage as error using StatusAndTiming.computeChunkStatus() api, which reports status of stage based on last step. That is if last sep was success, that means all is well. [~svanoort], this also shows up 'Build' stage as success in stage view plugin.

            Intent of declarative plugin is to report error that running that stage failed, this extra step it injects should have step.getError() return an error, that is FlowNode.getError().getError() returns a well known throwable to identify stage failed to run, StageExecutionFailure or something like that? Otherwise it defeats the purpose of marking stage as failure using StatusAndTiming.computeChunkStatus() API.
            abayer Andrew Bayer made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            abayer Andrew Bayer made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            abayer Andrew Bayer made changes -
            Remote Link This issue links to "PR #51 (Web Link)" [ 15038 ]
            abayer Andrew Bayer made changes -
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Resolved [ 5 ]
            bitwiseman Liam Newman made changes -
            Status Resolved [ 5 ] Closed [ 6 ]

            People

              abayer Andrew Bayer
              vivek Vivek Pandey
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: