Previously, atlas-cli was generating a Jenkinsfile that did cleanup in the always block. This can be problematic when there are multiple post conditions. always is always the first post-condition to run. If always cleans up the artifacts before success has a chance to process them, the pipeline will fail. By appropriately using the cleanup block, the cleanup will run after all other operations.
Jenkins specifies that cleanup should be done in the
cleanup
block: https://www.jenkins.io/doc/book/pipeline/syntax/#postPreviously,
atlas-cli
was generating a Jenkinsfile that did cleanup in thealways
block. This can be problematic when there are multiplepost
conditions.always
is always the first post-condition to run. Ifalways
cleans up the artifacts beforesuccess
has a chance to process them, the pipeline will fail. By appropriately using thecleanup
block, the cleanup will run after all other operations.