Add ARC self-hosted runners for IUCLabs (#579)

IUCLabs public repos need self-hosted CI capacity, but anyone can open PRs there, so runners must only execute trusted code and must not reach internal services.

- deploy the ARC controller chart in arc-system, pulled through artifactapi
- keep shared runner resources (namespace, manager Role/RoleBinding, VSO secret, hooks) in the iuclabs-runners base
- package each scale set as a kustomize component (AutoscalingRunnerSet + its HTTPS/Vault egress policy), starting with iuclabs-k8s
- allow only push/dispatch/schedule/merge_group/release and trusted pull_request jobs via a job-started hook, tested in pre-commit
- default-deny the namespace and allow DNS

Depends on the github-app secret existing in Vault.

Reviewed-on: #579
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
This commit was merged in pull request #579.
This commit is contained in:
2026-11-10 23:27:40 +11:00
committed by BenVincent
parent 19f7919851
commit fd3446ae8a
28 changed files with 495 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
not json {
@@ -0,0 +1,11 @@
{
"comment": {
"author_association": "NONE"
},
"issue": {
"number": 1
},
"repository": {
"full_name": "IUCLabs/app"
}
}
@@ -0,0 +1,11 @@
{
"pull_request": {
"author_association": "MEMBER",
"head": {
"repo": null
}
},
"repository": {
"full_name": "IUCLabs/app"
}
}
@@ -0,0 +1,14 @@
{
"pull_request": {
"author_association": "NONE",
"head": {
"repo": {
"fork": true,
"full_name": "evil/app"
}
}
},
"repository": {
"full_name": "IUCLabs/app"
}
}
@@ -0,0 +1,14 @@
{
"pull_request": {
"author_association": "NONE",
"head": {
"repo": {
"fork": false,
"full_name": "evil/app"
}
}
},
"repository": {
"full_name": "IUCLabs/app"
}
}
+14
View File
@@ -0,0 +1,14 @@
{
"pull_request": {
"author_association": "MEMBER",
"head": {
"repo": {
"fork": true,
"full_name": "someone/app"
}
}
},
"repository": {
"full_name": "IUCLabs/app"
}
}
@@ -0,0 +1,14 @@
{
"pull_request": {
"author_association": "CONTRIBUTOR",
"head": {
"repo": {
"fork": false,
"full_name": "IUCLabs/app"
}
}
},
"repository": {
"full_name": "IUCLabs/app"
}
}
+3
View File
@@ -0,0 +1,3 @@
{
"ref": "refs/heads/main"
}
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -euo pipefail
hook=apps/base/iuclabs-runners/job-started.sh
fixtures=ci/fixtures/runner-hooks
fail=0
check() {
local want=$1 event=$2 fixture=$3 got=0
local -a env=(-u GITHUB_EVENT_NAME -u GITHUB_EVENT_PATH)
[ "$event" = - ] || env+=("GITHUB_EVENT_NAME=$event")
[ "$fixture" = - ] || env+=("GITHUB_EVENT_PATH=$fixtures/$fixture")
env "${env[@]}" "$hook" >/dev/null 2>&1 || got=1
if [ "$got" -ne "$want" ]; then
echo "FAIL: $event $fixture exit=$got want=$want" >&2
fail=1
fi
}
for e in push workflow_dispatch schedule merge_group release; do
check 0 "$e" push.json
done
check 0 pull_request pr-member.json
check 0 pull_request pr-same-repo.json
check 1 pull_request pr-fork-none.json
check 1 pull_request pr-fork-spoofed.json
check 1 pull_request pr-deleted-fork.json
check 1 pull_request push.json
for e in pull_request_target workflow_run pull_request_review pull_request_review_comment issue_comment issues discussion discussion_comment create delete unknown_event; do
check 1 "$e" pr-member.json
done
check 1 pull_request_review pr-fork-none.json
check 1 issue_comment issue-comment.json
check 1 push -
check 1 push missing.json
check 1 push invalid.txt
check 1 - push.json
exit "$fail"