This document is the official, step-by-step action plan for gke-labs repository maintainers migrating devops-bench to its permanent upstream home in kubernetes-sigs.
[PHASE 1]
Restructure gke-labs in-place
(All code under devops_bench/)
|
v
+------------------+ [PHASE 2] +-------------------+
| gke-labs | -------------------------> | kubernetes-sigs |
| (devops-bench) | (A) Forward PR export | (devops-bench) |
| | (Using prep-export.sh) | |
| | | |
| Source of truth | <------------------------- | Source of truth |
| for remaining | (B) Back-sync bot | for migrated |
| modules | (copy.bara.sky + GHA) | modules |
+------------------+ +-------------------+
|
v
[PHASE 3]
All modules migrated; archive
and retire gke-labs
- Phase 1 (Restructure): Restructure the
gke-labsrepository in-place into the target layout before exporting any files upstream. - Phase 2 (Migrate Module-by-Module): Export files chunk-by-chunk. For each migrated module:
- Flow A (Export): Create an upstream PR. Once merged, uncomment its paths in
migrated.bara.sky(this "flips" the source of truth). - Flow B (Back-sync): A scheduled, automated Copybara bot syncs upstream edits back to
gke-labsso the remaining modules can import them and keep building.
- Flow A (Export): Create an upstream PR. Once merged, uncomment its paths in
- Phase 3 (Retire): Once 100% of required modules are migrated, archive and retire the
gke-labsrepository.
- For the stage-by-stage PR sequence, see pr-plan.md.
- For the temporary legacy↔refactor regression gate used during the cutover, see legacy-comparison.md.
Before executing any commands, ensure you have:
- Created a personal fork of
kubernetes-sigs/devops-benchon GitHub. - Signed the CNCF CLA (Contributor License Agreement).
- Authenticated your local GitHub CLI (
gh auth login). - Set your local git identity to match your CNCF CLA email (
git config --global user.email).
Restructure gke-labs before pushing any code upstream. No upstream PRs should be created until this stage is green.
- Set Up the Toolchain:
- Add
pyproject.toml(referencing Hatchling andruffconfigurations),uv.lock, and.python-versionto thegke-labsrepo. (.github/workflows/guardrails.ymland thehack/check-migrated-readonly.shguard it invokes are **pre-installed in the repository and act as a green no-op (see Section 6) and stay a green no-op until these manifests anddevops_bench/land.)
- Add
- Reorganize Code Paths:
- Move
pkg/into thedevops_bench/namespace. - Restructure submodules and write companion unit tests directly inside
tests/. - Reorganize Terraform files from
tf/toinfra/.
- Move
- Verify Locally:
- Run the local testing and linting suite:
uv sync --all-extras uv run ruff check . uv run pytest tests/ -v
- Run the local testing and linting suite:
- Merge and Verify CI:
- Merge the restructure PR into the
gke-labsmainbranch. Ensure the GitHub Actionsguardrails.ymlrun is green.
- Merge the restructure PR into the
Follow the wave plan in pr-plan.md §3.2 — it fixes which PR is next, its owner, and its exact paths.
Per-PR export is driven by the migration-prep skill (SKILL.md): it picks the next ready PR (reconciling the wave plan, the migrated.bara.sky frontier, and upstream merged/in-flight state), scopes a branch off upstream/main with prep-export.sh, carries along any dependency delta a later module needs, gates it green (uv sync + ruff + pytest), and opens the upstream PR. It prepares only — it never merges or flips the frontier.
One-time before your first export: complete the prerequisites and, in your fork clone, point origin at your fork and add the other two remotes:
git remote add gkelabs https://github.com/gke-labs/devops-bench.git
git remote add upstream https://github.com/kubernetes-sigs/devops-bench.gitThen invoke the skill per module and respond to upstream review until it merges.
Once the upstream PR merges, its ownership must be flipped in gke-labs. While you can do this manually, this step is automated by the periodic suggest-flips workflow, which uncomments the paths and submits a flip PR automatically.
Simply wait for the periodic suggest-flips GitHub Action to detect the upstream merge. It will automatically:
- Identify the newly merged paths.
- Uncomment them in
migrated.bara.sky. - Open a pull request in
gke-labsto lock the paths and activate the back-sync bot.
If you need to flip the frontier immediately without waiting for the scheduled workflow:
- Open
migrated.bara.skyat thegke-labsrepository root. - Uncomment the lines corresponding to the migrated paths (both implementation and unit tests):
MIGRATED = [ # ... "devops_bench/agents/cli/**", "tests/agents/**", # ... ]
- Verify the status locally:
Expected Outcome: The uncommented paths will move from "not started" to the "Migrated" list.
./hack/migration-status.sh
- Merge this change into the
gke-labsmainbranch via a standard pull request.
Important
Keep the flip PR self-contained: do not reference the forward/upstream PR (no owner/repo#NN or bare #NN) in its commit message or body. GitHub turns such references into a cross-repo backlink between gke-labs and kubernetes-sigs. Say "merge after the corresponding upstream change lands" instead. (The automated suggest-flips PR already avoids this.)
Note
Uncommenting a line activates the Read-Only Guard in gke-labs CI. From this moment, any PR in gke-labs that attempts to mutate those paths will be rejected by check-migrated-readonly.sh. Edits must now be made upstream.
With the frontier updated, the back-sync bot mirrors upstream changes back to gke-labs, ensuring remaining modules can import them and build successfully.
The back-sync runs as a dedicated, allowlisted bot account,
devops-bench-sync-bot (committer
devops-bench-sync-bot@google.com), not the built-in github-actions[bot]. This keeps the bot's
push/PR identity stable and allowlistable for the migration.
- Ensure the
devops-bench-sync-botGitHub account has write access togke-labs/devops-bench. - Create a (fine-grained) PAT for that account scoped to push branches and open PRs on the repo.
- In
gke-labssettings, add it as the repository secretSYNC_BOT_TOKEN(the namebacksync.ymlreads). A PAT acts as a normal user, so the "Allow GitHub Actions to create and approve pull requests" setting is not required.
The bot runs .github/workflows/backsync.yml daily via cron or on demand via workflow_dispatch,
authenticating with SYNC_BOT_TOKEN.
Two things bound what the bot writes into gke-labs:
- Paths — only the
MIGRATEDfrontier (minusNEVER_SYNC). While the frontier is empty the run is a NO_OP; upstream code outside the frontier is never mirrored back, so pre-existing upstream files don't land ingke-labs. - History — Copybara
ITERATIVEreplays upstream commits after the last synced revision. Seed the baseline on the first run so only new commits flow; otherwise it replays a path's full upstream history (including pre-migration commits):After the seed, later runs pick the baseline up automatically from the bot's own PRs../hack/backsync.sh --last-rev "$(git ls-remote https://github.com/kubernetes-sigs/devops-bench.git main | cut -f1)"
# Real run (push/PR as the bot): use the bot's PAT
export GITHUB_TOKEN="$SYNC_BOT_TOKEN"
./hack/backsync.sh
# Dry-run only: your own token is fine (nothing is pushed, no PR is opened)
export GITHUB_TOKEN="$(gh auth token)"
./hack/backsync.sh --dry-runThe git committer is stamped as devops-bench-sync-bot regardless of the token; authors stay
as the original upstream contributors (see the CLA note below).
Warning
CLA Enforcement on Back-Syncs: The back-sync bot runs Copybara in ITERATIVE mode with pass_thru author preservation. If an upstream commit is authored by a contributor who has not signed the gke-labs CLA, the back-sync PR in gke-labs will be blocked until they sign. Do not change this configuration; squashing commits into a bot-authored commit violates license tracking and bypasses the security gate.
When migrated.bara.sky includes 100% of paths:
- Verify that
kubernetes-sigs/devops-benchis fully functional and running tests successfully. - Disable the
.github/workflows/backsync.ymlandsuggest-flips.ymlpipelines ingke-labs. - Put a deprecation banner on the
gke-labsREADME.mdredirecting users to the upstream repo. - Archive the
gke-labs/devops-benchrepository.
The toolkit is installed at its active locations in gke-labs (only README.md, pr-plan.md, and legacy-comparison.md remain under docs/migration/). The back-sync workflows are inert until the bot is configured (§2.3): they carry a github.repository == 'gke-labs/devops-bench' guard and no-op on the empty frontier. To install upstream, copy each file from its gke-labs location.
| Location | Host | Purpose |
|---|---|---|
.github/workflows/guardrails.yml |
both | CI: uv sync, ruff, unit tests |
hack/check-migrated-readonly.sh |
gke-labs | flip guard invoked by guardrails.yml |
migrated.bara.sky (root) |
gke-labs | single source-of-truth frontier |
copy.bara.sky (root) |
gke-labs | back-sync (Copybara) configuration |
.github/workflows/backsync.yml |
gke-labs | back-sync pipeline (needs SYNC_BOT_TOKEN) |
.github/workflows/suggest-flips.yml |
gke-labs | opens flip PRs (needs SYNC_BOT_TOKEN) |
hack/prep-export.sh |
gke-labs | stage a scoped upstream export branch |
hack/backsync.sh |
gke-labs | run Copybara locally or in CI |
hack/migration-status.sh |
gke-labs | migration progress tracker |
- DO complete Phase 1 restructure entirely before sending the first forward PR.
- DO include unit tests in the same forward PR as the code files.
- DO develop migrated files exclusively in
kubernetes-sigsonce they have been flipped. - DON'T edit a migrated path directly inside the
gke-labsrepo. The back-sync bot will attempt overwrite/revert your edits. - DON'T let the back-sync bot sync manifests (
pyproject.toml,uv.lock,.python-version,LICENSE). These are marked asNEVER_SYNCand are managed manually per-repo to prevent version skew and dependency conflicts.