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

archive step sets result to FAILURE but does not fail the job

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • core
    • Jenkins 1.625.2 LTS

      When no files matching the file mask are found, the archive workflow step as well as the general build step will set the result of the workflow to FAILURE but the build continues. The Step is not marked as failed in the "Workflow Steps" graph

      node('master') {
        archive "nonexistingdir/"
        step([$class: 'ArtifactArchiver', artifacts: 'nonexistingdir/', excludes: null])
      }
      

      Both steps are marked as SUCCESS, the overall build is marked as FAILED, though. There is no (error) message.

          [JENKINS-31931] archive step sets result to FAILURE but does not fail the job

          Christoph Vogtländer created issue -
          Jesse Glick made changes -
          Component/s New: workflow-plugin [ 18820 ]
          Component/s Original: core [ 15593 ]
          Labels Original: workflow
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 167402 ] New: JNJira + In-Review [ 182713 ]
          Andrew Bayer made changes -
          Component/s New: pipeline-general [ 21692 ]
          Andrew Bayer made changes -
          Component/s Original: workflow-plugin [ 18820 ]

          Jesse Glick added a comment -

          The now-deprecated archive step does not fail the build.

          ArtifactArchiver in core does fail the build unless you pass allowEmptyArchive: true. However its result != null && result.isBetterOrEqualTo(Result.UNSTABLE) condition ought to read result == null || result.isBetterOrEqualTo(Result.UNSTABLE) since for a Pipeline build normally the result is null until the end of the build.

          Also rather than calling build.setResult(Result.FAILURE), it should throw an AbortException. Similarly, the whole try-catch block could better be deleted.

          Jesse Glick added a comment - The now-deprecated archive step does not fail the build. ArtifactArchiver in core does fail the build unless you pass allowEmptyArchive: true . However its result != null && result.isBetterOrEqualTo(Result.UNSTABLE) condition ought to read result == null || result.isBetterOrEqualTo(Result.UNSTABLE) since for a Pipeline build normally the result is null until the end of the build. Also rather than calling build.setResult(Result.FAILURE) , it should throw an AbortException . Similarly, the whole try - catch block could better be deleted.
          Jesse Glick made changes -
          Component/s New: core [ 15593 ]
          Component/s Original: pipeline [ 21692 ]
          Labels New: pipeline
          Jesse Glick made changes -
          Remote Link New: This issue links to "workflow-basic-steps PR 17 (Web Link)" [ 14780 ]

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/workflow/steps/ArtifactArchiverStepExecution.java
          src/main/java/org/jenkinsci/plugins/workflow/steps/CoreStep.java
          src/test/java/org/jenkinsci/plugins/workflow/steps/ArtifactArchiverStepTest.java
          src/test/java/org/jenkinsci/plugins/workflow/steps/CoreStepTest.java
          http://jenkins-ci.org/commit/workflow-basic-steps-plugin/be563c856a50995271be490911988be0996865c4
          Log:
          Testing JENKINS-31931.
          Also fixing a buglet with nonexistent workspaces.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/steps/ArtifactArchiverStepExecution.java src/main/java/org/jenkinsci/plugins/workflow/steps/CoreStep.java src/test/java/org/jenkinsci/plugins/workflow/steps/ArtifactArchiverStepTest.java src/test/java/org/jenkinsci/plugins/workflow/steps/CoreStepTest.java http://jenkins-ci.org/commit/workflow-basic-steps-plugin/be563c856a50995271be490911988be0996865c4 Log: Testing JENKINS-31931 . Also fixing a buglet with nonexistent workspaces.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/workflow/steps/ArtifactArchiverStepExecution.java
          src/main/java/org/jenkinsci/plugins/workflow/steps/CoreStep.java
          src/test/java/org/jenkinsci/plugins/workflow/steps/ArtifactArchiverStepTest.java
          src/test/java/org/jenkinsci/plugins/workflow/steps/CoreStepTest.java
          http://jenkins-ci.org/commit/workflow-basic-steps-plugin/05bf1fb6446d37ef8634555e1e1c8bb331cdf9ac
          Log:
          Merge pull request #17 from jglick/test-JENKINS-31931

          JENKINS-31931 Adding test case

          Compare: https://github.com/jenkinsci/workflow-basic-steps-plugin/compare/86af7fdf73cd...05bf1fb6446d

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/steps/ArtifactArchiverStepExecution.java src/main/java/org/jenkinsci/plugins/workflow/steps/CoreStep.java src/test/java/org/jenkinsci/plugins/workflow/steps/ArtifactArchiverStepTest.java src/test/java/org/jenkinsci/plugins/workflow/steps/CoreStepTest.java http://jenkins-ci.org/commit/workflow-basic-steps-plugin/05bf1fb6446d37ef8634555e1e1c8bb331cdf9ac Log: Merge pull request #17 from jglick/test- JENKINS-31931 JENKINS-31931 Adding test case Compare: https://github.com/jenkinsci/workflow-basic-steps-plugin/compare/86af7fdf73cd...05bf1fb6446d

            Unassigned Unassigned
            gordin Christoph Vogtländer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: