How do you manage artifacts in CI/CD? Why are versioning strategy and immutable artifacts important?
Artifact Management
An artifact is the output of a build process: Docker images, JAR files, NPM packages, etc.
Immutable Artifacts
Core principle: The same version of an artifact has identical content across all environments and is never modified.
Benefits:
- An image that passes tests in dev is guaranteed to be the same one deployed to prod
- Problems can be accurately reproduced in the production environment
- Clear audit trail
Anti-patterns that violate this principle: using the :latest tag, or rebuilding in different environments.
Docker Image Versioning Strategies
Semantic versioning: v1.2.3 (suitable for public APIs)
Git commit SHA: myapp:abc1234 (recommended — most precise, fully traceable)
Build number: myapp:build-456 (used with CI system)
Multi-tag strategy (recommended):
Tag the same image with multiple tags simultaneously:
- myapp:abc1234 (immutable, points to specific commit)
- myapp:v1.2.3 (semantic version)
- myapp:latest (points to latest stable, convenient for development)
Container Registries
| Platform | Registry |
|---|---|
| AWS | ECR (Elastic Container Registry) |
| GCP | Artifact Registry |
| Azure | ACR (Azure Container Registry) |
| General | Docker Hub, GitHub Container Registry |
Cleanup Policy
Set image retention policies to automatically delete images older than N days or beyond N versions, controlling storage costs.
✦ AI Mock Interview
Type your answer and get instant AI feedback
Sign in to use AI scoring
