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.
- duplicates
-
JENKINS-38005 Using archiveArtifacts with a non-matching pattern silently fails the build
-
- Resolved
-
- relates to
-
JENKINS-46180 archive step does not fail on missing/invalid file patterns
-
- Resolved
-
-
JENKINS-47142 archiveArtifacts step failure is not displayed
-
- Resolved
-
- links to
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.