Skip to content
Latchkey

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

References

Run this faster and cheaper on Latchkey managed runners - self-healing included. Start free → 30-day trial · No credit card