Build artifact
Артефакт сборки
A build produces files you can save and use without building the project again. An executable, a library package, or a container image can all be build artifacts.
Also known as: registry
What counts as a build artifact?
Source code is what developers edit. A build artifact is an output that another step or person can pick up and use. Maven might produce a JAR for a Java service, while a frontend build might produce a directory of HTML, CSS, and JavaScript ready to publish. An artifact doesn't have to be a single file or a runnable application: a library package is an artifact for the team that builds it and a dependency for the teams that install it.
How artifacts move through CI/CD
A build job checks out a specific commit, runs the build, and saves selected outputs before its workspace is cleaned up. Another job can then download those outputs for testing or packaging. CI artifact storage is often enough to pass files between jobs in one pipeline. A package repository, container registry, or other long-lived store is a better fit when other projects or later deployments need to retrieve a published version.
For a deployable artifact, a common pattern is build once, deploy many: test the built output, then deploy that same output to each environment. Keep environment-specific settings, such as the database address, in runtime configuration where possible. Otherwise, changing the setting may require a new build, and the resulting artifact is no longer the one you tested.
Example: promoting a container image
A pipeline builds an image for an orders service and pushes it to a registry under the tag 1.8.0. The pipeline records the image's digest, a content-based identifier. Staging pulls the image by digest and runs smoke tests. After approval, production pulls the same digest rather than rebuilding the image or looking up a mutable tag. If a team needs to roll back, it can redeploy the previous digest as long as the image is still retained. That restores the previous application image, not the previous state of the database.
Common mix-ups
- Registry vs. artifact: A registry stores and serves artifacts such as container images. The image is the artifact; the registry is where you publish and retrieve it.
- CI cache vs. artifact: A cache saves work, for example by keeping downloaded dependencies. A cache miss should usually make a build slower, not impossible. If a published artifact is deleted, a deployment that references that exact output can no longer retrieve it.
- Build artifact vs. job artifact: CI systems often call any retained job output an artifact. A test report or log is useful for inspection, but it isn't the application package you deploy.
Interview angle
You may be asked why a release job shouldn't just rebuild from the same Git commit. The commit identifies the source, not necessarily the dependencies, base image, or toolchain used that day. Unless the build is reproducible, those differences can change the output. Deploying the exact artifact that passed testing removes that uncertainty; keeping its identifier and retaining earlier versions also makes rollback practical.