Skip to content

Open staging promotion PRs automatically from dev's pins - #117

Merged
Peeja merged 3 commits into
mainfrom
claude/happy-bell-cfh5qb-promote-staging-bot
Sep 30, 2026
Merged

Peeja merged 3 commits into
mainfrom
claude/happy-bell-cfh5qb-promote-staging-bot

Conversation

@Peeja

@Peeja Peeja commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Written by Claude.

Closes FIL-1381

Problem

Dev gets a bump PR for every image a service publishes, and the bot merges it itself. Promoting to staging means editing nodes/staging/eu-central-3/apps/versions.env by hand, and working out from each pin's source commit what the promotion brings. #86, #107 and #116 were all written that way.

Change

  • .github/workflows/promote-staging.yml runs scripts/ci/promote-staging.sh on every push to main, and on workflow_dispatch. It uses the fil-forge-bot token, as the bump workflows do, so the PR's checks run.
  • scripts/ci/promote-staging.sh keeps one PR, "Promote dev's images to staging", on bot/promote-staging:
    • Staging behind dev: it rebuilds the branch as main plus staging's pins set to dev's, then opens or refreshes the PR. If the branch is already exactly that, it doesn't push, so the checks don't rerun.
    • The body lists, for each service that moves, the commits between staging's pin and dev's. Each digest's source commit comes from the dev bump that first carried it (its - Commit: line), and the compare API supplies the list in between. (#123) in titles is rewritten to (fil-forge/piri#123), so it doesn't link to this repository's PRs. If a source commit is unknown, or the API won't give a list, the body says so rather than failing.
    • Staging matches dev: it closes the PR and deletes the branch.
    • Auto-merge: it never turns auto-merge on. It turns off any a person turned on for an earlier head, since a new head is a new set of images.
    • Hand pushes: a branch someone pushed to by hand, to hold a service back say, is left alone while its PR is open.
    • --dry-run builds the branch locally and prints the message, without pushing, opening or closing anything.
  • scripts/ci/set-node-pin.sh takes --node, defaulting to dev, so the promotion writes pins through the same script as the bumps. The node name must match ^[a-z0-9-]+(/[a-z0-9-]+)?$, and nodes/<node>/apps/versions.env must exist.
  • docs/RUNBOOK.md: the deploy entry now says how to promote, how to hold a service back, and what --node does.

Nothing about dev's bumps changes. refresh-bump-prs.sh only matches bot/bump-*-image-dev, so it never touches bot/promote-staging.

Testing

  • set-node-pin.sh: it pins staging with --node staging/eu-central-3, and dev by default. It rejects --node ../x, a node with no versions.env, and a missing argument. --help prints the whole header.

  • promote-staging.sh: I ran it against a local bare repository standing in for origin, with gh api stubbed by unauthenticated curl and gh pr faked and logged.

    Situation Result
    Staging behind dev, nothing open pushes the branch, opens the PR
    Rerun, nothing changed no push; the body is refreshed
    main moved, auto-merge on rebuilt on the new main, auto-merge turned off
    A person pushed to the branch, PR open left alone
    The same, after the PR merged rebuilt and reopened
    Staging matches dev, PR open branch deleted, PR commented on and closed
    Staging matches dev, nothing open nothing
    Real main (1867d62, after Promote Piri and Ingot to staging #116) "staging already pins what dev pins"
  • Not run here: shellcheck and actionlint, which aren't installed; CI's shell check runs shellcheck. The workflow parses as YAML. make check-compose passes.

Notes

🤖 Generated with Claude Code

https://claude.ai/code/session_01JCF8gyb8jNRmHmWqQmVhRJ

✴️

promote-staging.yml runs scripts/ci/promote-staging.sh on every push to
main. It keeps one pull request, "Promote dev's images to staging", that
sets each staging pin to what dev pins and lists what each service
brings over staging's current pin, read from the source commit of the
dev bump that first carried each digest. Once staging matches dev it
closes the pull request.

It never enables auto-merge, and disables one enabled for an earlier
head: merging is the promotion, and a new head is a new set of images.
A branch a person pushed to, to hold a service back, is left alone while
its pull request is open.

set-node-pin.sh takes --node, defaulting to dev, so the promotion writes
pins through the same script as the bumps. The runbook's deploy entry
says how to promote and how to hold a service back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JCF8gyb8jNRmHmWqQmVhRJ
@Peeja
Peeja requested review from alanshaw and bajtos and a balanced review from Copilot September 29, 2026 21:07
@Peeja
Peeja enabled auto-merge (squash) September 30, 2026 21:18
@Peeja

Peeja commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

I'm merging this and keeping an eye on the result. We should see a staging deploy PR appear and then be kept up to date.

@Peeja
Peeja merged commit 8019955 into main Sep 30, 2026
4 checks passed
@Peeja
Peeja deleted the claude/happy-bell-cfh5qb-promote-staging-bot branch September 30, 2026 21:19
@bajtos

bajtos commented Oct 1, 2026

Copy link
Copy Markdown
Member

Love it!

The list of changes looks a bit weird when formatted on GitHub - the PR title is shown twice, the commit hash is not a link.

See here: #129

Screenshot 2026-10-01 at 12 51 39

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.

3 participants