Jenkinsfile Archive Step: Allow Missing Artifacts

Jenkinsfile Archive Step: Allow Missing Artifacts

Under the regular UI defined jobs I can select "Do not fail build if archiving returns nothing". How do I achieve the equivalent in pipeline code?

E.g. currently I have something along these lines:

archive 'screenshots/**', 'build/test/results/*.xml'

and it is OK if there are no screenshots since there would be none if all tests pass.

1 Answer

Use the new archiveArtifacts command, like this:

archiveArtifacts artifacts: 'screenshots/**,build/test/results/*.xml', allowEmptyArchive: true

Find the complete documentation of this command at

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

David Miller
Author

David Miller

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.