vole
Site
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software/vole.git
Self-hosted forge that lives in your Git repo.
Replace the runner allowlist with a runner role
648cd81bde97042f682a528ebb9ce6353b95bf3f · Keenan Nemetz · 1d ago · parent ea92d754
server/ci_pages_test.go +34
| @@ -14,6 +14,7 @@ import ( | |||
| 14 | 14 | "time" | |
| 15 | 15 | ||
| 16 | 16 | "rodent.software/vole/ci/runs" | |
| 17 | "rodent.software/vole/forge/access" | ||
| 17 | 18 | "rodent.software/vole/forge/config" | |
| 18 | 19 | ) | |
| 19 | 20 | ||
| @@ -209,3 +210,36 @@ func TestWorkflowRefusesAStaleSiteDeploy(t *testing.T) { | |||
| 209 | 210 | time.Sleep(25 * time.Millisecond) | |
| 210 | 211 | } | |
| 211 | 212 | } | |
| 213 | |||
| 214 | // A runner publishes the site with the documented role, not by being a | ||
| 215 | // maintainer. This is the end-to-end form of #282: the bot may clone, lease, and | ||
| 216 | // publish the site, and nothing else. | ||
| 217 | func TestWorkflowDeploysTheSiteAsTheRunnerRole(t *testing.T) { | ||
| 218 | t.Parallel() | ||
| 219 | f := pagesCIFixture(t) | ||
| 220 | f.publish(f.repo) | ||
| 221 | key := f.addBot(t, "ci-runner", access.Runner) | ||
| 222 | |||
| 223 | work := workRepo(t, siteWorkflow("<h1>built by the runner role</h1>")) | ||
| 224 | if _, errs, err := f.git(work, "push", f.sshURL(f.repo), "main:refs/heads/main"); err != nil { | ||
| 225 | t.Fatalf("push: %s", errs) | ||
| 226 | } | ||
| 227 | f.waitForRun(t, 5*time.Second, func(r *runs.Run) bool { return r.Status == runs.StatusQueued }) | ||
| 228 | f.runOnceAs(t, key) | ||
| 229 | done := f.terminalRun(t) | ||
| 230 | if done.Status != runs.StatusSuccess { | ||
| 231 | t.Fatalf("run status = %s (exit %d), want success", done.Status, done.ExitCode) | ||
| 232 | } | ||
| 233 | |||
| 234 | deadline := time.Now().Add(5 * time.Second) | ||
| 235 | for { | ||
| 236 | code, body, _ := f.siteGet(f.repo+"."+pagesDomain, "/") | ||
| 237 | if code == 200 && strings.Contains(body, "built by the runner role") { | ||
| 238 | break | ||
| 239 | } | ||
| 240 | if time.Now().After(deadline) { | ||
| 241 | t.Fatalf("site after the deploy = %d %q", code, body) | ||
| 242 | } | ||
| 243 | time.Sleep(25 * time.Millisecond) | ||
| 244 | } | ||
| 245 | } | ||