Build Once, Promote the Same Artifact
The most important release rule: build the artifact once, test it, and then move that exact file or image through staging and production. If you rebuild for production you ship something nobody tested.
Jenkins' Own Artifact Storage
- Artifacts are stored in
JENKINS_HOMEon the controller. They are fine for small files and short retention - Fingerprints record the MD5 of a file so Jenkins can show where it was built and used
- Large or long-lived artifacts belong in a repository manager or object storage
- Limit retention:
buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '5'))
Artifact Repositories
| Tool | Stores | Notes |
|---|---|---|
| Sonatype Nexus Repository | Maven, npm, PyPI, Docker, NuGet, Helm, raw files | Hosted, proxy (cache) and group repositories |
| JFrog Artifactory | Same list and more | Build info, promotion features |
| GitHub Packages, GitLab Registry, cloud registries (ECR, ACR, GAR) | Packages and images | Good when you are in that platform |
| S3 or other object storage | Any file | Cheap and simple for raw artifacts |
Publish to Nexus With Maven
Publish Other Types
Version Numbers
| Scheme | Example | Notes |
|---|---|---|
| Semantic Versioning | MAJOR.MINOR.PATCH such as 2.3.1 | MAJOR: breaking change, MINOR: new feature, PATCH: bug fix |
| Build number | 1.4.${BUILD_NUMBER} | Easy, but numbers depend on the Jenkins job |
| Git SHA | 3f9c2ab | Exact commit. Great as metadata or an image tag |
| Both | 1.4.27+3f9c2ab | SemVer plus build metadata: best for traceability |
| Calendar versioning | 2026.11.17.3 | Fits frequently released services |
Tag-Driven Releases
A common, simple flow: a Git tag starts the release. The tag is the version, set by a person, or by an automatic tool from commit messages (semantic-release, release-please, GitVersion).
Promotion Without Rebuilding
- Promote by copying or retagging the same artifact, never by rebuilding
- For images, promote by digest:
docker buildx imagetools create -t registry/prod/app:1.4.2 registry/dev/app@sha256:... - In Artifactory or Nexus use repositories like
dev,staging,release, and move builds between them after tests pass - Record in the artifact metadata the Git commit, build URL and test results, so every deployed file can be traced
Retention and Cleanup
| What | Policy idea |
|---|---|
| Snapshots and dev builds | Delete after 14 to 30 days |
| Release artifacts | Keep for the support life of the product |
| Docker images in dev | Keep the last N tags per branch |
| Jenkins build artifacts | Keep few; the repository manager is the long-term store |
Practice Tasks
- Archive an artifact with fingerprints and find where it was used
- Publish a package to a Nexus or Artifactory lab server from the pipeline
- Create a version string with SemVer plus build metadata and show it in the artifact name
- Build a release job that runs only for tags matching
vX.Y.Z - Write the steps to promote an image from dev to prod by digest
Conclusion
Store artifacts in a repository manager, not only in Jenkins, version them with Semantic Versioning plus build metadata, drive releases from Git tags, and promote the same artifact through environments instead of rebuilding. Keep retention rules so storage stays under control.

