Site Tools


swe:artifact

Table of Contents

Artifact

Artifact is a file or package produced by a build process: a compiled binary, Docker image, firmware file, or compiled PDF. Source code is the input; artifacts are the outputs intended for use or distribution.

Rebuilding from source before each deployment is slow and creates risk: you cannot guarantee the same bits were tested and deployed. Artifact registries store and serve versioned artifacts (Docker Hub, npm, PyPI, Artifactory), enabling rollback without rebuilding.

In CI/CD pipelines, build the artifact once from a commit, test that exact artifact in staging, then deploy the same artifact to production. This guarantees what was tested is what shipped. Artifacts are versioned by semantic version or build number so rollback is fast.

The workflow builds once, tags it, tests it, then promotes the identical artifact through environments.

# CI/CD pipeline: build once, deploy the same artifact
docker build -t myapp:v1.2.3 .
docker tag myapp:v1.2.3 registry.example.com/myapp:v1.2.3
docker push registry.example.com/myapp:v1.2.3
 
# Test artifact in staging (exact same image)
docker run registry.example.com/myapp:v1.2.3 npm test
 
# Deploy same tested artifact to production
kubectl set image deployment/app app=registry.example.com/myapp:v1.2.3
 
# Rollback to previous artifact (instant, no rebuild)
kubectl set image deployment/app app=registry.example.com/myapp:v1.2.2
swe/artifact.md · Last modified: by 127.0.0.1