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

Dockerfile build failures do not trigger failure post section

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I am using the new Dockerfile support added in JENKINS-39216. I also have a "post" section within "pipeline" in my Jenkinsfile set up to send notifications of the build result:

      pipeline {
        // Build environment is defined by the Dockerfile
        agent dockerfile:true
        stages {
          stage('package') {
            steps {
              // Do build
            }
          }
        }
        post {
          success {
            hipchatSend color: "GREEN", message: "SUCCESS: <a href=\"${currentBuild.absoluteUrl}\">${currentBuild.fullDisplayName}</a>"
          }
          failure {
            hipchatSend color: "RED", message: "FAILURE: <a href=\"${currentBuild.absoluteUrl}\">${currentBuild.fullDisplayName}</a>", notify: true
          }
          unstable {
            hipchatSend color: "YELLOW", message: "UNSTABLE: <a href=\"${currentBuild.absoluteUrl}\">${currentBuild.fullDisplayName}</a>", notify: true
          }
        }
      }
      

      However, if a failure occurs during the Dockerfile image build (e.g. a non-zero return code from a RUN step), the build is marked as failed but no notification is sent.

        Attachments

          Issue Links

            Activity

            Show
            abayer Andrew Bayer added a comment - PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/64
            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/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy
            pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineScript.groovy
            pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/LabelScript.groovy
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java
            pipeline-model-definition/src/test/resources/failureBeforeStages.groovy
            pipeline-model-definition/src/test/resources/skippedStagesForFailure.groovy
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/3cdc1032649e64244be3f3ebee7a1280188e0009
            Log:
            [FIXED JENKINS-40226] Make sure non-within-stage failures are real.

            More notably, make sure we still end up doing a `post` for them if
            needed and that the build status is correct at that time.

            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/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineScript.groovy pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/LabelScript.groovy pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java pipeline-model-definition/src/test/resources/failureBeforeStages.groovy pipeline-model-definition/src/test/resources/skippedStagesForFailure.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/3cdc1032649e64244be3f3ebee7a1280188e0009 Log: [FIXED JENKINS-40226] Make sure non-within-stage failures are real. More notably, make sure we still end up doing a `post` for them if needed and that the build status is correct at that time.
            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/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy
            pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineScript.groovy
            pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/LabelScript.groovy
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java
            pipeline-model-definition/src/test/resources/failureBeforeStages.groovy
            pipeline-model-definition/src/test/resources/skippedStagesForFailure.groovy
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/9bc4f82364f7562799716b3e95c5d52bb1ccb8e5
            Log:
            Merge pull request #64 from abayer/jenkins-40226

            [FIXED JENKINS-40226] Make sure non-within-stage failures are real.

            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/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineScript.groovy pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/LabelScript.groovy pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java pipeline-model-definition/src/test/resources/failureBeforeStages.groovy pipeline-model-definition/src/test/resources/skippedStagesForFailure.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/9bc4f82364f7562799716b3e95c5d52bb1ccb8e5 Log: Merge pull request #64 from abayer/jenkins-40226 [FIXED JENKINS-40226] Make sure non-within-stage failures are real.

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                gllewellyn Gavin Llewellyn
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: