Skip to content

ci(mirror-sync): auto-mirror upstream-pr/** branches for fork regression#12

Merged
entlein merged 3 commits intomainfrom
ci/mirror-sync-proposal
Apr 24, 2026
Merged

ci(mirror-sync): auto-mirror upstream-pr/** branches for fork regression#12
entlein merged 3 commits intomainfrom
ci/mirror-sync-proposal

Conversation

@entlein
Copy link
Copy Markdown

@entlein entlein commented Apr 23, 2026

Summary

Proper review venue for a mirror-sync infrastructure I earlier committed directly to main (mistake — now reverted in this PR's first commit). Same intended content, routed through a branch + PR for sign-off.

Why

Upstream-bound PR branches (upstream-pr/**) stay pristine for reviewers like Matthias — we can't touch their .github/ without contaminating the upstream diff. But we still want to exercise each push end-to-end on this fork (build → node-agent build → component-tests) to catch regressions before they get near upstream.

How

Two files, both on this fork's main so they govern every mirror cycle:

  1. fork-ci/.github/workflows/build.yaml — extracted copy of the pre-refactor working build.yaml (pushes to ghcr.io, includes the trigger-node-agent cascade step). Push-trigger list extended with test-mirror/** so any mirror push fires it.
  2. .github/workflows/mirror-sync.yaml — triggers on push to upstream-pr/**. Overlays fork-ci/ onto the pushed tree and force-pushes to test-mirror/<same-name>. Refuses to operate on non-upstream-pr branches. Deliberately uses force-push because the mirror is a derived branch only written by this workflow.

Flow

```
user pushes to upstream-pr/analyzer-zero-alloc

├─ mirror-sync.yaml fires
│ overlays fork-ci/ → force-pushes test-mirror/upstream-pr/analyzer-zero-alloc

├─ test-mirror/... push triggers fork-ci build.yaml
│ builds ghcr.io/k8sstormcenter/storage:
│ trigger-node-agent job dispatches node-agent build with --ref test-mirror/...

└─ node-agent build.yaml → component-tests.yaml (internal dispatch)
```

Prerequisites

  • Repo secret `CROSS_REPO_PAT` must be set (same token the `trigger-node-agent` job in the old build.yaml already uses for cross-repo dispatch). Without it, mirror-sync fails loudly on first dispatch instead of silently misbehaving.

Follow-up

A parallel PR will add the same pattern to `k8sstormcenter/node-agent` — `fork-ci/` + `mirror-sync.yaml` on its main, so pushing `upstream-pr/foo` on node-agent also produces a mirror for the cascade to target. I'll open that only after this one is reviewed/merged.

Rollback

If this turns out to cause more confusion than value: `git revert` both commits. The `test-mirror/**` branches it creates are safe to delete at any time — they're derived branches.

History note

  • `a687dbde` (first commit in this PR) — reverts my original unilateral commit to main (`cf57b845`).
  • `89bd216a` (second commit) — the actual proposal, as it should have been.

Entlein and others added 3 commits April 23, 2026 12:23
PROPOSAL — please review before merge. Opening this PR as the proper
review venue after an earlier unilateral commit to main (cf57b84,
reverted in this PR's first commit). Same intended content, now
routed through a branch + PR for your sign-off.

Goal: let us e2e-test upstream-bound PR branches (upstream-pr/**) on
this fork without touching their .github/ — which must stay clean
for upstream reviewers. On every push to upstream-pr/**, a bot
branch test-mirror/<same-topic> is (re)created with the fork's
working CI files overlaid from fork-ci/. The mirror branch's
.github/workflows/build.yaml (copied from fork-ci/) has
test-mirror/** in its push-trigger list, so the normal e2e cascade
(build → trigger-node-agent → component-tests) fires automatically.

Two files added:

  1. fork-ci/.github/workflows/build.yaml — an extracted copy of the
     previous working build.yaml (pushes images to ghcr.io,
     auto-triggers node-agent build). Push trigger extended to
     include test-mirror/** so mirror pushes fire it.

  2. .github/workflows/mirror-sync.yaml — triggers on push to
     upstream-pr/**. Overlays fork-ci/ onto the pushed commit and
     force-pushes to test-mirror/<same-name>. Refuses to operate on
     non-upstream-pr branches.

Needs secret CROSS_REPO_PAT set in repo settings (same token already
used by the trigger-node-agent job in the old build.yaml). If the
secret is missing, mirror-sync will fail loudly on first dispatch
rather than silently pushing to the wrong thing.

Same pattern will be proposed on k8sstormcenter/node-agent in a
parallel PR once this one is reviewed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@entlein entlein merged commit 272b736 into main Apr 24, 2026
entlein added a commit to k8sstormcenter/node-agent that referenced this pull request Apr 24, 2026
Symmetric to k8sstormcenter/storage#12. Reacts to every push on
upstream-pr/** by force-updating test-mirror/<same-topic> with the
working tree overlaid from fork-ci/ on main. This lets our internal CI
exercise upstream-bound branches without polluting the upstream diff
with fork-only workflow files.

fork-ci/ is intentionally empty beyond a README today: node-agent's
existing build.yaml + component-tests.yaml already behave correctly on
any ref. The machinery is in place so that the moment a fork-only
workflow tweak is needed (e.g. a push trigger including test-mirror/**
or a different image registry), it has a home that will not leak into
the upstream PR diff.

Requires a CROSS_REPO_PAT secret with contents:write on the fork so the
workflow can force-push refs/heads/test-mirror/**.

Signed-off-by: Entlein <eineintlein@gmail.com>
Co-authored-by: Entlein <eineintlein@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant