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/artifacts_test.go +31
| @@ -15,6 +15,7 @@ import ( | |||
| 15 | 15 | ||
| 16 | 16 | "rodent.software/vole/ci/runs" | |
| 17 | 17 | "rodent.software/vole/forge" | |
| 18 | "rodent.software/vole/forge/access" | ||
| 18 | 19 | "rodent.software/vole/forge/config" | |
| 19 | 20 | ) | |
| 20 | 21 | ||
| @@ -248,3 +249,33 @@ func TestRunArtifactsArePrivateForPrivateRepos(t *testing.T) { | |||
| 248 | 249 | } | |
| 249 | 250 | } | |
| 250 | 251 | } | |
| 252 | |||
| 253 | // Artifact uploads use the same runner role as the site and the checks. A bot | ||
| 254 | // with read access cannot upload; the role is what authorizes the object-store | ||
| 255 | // write. | ||
| 256 | func TestWorkflowArtifactsArePublishedByTheRunnerRole(t *testing.T) { | ||
| 257 | t.Parallel() | ||
| 258 | f := newFixtureWith(t, func(c *config.Config) { c.LeaseSeconds = 5 }) | ||
| 259 | f.publish(f.repo) | ||
| 260 | key := f.addBot(t, "ci-runner", access.Runner) | ||
| 261 | |||
| 262 | work := workRepo(t, artifactWorkflow()) | ||
| 263 | if _, errs, err := f.git(work, "push", f.sshURL(f.repo), "main:refs/heads/main"); err != nil { | ||
| 264 | t.Fatalf("push: %s", errs) | ||
| 265 | } | ||
| 266 | f.waitForRun(t, 5*time.Second, func(r *runs.Run) bool { return r.Status == runs.StatusQueued }) | ||
| 267 | f.runOnceAs(t, key) | ||
| 268 | done := f.waitForRun(t, 10*time.Second, func(r *runs.Run) bool { | ||
| 269 | return r.Status != runs.StatusQueued && r.Status != runs.StatusRunning | ||
| 270 | }) | ||
| 271 | if done.Status != runs.StatusSuccess { | ||
| 272 | t.Fatalf("run status = %s (exit %d)", done.Status, done.ExitCode) | ||
| 273 | } | ||
| 274 | arts, err := f.srv.Runs.Artifacts(done.ID) | ||
| 275 | if err != nil { | ||
| 276 | t.Fatal(err) | ||
| 277 | } | ||
| 278 | if len(arts) != 2 { | ||
| 279 | t.Fatalf("published %+v, want the two files from dist/", arts) | ||
| 280 | } | ||
| 281 | } | ||