Artifact Versioning Strategies
What you'll learn: How to systematically identify and label build artifacts using semantic versioning, build numbers, commit hashes, and timestamps.
Why Versioning Matters
Once your CI/CD pipeline produces artifacts (the compiled outputs from your builds), you need a reliable way to identify them. Without clear versioning, you can't tell which artifact contains which features, which is safe for production, or what to roll back to if things go wrong. Think of versioning like putting dated labels on containers in your freezer—you need to know what's inside and when it was made.
Common Versioning Approaches
Semantic Versioning (SemVer)
Format: MAJOR.MINOR.PATCH (e.g., 2.3.1)
- MAJOR: Breaking changes that aren't backward compatible
- MINOR: New features that don't break existing functionality
- PATCH: Bug fixes and small tweaks
Best for: Application releases where compatibility matters
Build Numbers
Sequential integers: 1, 2, 3, 1234
Often combined with SemVer: 2.3.1-build.1234
Best for: Tracking every pipeline execution uniquely
Commit Hashes
Git short or full SHA: a3f21bc or a3f21bc7d4e9...
Example: 2.3.1+a3f21bc
Best for: Traceability back to exact source code
Timestamp-Based
Format: 20240115-143022 (YYYYMMDD-HHMMSS)
Best for: Nightly builds or time-sensitive deployments
Hybrid Approaches
Real-world pipelines often combine strategies:
v2.3.1-build.1234+a3f21bcgives you version, sequence, and source2.3.1-rc.1indicates a release candidate before final release
Key Takeaway: Choose a versioning strategy that balances human readability with traceability—semantic versioning for releases, build numbers for uniqueness, commit hashes for debugging, and timestamps when chronology matters most.