Preserve artifacts even when the pipeline fails.
Section: Core stage patterns
Always archive reports and clean up
groovy
groovy
post {
always {
junit 'reports/junit/*.xml'
archiveArtifacts artifacts: 'dist/**', fingerprint: true
cleanWs()
}
}Explanation
`post` blocks keep reporting and cleanup consistent across success and failure states.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Core stage patterns
Multi-stage GitHub Actions workflow
Separate lint, test, build, and deploy into distinct jobs.
Staging then production promotion
Require staging verification before production deploy.
Manual production gate in GitLab
Add a human approval step before production deployment.
Blue/green deploy flow
Switch traffic after health checks pass on the new environment.