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

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

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Component/s: core
    • Labels:
    • Environment:
      Jenkins 1.625.2 LTS
    • Similar Issues:

      Description

      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.

        Attachments

          Issue Links

            Activity

            Hide
            jglick 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.

            Show
            jglick 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.
            Hide
            scm_issue_link 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.

            Show
            scm_issue_link 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.
            Hide
            scm_issue_link 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

            Show
            scm_issue_link 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
            Hide
            jglick Jesse Glick added a comment -

            Andrew Bayer fixed the main problem here in JENKINS-38005, though not the additional cleanup that I suggest.

            Show
            jglick Jesse Glick added a comment - Andrew Bayer fixed the main problem here in  JENKINS-38005 , though not the additional cleanup that I suggest.

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: