If you happen to specify a pattern that doesn't match any files in the workspace, archiveArtifacts will silently fail the build.
Jenkinsfile
node { sh 'echo "lol"' archiveArtifacts artifacts: 'lol*.zip' }
Console Output
Started by user admin [Pipeline] node Still waiting to schedule task Waiting for next available executor Running on Azure0907122157 in /home/azureuser/workspace/Experiments/bad-artifacts [Pipeline] { [Pipeline] sh [bad-artifacts] Running shell script + echo lol lol [Pipeline] step Archiving artifacts [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: FAILURE
archive step
In contrast, the use of the archive step (e.g. archive 'lol*.zip' in the above Jenkinsfile) will result in a silently successful build.
- is duplicated by
-
JENKINS-31931 archive step sets result to FAILURE but does not fail the job
-
- Resolved
-
-
JENKINS-40538 With Pipeline, "archive" sets build status to failure, on empty, but doesn't report / log anything
-
- Closed
-
-
JENKINS-41249 Job failed despite all stages being successful
-
- Closed
-
- relates to
-
JENKINS-45200 Archiving artifacts fails, but build step is shown with a green dot
-
- Resolved
-
-
JENKINS-46180 archive step does not fail on missing/invalid file patterns
-
- Resolved
-
- links to
Notably (IIRC) freestyle jobs log when a step makes the build result worse. Looks like Pipeline does not?