Repository navigation
docs(ci): add ADRs 0002 to 0004, a CI glossary, and the plan to swap Blacksmith for RunsOn #1416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
b686df9
docs(ci): record the decisions that bring CI spending under budget
auxesis 3cd11cb
docs(ci): record the arm64 exception and fork approval in ADR 0002
auxesis 1b0be48
docs(ci): record the merge queue test and the Docker Hub login
auxesis 747c6d7
docs(ci): record the same-size swap from Blacksmith to RunsOn
auxesis 2604b2a
docs(ci): correct ADR 0002's address and arm64 reasons
auxesis e96f37d
docs(ci): say that light and heavy no longer decide where a job runs
auxesis 4984831
docs(ci): mark the plan's finished task and both toomanyrequests causes
auxesis c07a3df
docs(ci): cite the source of the Docker Hub pull limit
auxesis e62c904
docs(ci): link ADR 0004 to the decision it supersedes
auxesis f257341
docs(ci): name the rebased commit that finished Task 6
auxesis 441690c
docs(ci): record why the swap keeps the free Docker Hub account
auxesis 2c0010d
docs(ci): say a push check runs only when its trigger paths change
auxesis 3877e5f
docs(ci): say that no part of ADR 0003 is built yet
auxesis f83ad4c
docs(ci): say a later run can replace a failed early run's result
auxesis ad01a97
docs(ci): say the same-size swap can add steps
auxesis 109f6e9
docs(ci): push the merge commit when Task 1 resolved a conflict
auxesis f19bc92
docs(ci): say the apt lock option does not cover apt-get update
auxesis dfe1139
docs(ci): say that neither main nor next has a merge queue yet
auxesis 1877ca1
docs(ci): say how #1419 retries apt-get update
auxesis 74f9c34
docs(ci): name the plan's cited commits by subject, not hash
auxesis 0af29e9
docs(ci): mark the plan's finished tasks and fix two wrong claims
auxesis bc4c037
docs(ci): compare job names with the commit where the branch left main
auxesis 0c13214
docs(ci): name Task 6's commit by subject, not hash
auxesis 5c0f90d
docs(ci): put each paragraph of the ADRs and glossary on one line
auxesis f2cef68
docs(ci): rewrite the ADRs, glossary and plan in plain language
auxesis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| # CI | ||
|
|
||
| This context covers the checks that verify a change, and the machines that run those checks. | ||
| The context covers the GitHub Actions workflows of `cipherstash/stack`. | ||
| The context also covers the CI spending of the other repositories that share the CI budget with `cipherstash/stack`. | ||
|
|
||
| ## Language | ||
|
|
||
| **CI budget**: | ||
| The most money that the repositories sharing the budget may spend on CI in one calendar month. | ||
| Vendor invoices are the measure of spending against the budget, including fixed costs such as licences and cloud infrastructure. | ||
| When an invoice also covers repositories that do not share the budget, only the part for the repositories that share it counts. | ||
| Estimates at list price track the spending between invoices, but do not replace the invoices. | ||
| _Avoid_: build minutes, runner minutes | ||
|
|
||
| **PR push**: | ||
| A new head commit on the branch of a pull request. | ||
| Each PR push starts the push checks again. | ||
| _Avoid_: PR run, CI run | ||
|
|
||
| **Push check**: | ||
| A check that runs on each PR push, if the change includes a file in the check's trigger paths. | ||
| The author of the pull request then learns of a failure while still working on the change. | ||
| _Avoid_: fast check, PR check | ||
|
|
||
| **Gate check**: | ||
| A check that runs when a pull request is in a merge queue, instead of on every PR push. | ||
| A failed gate check blocks the merge. | ||
| Architecture decision record (ADR) 0003 plans a merge queue for `main` and one for `next`, but neither exists yet. | ||
| Under ADR 0003, an author can ask for a gate check to run earlier, on the pull request. | ||
| _Avoid_: heavy check, full CI, merge check | ||
|
|
||
| **Early run**: | ||
| A run of the gate checks on a pull request before the pull request joins a merge queue. | ||
| An author asks for an early run by adding the `ci:full` label. | ||
| Each time someone adds the label, the pull request gets one early run. | ||
| No workflow reads the label yet, because work on ADR 0003 is paused. | ||
| _Avoid_: full run, ci:full run | ||
|
|
||
| **Queue commit**: | ||
| The commit that GitHub builds for a pull request in a merge queue. | ||
| A queue commit contains the queue entry ahead of the pull request, plus the pull request. | ||
| Checks in the merge queue test the queue commit. | ||
| _Avoid_: merge group commit, temporary branch | ||
|
|
||
| **Trigger paths**: | ||
| The paths that make a check run when a change includes a file in one of them. | ||
| Trigger paths apply on PR pushes and in the merge queue. | ||
| Every check has trigger paths, or a written reason for running on every change. | ||
| _Avoid_: path filter, relevance filter, affected checks | ||
|
|
||
| **Selector job**: | ||
| The first job of a workflow. | ||
| The selector job selects the checks that run, by comparing the files in a change with the trigger paths of each check. | ||
| When the selector job cannot decide, it fails. | ||
| The change then cannot merge until someone runs the selector job again. | ||
| _Avoid_: path-filter job, decider, router | ||
|
|
||
| **Summary job**: | ||
| The last job of a workflow. | ||
| The summary job passes when every check that the selector job selected has passed. | ||
| The summary job is the only job in the workflow that branch rules require. | ||
| _Avoid_: required job, status job | ||
|
|
||
| **Failsafe**: | ||
| The test that fails when the selector job does not decide whether a job runs. | ||
| The failsafe passes a job that has a written exemption. | ||
| The failsafe reads workflow files, rather than acting while a workflow runs. | ||
| _Avoid_: lint, selector guard, path-filter lint | ||
|
|
||
| **Light job**: | ||
| A job that runs acceptably on a GitHub-hosted standard runner. | ||
| ADR 0002 planned to run light jobs on GitHub-hosted standard runners. | ||
| Because ADR 0004 superseded that plan, being light no longer decides where a job runs. | ||
| Being light does not decide when a job runs: a light job can be a gate check. | ||
| _Avoid_: small job, cheap job | ||
|
|
||
| **Heavy job**: | ||
| A job that needs a larger machine than a GitHub-hosted standard runner. | ||
| ADR 0002 planned to run heavy jobs on a self-provisioned cloud runner instead. | ||
| Because ADR 0004 superseded that plan, being heavy no longer decides where a job runs. | ||
| Being heavy does not decide when a job runs: a heavy job can be a push check. | ||
| _Avoid_: big job, 16-core job | ||
|
|
||
| **Same-size swap**: | ||
| The change that moves each Blacksmith job to a RunsOn machine with the same vCPU count, architecture, and Ubuntu version. | ||
| Memory and disk may be smaller than on Blacksmith. | ||
| The triggers of each job stay the same. | ||
| The swap can add steps, such as a Docker Hub login before an image pull. | ||
| _Avoid_: like-for-like replacement, migration | ||
|
|
||
| ## Relationships | ||
|
|
||
| - Two separate choices apply to each check. | ||
| The trigger paths of a check decide whether the check runs at all. | ||
| Being a push check or a gate check decides when the check runs. | ||
| - Being a light job or a heavy job is a third, separate property. | ||
| Under ADR 0002, that property decided where a check runs. | ||
| ADR 0004 superseded the plan in ADR 0002. | ||
| - For example, the fuzz regression replay is a light job and a gate check. | ||
| - Mutation testing is expensive but important. | ||
| So mutation testing only runs after the design and implementation of a change are settled. | ||
| Failures in mutation testing must be fixed before the change merges. | ||
| Those facts make mutation testing a heavy job and a gate check. | ||
| - A same-size swap does not use the distinction between light and heavy jobs. | ||
| A Blacksmith job moves to RunsOn even if a GitHub-hosted standard runner could run it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| --- | ||
| status: superseded by ADR-0004 | ||
| --- | ||
|
|
||
| # Move CI from Blacksmith to GitHub-hosted runners and RunsOn | ||
|
|
||
| > This architecture decision record (ADR) is no longer in force. | ||
| > [ADR 0004](0004-same-size-swap-from-blacksmith-to-runs-on.md) supersedes it. | ||
|
|
||
| We decided in October 2026 to stop running CI on Blacksmith. | ||
| Light jobs run on GitHub-hosted standard runners. | ||
| Those runners cost nothing for this public repository. | ||
|
|
||
| Heavy jobs run on RunsOn. | ||
| RunsOn starts a machine in our own AWS account for each job. | ||
| Heavy jobs use c8a machines with 8 vCPUs. | ||
| Mutants, the mutation testing workflow, uses a c8a machine with 16 vCPUs. | ||
| The other repositories that share the CI budget move their Blacksmith jobs to RunsOn too. | ||
|
|
||
| Heavy jobs stay on x64 machines. | ||
| In the trial, arm64 machines were slower than x64 machines, and not cheaper. | ||
| Jobs that must run on arm64, such as native arm64 container image builds, are the exception. | ||
| Those jobs run on RunsOn's arm64 machines. | ||
|
|
||
| We made the change because of cost. | ||
| CI for this repository cost about $3,865 a month on Blacksmith at October 2026's pace. | ||
| That was 20 times September's cost. | ||
| The CI budget for this repository and the others that share it is $1,000 a month. | ||
|
|
||
| `.github/CONTEXT.md` defines the terms used here. | ||
|
|
||
| ```mermaid | ||
| flowchart LR | ||
| job[A CI job] --> size{Does a GitHub-hosted standard runner give it enough machine?} | ||
| size -- "Yes: light job" --> gh[GitHub-hosted runner. Free for this public repository. At most 60 jobs at a time for the organisation.] | ||
| size -- "No: heavy job" --> ro[RunsOn machine in our AWS account. c8a with 8 vCPUs. Mutants uses 16 vCPUs.] | ||
| ``` | ||
|
|
||
| ## Considered options | ||
|
|
||
| We rejected each of these options: | ||
|
|
||
| - **Stay on Blacksmith and run fewer jobs.** | ||
| We modelled October's jobs with gate checks in place. | ||
| At Blacksmith's prices, this repository alone still came to about $2,000 a month. | ||
| - **Run every job on RunsOn.** | ||
| Light jobs would then cost money. | ||
| GitHub-hosted runners run them for nothing. | ||
| - **Run every job on GitHub-hosted runners.** | ||
| In the runner trial in pull request #1297, jobs took 2.46 times as long overall. | ||
| The integration suites took up to 4.8 times as long. | ||
| - **Build arm64 images on x64 machines.** | ||
| Cross-compiling Rust for another architecture is slow. | ||
| - **Run arm64 jobs on GitHub-hosted arm64 runners.** | ||
| Those runners cost money for private repositories. | ||
| So the cost applies to the private repositories that share the CI budget. | ||
| This public repository already builds `linux-arm64-gnu` on a GitHub-hosted arm64 runner for nothing, in `_build-auth-artifacts.yml`. | ||
| - **Pull Docker Hub images through a cache in RunsOn's AWS setup.** | ||
| RunsOn documents that cache only for its Terraform or OpenTofu installation. | ||
| - **Pull Docker's official images from Amazon Elastic Container Registry (ECR) Public.** | ||
| Every image name in every repository would change. | ||
| Images that are not official would need another source. | ||
|
|
||
| ## Consequences | ||
|
|
||
| - GitHub runs at most 60 jobs at a time for the organisation on the Team plan. | ||
| When more than 60 jobs are queued, light jobs wait for a runner. | ||
| - We simulated October's light jobs against that limit, with gate checks in place. | ||
| One job in a hundred waited between 7 and 11 minutes. | ||
| - A RunsOn job starts 40 to 50 seconds later than a Blacksmith job did. | ||
| - RunsOn uses discounted spot machines. | ||
| When AWS has no spare c8a machines, a job runs at the full price. | ||
| The full price is more than twice the spot price. | ||
| The `family=c8a+m8a` label lets RunsOn try a second machine type before the job runs at the full price. | ||
| - Every job sets `timeout-minutes`. | ||
| In the trial, one job without a limit ran for more than 2 hours. | ||
| - We maintain the RunsOn resources in AWS. | ||
| Those resources cost $40 to $60 a month. | ||
| - Each RunsOn machine has its own public address. | ||
| Docker Hub limits anonymous pulls per address. | ||
| In October 2026, Docker Hub still refused anonymous pulls from RunsOn machines. | ||
| So a job logs in to Docker Hub before it pulls an image. | ||
| Runs for pull requests from forks get no secrets, so they still pull without a login. | ||
| - A pull request from a fork would run its code on a machine in our AWS account. | ||
| So this repository requires approval before any outside contributor's workflows run, not only a first-time contributor's. | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.