Buildkite CI 流水线
Buildkite 由托管控制面和自建 agent 组成,流水线用 YAML 定义,构建在自有基础设施上执行。适合需要自定义构建环境、GPU 或内网访问的团队。
核心概念:pipeline、step、agent、queue、plugin、hook。
安装 agent:
curl -fsSL https://buildkite.com/install | bash
buildkite-agent start --token "$BUILDKITE_AGENT_TOKEN"
pipeline.yml:
steps:
- label: ":test_tube: test"
command: "make test"
agents:
queue: "linux"
- label: ":docker: build"
command: "docker build -t app:$BUILDKITE_COMMIT ."
depends_on: test
- wait
- label: ":rocket: deploy"
command: "./deploy.sh"
if: build.branch == "main"
动态流水线:
buildkite-agent pipeline upload .buildkite/deploy.yml
depends_on,部署在测试前执行。