Skip to content

feat(publish): push to staging/<ns>/<name> and sync the served name - #15

Closed
eddie-knight wants to merge 1 commit into
mainfrom
staging-cutover
Closed

eddie-knight wants to merge 1 commit into
mainfrom
staging-cutover

Conversation

@eddie-knight

Copy link
Copy Markdown
Contributor

What changed

grcli publish now pushes every bundle and its signature to the staging repository staging/<namespace>/<name> and then calls POST /v1/bundles/sync for <namespace>/<name>. The hub checks the staged bundle and copies an accepted one into the served repository; nothing pushes a served repository directly, and there is no fallback. The staging repository name comes from the staging package of grc-store-protocol v0.28.1, which this PR pins.

Supporting changes:

  • The hub client timeout rises from 60 seconds to 3 minutes, above the hub's 120-second catalog sync deadline, so a slow sync ends with the hub's answer rather than a client timeout.
  • A registry 401/403 on the staging push names the staging repository and the namespace you need to own (or be the trusted CI publisher for).
  • A refused sync shows the hub's error code and says whether to run grcli publish again. A fetch_failed means the staged upload never finished or was removed (staging is cleared after about 24 hours), so the fix is to publish again.
  • --repository staging/... is refused: the flag names the served repository.
  • README, CHANGELOG, and the publish-gemara.yml workflow header describe the new flow.

Why

The hub stopped granting push on served repositories. Every upload lands in staging and only the hub's sync moves bytes into <namespace>/<name>, so a bundle is served only after the hub has checked it. grcli has to follow that or it cannot publish at all.

How to test

make ci-local
go test ./cmd ./internal/hub -run 'Publish|Push|Sync|Timeout' -v

End to end, against a hub that accepts staging pushes:

grcli login --url https://hub.preview.grc.store
grcli publish --url https://hub.preview.grc.store <catalog.yaml>

Expected: the push log shows staging/<namespace>/<name>, the sync succeeds, and grcli versions <namespace>/<name> lists the new version. With a namespace you do not own, the push fails with a 401 that names the staging repository and the namespace.

Breaking change

A grcli release from before this change pushes the served repository directly. A hub that only accepts staging pushes answers its first blob push with 401 UNAUTHORIZED, so older grcli releases cannot publish to it; upgrade grcli (in CI, set grcli-version to a release that includes this change). Conversely, this release cannot publish to a hub from before the cutover.

Pins grc-store-protocol v0.28.1 and uses its staging package to name the
upload repository. Catalog and EvaluationLog publishes push the bundle and
its signature to staging/<namespace>/<name> and then sync <namespace>/<name>;
the hub copies an accepted bundle into the served repository, and nothing
pushes a served repository directly. There is no fallback.

The hub client timeout rises from 60 seconds to 3 minutes, above the hub's
120-second catalog sync deadline, so a slow sync ends with the hub's answer
rather than a client timeout. A registry 401/403 on the staging push names
the staging repository and the namespace to own; a refused sync shows the
hub's error code and says whether to publish again.

Breaking: a grcli from before this change gets 401 UNAUTHORIZED at its first
blob push against a hub that only accepts staging pushes, and this release
cannot publish to a hub from before the cutover.

Signed-off-by: Julian Vance <julianvance242@gmail.com>
@eddie-knight
eddie-knight requested a review from a team as a code owner November 9, 2026 16:02
@eddie-knight
eddie-knight deleted the staging-cutover branch November 9, 2026 16:02
@eddie-knight
eddie-knight restored the staging-cutover branch November 9, 2026 16:03
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.

2 participants