构建自动化是一个自动编译、打包和准备代码转换为可部署工件的过程 — 无需手动步骤。它是CI/CD管道的第一个主要阶段,将源代码转变为可以进行测试和部署的东西。
构建阶段的工作
text
The BUILD automates turning source code into a deployable ARTIFACT:
→ INSTALL dependencies (npm install, pip install, etc.)
→ COMPILE / transpile code (if needed: Java, TypeScript, Go, etc.)
→ BUNDLE / package (frontend bundles, JARs, binaries)
→ BUILD container images (Docker) if containerized
→ produce ARTIFACTS ready for testing and deployment
→ Automated, consistent, repeatable — no manual build steps.
为什么要自动化构建?
text
✓ CONSISTENCY — the same build process every time (no "works on my machine" build issues)
✓ REPEATABILITY — anyone/any pipeline can reproduce the build identically
✓ SPEED — automated builds are fast and don't require manual effort
✓ EARLY ERROR DETECTION — build failures (compile errors, missing deps) caught immediately
✓ Foundation for the rest of the pipeline (test/deploy need the build output)
