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

    • Similar Issues:

      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. Sam Van Oort, 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

            Hide
            abayer Andrew Bayer added a comment -

            So I'm now trying out adding an ErrorAction to the stage FlowNode - does that do what you need?

            Show
            abayer Andrew Bayer added a comment - So I'm now trying out adding an ErrorAction to the stage FlowNode - does that do what you need?
            Hide
            abayer Andrew Bayer added a comment -

            Check that - I see what's needed. Moving the error to the last step in the stage instead.

            Show
            abayer Andrew Bayer added a comment - Check that - I see what's needed. Moving the error to the last step in the stage instead.
            Show
            abayer Andrew Bayer added a comment - PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/51
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pipeline-model-definition/pom.xml
            pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/Utils.groovy
            pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/1d397c25acff419a0a82611e0f5ae13679b9639f
            Log:
            [FIXED JENKINS-39631] Last step in failed stage has an error.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pipeline-model-definition/pom.xml pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/Utils.groovy pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java http://jenkins-ci.org/commit/pipeline-model-definition-plugin/1d397c25acff419a0a82611e0f5ae13679b9639f Log: [FIXED JENKINS-39631] Last step in failed stage has an error.

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                vivek Vivek Pandey
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: