Artifact
一句话解释
artifact 是 file or 设置的 files produced 通过构建流水线, 例如 binary, 包, or Docker 镜像.
用大白话说
An artifact is the output of a build process — it is the packaged, deployable result. Common examples include a compiled binary, a .jar file, a .zip archive, a Node.js package, or a Docker image.
Artifacts are stored in an artifact repository (like Nexus, Artifactory, or a container registry) so they can be versioned, shared, and deployed. Each artifact is tagged with a version number, so you know exactly which code produced it.
The key idea is that the build step produces an artifact once, and the same artifact is deployed to all environments (dev, staging, prod). This ensures that what you tested is exactly what you deploy — no rebuilding for each environment.
示例
# Build produces an artifact (Docker image)
docker build -t myapp:1.2.3 .
# Push to a registry (artifact storage)
docker push registry.example.com/myapp:1.2.3
# Deploy the same artifact to production
kubectl set image deployment/myapp myapp=registry.example.com/myapp:1.2.3构建镜像一次, 推送它 到 registry as artifact, 然后部署精确相同 artifact 到 production.
工作原理
- The build stage compiles and packages your code into an artifact.
- The artifact is versioned (e.g., 1.2.3) and stored in a registry.
- The deploy stage pulls the same artifact and deploys it.
- The same artifact is promoted across environments without rebuilding.
常见混淆
容易混淆的对象: 镜像
关键区别: 镜像是 特定类型的 artifact (容器镜像); artifacts 也包含 binaries, 包, and archives.
相关术语
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。