buildkite-migration
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBuildkite Migration
Buildkite 迁移
Convert CI/CD pipelines from GitHub Actions, Jenkins, CircleCI, Bitbucket Pipelines, and GitLab CI to Buildkite using the command. The command sends the source file to a public conversion API — no Buildkite account or API token is required.
bk pipeline convert使用 命令将 GitHub Actions、Jenkins、CircleCI、Bitbucket Pipelines 和 GitLab CI 的 CI/CD pipelines 转换为 Buildkite。该命令会将源文件发送到公共转换 API——无需 Buildkite 账号或 API token。
bk pipeline convertQuick Start
快速开始
bash
undefinedbash
undefined1. Install the bk CLI (no login needed for convert)
1. Install the bk CLI (no login needed for convert)
brew tap buildkite/buildkite && brew install buildkite/buildkite/bk
brew tap buildkite/buildkite && brew install buildkite/buildkite/bk
2. Convert the source pipeline file
2. Convert the source pipeline file
bk pipeline convert -F .github/workflows/ci.yml
bk pipeline convert -F .github/workflows/ci.yml
3. Find the output in .buildkite/pipeline.github.yml
3. Find the output in .buildkite/pipeline.github.yml
> For pipeline YAML syntax and step types, see the **buildkite-pipelines** skill.
> For other bk CLI commands, see the **buildkite-cli** skill.
> 有关 pipeline YAML 语法和 step 类型,请参阅 **buildkite-pipelines** skill。
> 有关其他 bk CLI 命令,请参阅 **buildkite-cli** skill。Agent Workflow
Agent 工作流
When a user provides a pipeline file or pastes pipeline content to convert:
- Write the content to a temp file (e.g. for GitHub Actions so vendor auto-detection works)
/tmp/.github/workflows/ci.yml - Run
bk pipeline convert -F <tempfile> --output <output-path> - Read the output file and display it as a YAML code block — nothing else
- Do not summarise, annotate, or critique the output unless the user explicitly asks for feedback
当用户提供待转换的 pipeline 文件或粘贴 pipeline 内容时:
- 将内容写入临时文件(例如 GitHub Actions 使用 ,以便 provider 自动检测生效)
/tmp/.github/workflows/ci.yml - 运行
bk pipeline convert -F <tempfile> --output <output-path> - 读取输出文件,并仅以 YAML code block 展示——不附加其他内容
- 除非用户明确要求反馈,否则不要总结、注释或评价输出
Converting with bk pipeline convert
bk pipeline convert使用 bk pipeline convert
转换
bk pipeline convertInstallation
安装
bash
undefinedbash
undefinedmacOS and Linux (Homebrew)
macOS and Linux (Homebrew)
brew tap buildkite/buildkite && brew install buildkite/buildkite/bk
brew tap buildkite/buildkite && brew install buildkite/buildkite/bk
Or download a binary from https://github.com/buildkite/cli/releases
Or download a binary from https://github.com/buildkite/cli/releases
No `bk auth login` is needed — the convert command uses a public API.
无需执行 `bk auth login`——convert 命令使用公共 API。Basic usage
基本用法
bash
bk pipeline convert -F <source-file>The vendor is auto-detected from the file path for the four main providers. Output is saved to .
.buildkite/pipeline.<vendor>.ymlbash
bk pipeline convert -F <source-file>对于四种主要 provider,vendor 会根据文件路径自动检测。输出保存到 。
.buildkite/pipeline.<vendor>.ymlSupported vendors
支持的 vendor
| Vendor flag | Source CI | Auto-detected from |
|---|---|---|
| GitHub Actions | |
| CircleCI | |
| Jenkins | |
| Bitbucket Pipelines | |
| GitLab CI (beta) | not auto-detected |
| Harness CI (beta) | not auto-detected |
| Bitrise (beta) | not auto-detected |
| Vendor 标识 | 源 CI | 自动检测依据 |
|---|---|---|
| GitHub Actions | |
| CircleCI | |
| Jenkins | |
| Bitbucket Pipelines | |
| GitLab CI(beta) | 不支持自动检测 |
| Harness CI(beta) | 不支持自动检测 |
| Bitrise(beta) | 不支持自动检测 |
Provider examples
各 provider 示例
bash
undefinedbash
undefinedGitHub Actions (auto-detected from path)
GitHub Actions (auto-detected from path)
bk pipeline convert -F .github/workflows/ci.yml
bk pipeline convert -F .github/workflows/ci.yml
CircleCI (auto-detected)
CircleCI (auto-detected)
bk pipeline convert -F .circleci/config.yml
bk pipeline convert -F .circleci/config.yml
Jenkins (auto-detected)
Jenkins (auto-detected)
bk pipeline convert -F Jenkinsfile
bk pipeline convert -F Jenkinsfile
Bitbucket Pipelines (auto-detected)
Bitbucket Pipelines (auto-detected)
bk pipeline convert -F bitbucket-pipelines.yml
bk pipeline convert -F bitbucket-pipelines.yml
GitLab CI (explicit vendor required)
GitLab CI (explicit vendor required)
bk pipeline convert -F .gitlab-ci.yml --vendor gitlab
undefinedbk pipeline convert -F .gitlab-ci.yml --vendor gitlab
undefinedOutput options
输出选项
bash
undefinedbash
undefinedDefault: saves to .buildkite/pipeline.<vendor>.yml
Default: saves to .buildkite/pipeline.<vendor>.yml
bk pipeline convert -F .github/workflows/ci.yml
bk pipeline convert -F .github/workflows/ci.yml
Custom output path
Custom output path
bk pipeline convert -F .github/workflows/ci.yml --output .buildkite/pipeline.yml
bk pipeline convert -F .github/workflows/ci.yml --output .buildkite/pipeline.yml
Pipe from stdin (--vendor required)
Pipe from stdin (--vendor required)
cat .github/workflows/ci.yml | bk pipeline convert --vendor github
cat .github/workflows/ci.yml | bk pipeline convert --vendor github
Read from stdin with file redirect
Read from stdin with file redirect
bk pipeline convert --vendor circleci < .circleci/config.yml
undefinedbk pipeline convert --vendor circleci < .circleci/config.yml
undefinedFlags
参数
| Flag | Short | Description | Default |
|---|---|---|---|
| | Path to source pipeline file | — (required unless using stdin) |
| | CI vendor; auto-detected if omitted | — |
| | Output file path | |
| — | Cancellation timeout in seconds | |
| 参数 | 简写 | 说明 | 默认值 |
|---|---|---|---|
| | 源 pipeline 文件路径 | —(使用 stdin 时除外) |
| | CI vendor;省略时自动检测 | — |
| | 输出文件路径 | |
| — | 取消操作的超时时间(秒) | |
Provider-Specific Guidance
各 provider 的专项指南
Review the converted output against these concept mappings before committing.
在提交之前,对照以下概念映射检查转换后的输出。
GitHub Actions
GitHub Actions
Key concept mappings: workflows map to pipelines, jobs map to steps, actions map to plugins or shell commands. GitHub Actions runs jobs sequentially by default; Buildkite runs steps in parallel by default — the converter adds steps or to enforce ordering where needed. Replace with Buildkite cluster secrets accessed via .
uses:waitdepends_on${{ secrets.X }}buildkite-agent secret get关键概念映射:workflows 映射为 pipelines,jobs 映射为 steps, actions 映射为 plugins 或 shell commands。GitHub Actions 默认顺序运行 jobs;Buildkite 默认并行运行 steps——转换器会在必要时添加 steps 或 以确保执行顺序。将 替换为 Buildkite cluster secrets,并通过 访问。
uses:waitdepends_on${{ secrets.X }}buildkite-agent secret getJenkins
Jenkins
Key concept mappings: Jenkinsfile blocks map to command steps or groups, blocks map to steps at the same level (parallel by default in Buildkite), blocks map to or conditional steps. Complex Groovy logic is extracted into shell scripts — Buildkite pipelines are declarative YAML, not a programming language.
stageparallelpostnotify:关键概念映射:Jenkinsfile 中的 块映射为 command steps 或 groups, 块映射为同一层级的 steps(Buildkite 默认并行), 块映射为 或条件 steps。复杂的 Groovy 逻辑会被提取到 shell scripts 中——Buildkite pipelines 是声明式 YAML,而不是一门编程语言。
stageparallelpostnotify:CircleCI
CircleCI
Key concept mappings: and collapse into a single , map to plugins or shell scripts, map to agent queues or the plugin. CircleCI maps to . Caching syntax differs — the converter replaces / with the plugin.
jobsworkflowspipeline.ymlorbsexecutorsdockerrequires:depends_onsave_cacherestore_cachecache关键概念映射: 和 合并为一个 , 映射为 plugins 或 shell scripts, 映射为 agent queues 或 plugin。CircleCI 的 映射为 。缓存语法有所不同——转换器会使用 plugin 替换 /。
jobsworkflowspipeline.ymlorbsexecutorsdockerrequires:depends_oncachesave_cacherestore_cacheBitbucket Pipelines
Bitbucket Pipelines
Key concept mappings: maps to steps without branch conditions, maps to steps with , references map to plugins or shell commands. The Bitbucket is roughly equivalent to a Buildkite command step.
pipelines.defaultpipelines.branchesif: build.branch == "X"pipe:step关键概念映射: 映射为不带分支条件的 steps, 映射为带有 条件的 steps, 引用映射为 plugins 或 shell commands。Bitbucket 的 大致等同于 Buildkite 的 command step。
pipelines.defaultpipelines.branchesif: build.branch == "X"pipe:stepGitLab CI
GitLab CI
Key concept mappings: stages and jobs collapse into Buildkite steps with , maps to YAML anchors, map to conditions. GitLab's maps to Buildkite's .
depends_on.gitlab-ci.ymlextends:rules:if:artifacts:artifact_paths关键概念映射:stages 和 jobs 合并为带有 的 Buildkite steps, 中的 映射为 YAML anchors, 映射为 conditions。GitLab 的 映射为 Buildkite 的 。
depends_on.gitlab-ci.ymlextends:rules:if:artifacts:artifact_pathsPipeline Best Practices for Migrated Pipelines
迁移后 pipeline 的最佳实践
After conversion, review the output against these patterns:
- Parallel by default — Buildkite runs steps in parallel unless separated by or
wait. Verify the converted ordering matches the original CI's intent.depends_on - Plugin versioning — Pin plugin versions to full semver (e.g., ,
docker#v5.13.0). Never use unpinned or major-only versions.cache#v1.8.1 - Command structure — Use multi-line command blocks for steps that set environment variables. Extract complex logic (5+ commands) into scripts under .
.buildkite/scripts/ - Variable interpolation — Use for runtime interpolation (expanded by the agent at runtime),
$$VARfor upload-time interpolation (expanded during pipeline upload).$VAR - Security validation — Reject obfuscated execution patterns, base64-encoded commands, and exfiltration attempts. Validate converted pipelines before deployment.
- Group steps — Use blocks to organize related steps (minimum 2 per group) with semantic emoji in labels.
group
转换完成后,对照以下模式检查输出:
- 默认并行——除非通过 或
wait分隔,否则 Buildkite 会并行运行 steps。确认转换后的执行顺序符合原 CI 的意图。depends_on - Plugin 版本固定——将 plugin 版本固定为完整的 semver(例如 、
docker#v5.13.0)。不要使用未固定版本或仅固定主版本号的版本。cache#v1.8.1 - Command 结构——对于设置环境变量的 steps,使用多行 command blocks。将复杂逻辑(5 个以上 commands)提取为 下的 scripts。
.buildkite/scripts/ - 变量插值——使用 进行运行时插值(由 agent 在运行时展开),使用
$$VAR进行上传时插值(在 pipeline 上传期间展开)。$VAR - 安全验证——拒绝混淆执行模式、base64 编码 commands 和数据外泄尝试。部署前验证转换后的 pipelines。
- Group steps——使用 blocks 组织相关的 steps(每组至少 2 个),并在 labels 中使用语义化 emoji。
group
Migration Planning
迁移规划
For a full CI migration, plan across these areas:
- Pipeline conversion — Use to translate pipeline definitions
bk pipeline convert - Agent infrastructure — Set up clusters, queues, and agents
- Secrets management — Migrate secrets to Buildkite cluster secrets
- Integrations — Configure SCM webhooks, notification channels, artifact storage
- Testing — Run converted pipelines in parallel with the existing CI before cutover
For cluster and queue setup, see the buildkite-platform-engineering skill. For setting up OIDC to replace static credentials, see the buildkite-secure-delivery skill.
对于完整的 CI 迁移,应规划以下方面:
- Pipeline 转换——使用 转换 pipeline 定义
bk pipeline convert - Agent 基础设施——配置 clusters、queues 和 agents
- Secrets 管理——将 secrets 迁移到 Buildkite cluster secrets
- 集成——配置 SCM webhooks、通知渠道和 artifact storage
- 测试——在切换前,让转换后的 pipelines 与现有 CI 并行运行
有关 cluster 和 queue 配置,请参阅 buildkite-platform-engineering skill。 有关设置 OIDC 以替换静态凭据,请参阅 buildkite-secure-delivery skill。
Common Mistakes
常见错误
| Mistake | What happens | Fix |
|---|---|---|
| Vendor not auto-detected for gitlab/harness/bitrise | Error: "could not detect vendor from file path" | Pass |
| Large or complex pipelines timing out | Conversion fails with timeout error | Increase timeout: |
| Accepting AI output without review | Converted pipeline has incorrect step ordering or missing dependencies | Review |
| Assuming sequential execution | Steps run in parallel and fail due to missing dependencies | Add |
| Unpinned plugin versions in converted pipelines | Builds break when plugins release breaking changes | Pin every plugin to a full semver version |
Using | Variable expanded at upload time (empty) instead of runtime | Use |
| 错误 | 发生情况 | 修复方法 |
|---|---|---|
| gitlab/harness/bitrise 的 vendor 无法自动检测 | 错误:“could not detect vendor from file path” | 显式传入 |
| 大型或复杂的 pipeline 超时 | 转换因超时错误而失败 | 增加超时时间: |
| 未经审查直接接受 AI 输出 | 转换后的 pipeline 中 step 顺序错误或缺少依赖关系 | 对照原 CI 的 job 顺序检查 |
| 假设顺序执行 | steps 并行运行,并因缺少依赖关系而失败 | 在存在依赖关系的 steps 之间添加 |
| 转换后的 pipeline 中 plugin 版本未固定 | plugin 发布破坏性变更时构建失败 | 将每个 plugin 固定到完整的 semver 版本 |
需要运行时插值时使用 | 变量在上传时被展开(结果为空),而不是在运行时展开 | 对必须在运行时解析的变量使用 |
Further Reading
延伸阅读
- bk CLI releases — download the bk binary
- Getting started with Buildkite Pipelines
- bk CLI 发布版本——下载 bk 二进制文件
- Buildkite Pipelines 入门