Skip to content

Latest commit

 

History

History
55 lines (46 loc) · 4.9 KB

github-automation.md

File metadata and controls

55 lines (46 loc) · 4.9 KB

GitHub automation

What GitHub Actions does for this repository and how a merge reaches production. The workflows are in .github/workflows/; the rollout itself (chart, values, rollback) is in production rollout. Public repository: every job here runs on GitHub-hosted runners only.

From merge to production

Step Where What
1 images.yml, publish and merge Builds the backend and frontend images per architecture and joins them into one multi-arch index tagged with the first seven characters of the commit.
2 images.yml, chart (main only) Packages charts/mainloop as oci://ghcr.io/oldsj/charts/mainloop version 0.1.<run number>, app version the commit, with both image digests in its values. About ten minutes after the merge.
3 oldsj/infrastructure, mainloop-chart.yaml Finds the new chart, opens the bump pull request, runs its render check and merges it. Minutes.
4 Argo CD Syncs the new pin; the backend's init container applies migrations, then the pods roll.

This repository writes nothing to the deployment repository: step 3 only starts a workflow there, which does its own checks with its own token. A merge needs no further action for production to follow.

Production pin

Prod pins the exact chart in oldsj/infrastructure, k8s/apps/argocd/base/applications.yaml (the targetRevision under chart: mainloop). A workflow in that repository, not this one, moves it:

  • Why the work is in that repository. images.yml can hold a token that does nothing but start a workflow there (fine-grained, repository oldsj/infrastructure, permission Actions read and write, secret INFRA_DISPATCH_TOKEN), so a leaked token cannot change the pin or merge anything; the deployment repository's own workflow token does the writing. A token with contents and pull-request write would be a much bigger grant for the same result.
  • Triggers. The dispatch from step 3 is the fast path. The workflow also runs on a 5-minute schedule and when its render check ends, but GitHub starts both late on that private repository (on 2026-11-30 a */5 cron had no run in 10 hours), so treat them as backstops. Without the secret, Renovate's four-hour run is what moved the pin.
  • What it does. Each run compares the newest 0.1.N in the registry with the pin on main. For a newer one it pushes mainloop-chart-0.1.N (a new branch; nothing is force-pushed), opens "mainloop: chart 0.1.N (main <sha>, #A–#B)" with the Mainloop pull requests, migrations and chart files in the range, starts the render check on it, waits for it (up to 20 minutes) and squash-merges when it passes and the change is that one line. Older bump pull requests close as superseded. A failed render is rerun once, then left open for a person.
  • Why the script is the gate. The infrastructure repository is private on the Free plan: no branch protection or rulesets, so GitHub's auto-merge would merge at once with nothing required. The render job (it renders every Argo root, prod's with the new chart and the deployment's values) is checked by the script instead.
  • Renovate. Its rule for the chart stays as a fallback and may move the pin first; the reconciler then closes a bump pull request that is older than the pin and reopens one that now conflicts.
  • Stop it. Set the repository variable MAINLOOP_AUTOBUMP=false in oldsj/infrastructure. To roll back, set it first, then pin the older chart by hand: the next run would otherwise move the pin forward.
  • When it is not enough. A chart change that needs values or objects in the deployment repository (a new required value, a new Secret) renders into a failed check there; the bump pull request stays open until a person adds them. Land the deployment change first, or in the same pull request.

Other workflows

The remaining files in .github/workflows/ run checks on pull requests and pushes (ci.yml, go.yml, web.yml, contract.yml, ios.yml), build images for the shared dev instance and workspaces, run the nightly Go suite and publish iOS builds. Each file's header gives its trigger and purpose.