Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/scripts/no-hosted-runners.test.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// GitHub-hosted runners are forbidden. Every job in every workflow must run on
// the repository's self-hosted ARC scale set, and the retired hosted
// "emergency burst" switch (CI_BURST_HOSTED) must not return. Burst capacity is
// Hetzner ARC nodes only. Runs from the ARC CI workflow.
const assert = require("node:assert/strict");
const fs = require("node:fs");
const path = require("node:path");
const test = require("node:test");

const dir = path.resolve(__dirname, "../workflows");
const ARC = "t3code-ci-arc";
const files = fs.readdirSync(dir).filter((name) => /\.ya?ml$/.test(name));

function violations(name, text) {
const problems = [];
if (/ci_burst_hosted/i.test(text)) problems.push(`${name}: references CI_BURST_HOSTED`);
for (const match of text.matchAll(/^[ \t-]*runs-on:[ \t]*(.*?)[ \t]*(?:#.*)?$/gm)) {
if (match[1] !== ARC) problems.push(`${name}: runs-on must be exactly ${ARC}, got ${match[1] || "(multi-line)"}`);
}
return problems;
}

test("no workflow can run on a GitHub-hosted runner", () => {
assert.ok(files.length > 0);
const problems = files.flatMap((name) => violations(name, fs.readFileSync(path.join(dir, name), "utf8")));
assert.deepEqual(problems, []);
});

test("the check rejects hosted labels, expressions and the retired switch", () => {
for (const bad of [
" runs-on: ubuntu-latest\n",
" runs-on: ubuntu-24.04\n",
" runs-on: macos-14\n",
" runs-on: blacksmith-8vcpu-ubuntu-2404\n",
" runs-on: [self-hosted, linux]\n",
" runs-on: ${{ vars.CI_BURST_HOSTED == 'on' && 'ubuntu-latest' || 't3code-ci-arc' }}\n",
" runs-on: t3code-ci-arc\n # CI_BURST_HOSTED\n",
]) {
assert.ok(violations("fixture.yml", bad).length > 0, bad);
}
assert.deepEqual(violations("fixture.yml", " runs-on: t3code-ci-arc\n"), []);
});
24 changes: 11 additions & 13 deletions .github/workflows/closura-arc-ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: T3 fork ARC CI

# Self-hosted, repository-scoped ARC only. No paid Blacksmith, macOS/Windows
# runners, new controller or deployment side effects. The one hosted exception
# is the CLO-694 emergency burst: when a burst operator sets the repository variable
# CI_BURST_HOSTED to `on` (any case) during an ARC backlog, these jobs run on
# ubuntu-latest (free here, since this repository is public). Unset, it is ARC.
# The toggle and runbook live in closura-agent-config: scripts/ci_burst.py and
# docs/ci/emergency-burst.md.
# runners, new controller or deployment side effects. GitHub-hosted runners are
# forbidden outright, and burst capacity is
# Hetzner ARC nodes only (closura-agent-config scripts/arc_burst_nodes.py).
# .github/scripts/no-hosted-runners.test.cjs fails any workflow that says otherwise.
on:
push:
# Every merged head of the native release branch gets a check run on its
Expand Down Expand Up @@ -82,7 +80,7 @@ jobs:
)
}}
name: Voice + inbox core (Linux ARC)
runs-on: ${{ vars.CI_BURST_HOSTED == 'on' && 'ubuntu-latest' || 't3code-ci-arc' }}
runs-on: t3code-ci-arc
timeout-minutes: 45
env:
CI: "true"
Expand Down Expand Up @@ -276,7 +274,7 @@ jobs:
)
}}
name: Voice + inbox web (Linux ARC)
runs-on: ${{ vars.CI_BURST_HOSTED == 'on' && 'ubuntu-latest' || 't3code-ci-arc' }}
runs-on: t3code-ci-arc
timeout-minutes: 45
env:
CI: "true"
Expand Down Expand Up @@ -389,7 +387,7 @@ jobs:
)
}}
name: Voice + inbox mobile (Linux ARC)
runs-on: ${{ vars.CI_BURST_HOSTED == 'on' && 'ubuntu-latest' || 't3code-ci-arc' }}
runs-on: t3code-ci-arc
timeout-minutes: 45
env:
CI: "true"
Expand Down Expand Up @@ -578,13 +576,13 @@ jobs:
#
# On a draft pull request the workers are skipped and this job fails at its
# first step, so the required check stays red until the full run passes. It
# reads only the event payload there, so it uses a free hosted runner (this
# repository is public) and never wakes an ARC runner for a parked draft.
# reads only the event payload there. GitHub-hosted runners are forbidden,
# so even this draft hold runs on the ARC scale set.
voice-and-inbox:
name: Voice + founder inbox (Linux ARC)
needs: [voice-and-inbox-core, voice-and-inbox-web, voice-and-inbox-mobile]
if: ${{ !cancelled() }}
runs-on: ${{ ((github.event_name == 'pull_request' && github.event.pull_request.draft) || vars.CI_BURST_HOSTED == 'on') && 'ubuntu-latest' || 't3code-ci-arc' }}
runs-on: t3code-ci-arc
timeout-minutes: 5
steps:
- name: Hold drafts until ready for review
Expand Down Expand Up @@ -640,4 +638,4 @@ jobs:
# upstream-sync App shape, and that all three workers share one gate.
- name: Test the ARC trust gate
shell: bash
run: node --test .github/scripts/arc-ci-trust-gate.test.cjs
run: node --test .github/scripts/arc-ci-trust-gate.test.cjs .github/scripts/no-hosted-runners.test.cjs
15 changes: 11 additions & 4 deletions .github/workflows/closura-deploy-line.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ name: Closura deploy line
# what runs, so "merged" is never mistaken for "live". The value is opaque on
# purpose: "fleet" means the private deployment config decides where it runs,
# and no host names are published here. This job reads only the event payload:
# no checkout, no token and no repository code, so it runs on a hosted runner
# and needs no actor guard.
# no checkout, no token and no repository code. It runs on the repository ARC
# scale set, so it takes the same same-repo trusted-author gate as the CI workers.
on:
pull_request:
branches: [release/native-0.1.10]
Expand All @@ -19,9 +19,16 @@ concurrency:

jobs:
deploy-line:
if: ${{ github.repository_id == '1372173214' }}
if: >-
${{
github.repository_id == '1372173214' &&
github.event.pull_request.head.repo.full_name == github.repository &&
contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.event.pull_request.user.login) &&
contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.actor) &&
contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.triggering_actor)
}}
name: Deploy line declared
runs-on: ubuntu-latest
runs-on: t3code-ci-arc
timeout-minutes: 5
steps:
- name: "Require one Deploy line: none or fleet"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/upstream-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Upstream fork sync
# Fetches pingdotgg/t3code main once a day. A clean merge becomes a pull
# request against release/native-0.1.10. Conflicts are filed for Platform /
# CTO. This workflow never merges that pull request and never force-pushes.
# It runs on a hosted runner because it only fetches and merges git history;
# it does not execute upstream code. The fork's ARC workflow still has to
# It runs on the repository ARC scale set; it only fetches and merges git
# history and does not execute upstream code. The fork's ARC workflow still has to
# pass before anyone merges.
on:
schedule:
Expand All @@ -23,7 +23,7 @@ concurrency:
jobs:
sync:
if: ${{ github.repository_id == '1372173214' }}
runs-on: ubuntu-latest
runs-on: t3code-ci-arc
timeout-minutes: 30
steps:
- name: Checkout the release line
Expand Down
Loading