How to Archive Build Artifacts in a Jenkins Pipeline
archiveArtifacts attaches matched files to the build so they are downloadable later from the build page.
Point archiveArtifacts at a glob of your build outputs. Add fingerprinting to track which build produced an artifact across jobs.
Archive with fingerprinting
Archive the dist bundle and fingerprint it so Jenkins can trace it across jobs.
Jenkinsfile
pipeline {
agent any
stages {
stage('Build') {
steps { sh 'npm ci && npm run build' }
}
}
post {
success {
archiveArtifacts artifacts: 'dist/**/*', fingerprint: true
}
}
}Notes
- fingerprint: true lets Jenkins correlate the same artifact across upstream and downstream builds.
- Archived artifacts live with the build record; configure build retention to bound disk usage.
- For large binaries prefer an external store and archive only a manifest.
Frequently asked questions
How do I archive Build Artifacts in a Jenkins Pipeline?
Point archiveArtifacts at a glob of your build outputs. Add fingerprinting to track which build produced an artifact across jobs.
Archive with fingerprinting?
Archive the dist bundle and fingerprint it so Jenkins can trace it across jobs.
Related guides
How to Archive Build Artifacts in a Jenkins PipelineArchive build artifacts in a Jenkins pipeline with archiveArtifacts, publish test reports with junit, and pas…
How to Build a Multi-Arch Docker Image in a Jenkins PipelineBuild a multi-architecture Docker image in a Jenkins pipeline with docker buildx and QEMU, pushing one amd64…
How to Cache Gradle Dependencies in a Jenkins PipelineCache Gradle dependencies in a Jenkins pipeline by pinning GRADLE_USER_HOME to a persistent path, or using th…