Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

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.

Publish release and run artifacts as file trees

5f2a0b0a7f84ec1bb43af5213e5c788039b72222 · Keenan Nemetz · 20d ago · parent 6d574bec

Publish release and run artifacts as file trees

Release pointers and run outputs are now slash-separated paths. A flat name is
a one-segment path, so every existing release, pointer, URL, and workflow that
uses dist/* keeps working.

- metadata validates artifact paths, lists and loads them recursively, and
  refuses a tag that would make the tag/path boundary ambiguous
- vole release attach keeps a directory's relative paths; a plain file keeps its
  base name
- a workflow match is published relative to the declaration's static root, so
  dist/* stays flat while dist/*/* keeps one directory level
- release and run download routes accept nested paths; Content-Disposition still
  saves the base name
- one internal rule is shared by the pointer writer, metadata validator, run
  record, CLI, and routes so they cannot disagree

Refs: 01M7BPH6RRPK2934FCHVJPQNGY

server/releases_test.go +39

@@ -406,6 +406,45 @@ func TestReleaseArtifactDownload(t *testing.T) {
406 406 }
407 407 }
408 408
409 // A release artifact is a path, so a package layout survives the round trip from
410 // the pointer to the page link to the download. The download still saves under
411 // the base name, not the path.
412 func TestReleaseArtifactTreeDownload(t *testing.T) {
413 t.Parallel()
414 f := releaseFixture(t)
415 data := []byte("Package: vole\nVersion: 1.0.0\n")
416 oid, _ := attachArtifact(t, f, "v1.0.0", "apt/Packages", data)
417
418 code, page := f.get("/" + f.repo + "/releases/v1.0.0")
419 if code != 200 {
420 t.Fatalf("release page = %d", code)
421 }
422 for _, want := range []string{"apt/Packages", "/artifacts/apt/Packages"} {
423 if !strings.Contains(page, want) {
424 t.Fatalf("release page does not show %q:\n%s", want, page)
425 }
426 }
427
428 resp, err := http.Get(f.http.URL + "/" + f.repo + "/releases/v1.0.0/artifacts/apt/Packages")
429 if err != nil {
430 t.Fatal(err)
431 }
432 body, _ := io.ReadAll(resp.Body)
433 resp.Body.Close()
434 if resp.StatusCode != 200 {
435 t.Fatalf("nested artifact download = %d", resp.StatusCode)
436 }
437 if !bytes.Equal(body, data) {
438 t.Fatalf("downloaded %q, want %q", body, data)
439 }
440 if got, want := resp.Header.Get("ETag"), `"`+oid+`"`; got != want {
441 t.Fatalf("ETag = %q, want %q", got, want)
442 }
443 if cd := resp.Header.Get("Content-Disposition"); !strings.Contains(cd, `filename="Packages"`) {
444 t.Fatalf("Content-Disposition = %q, want the base name", cd)
445 }
446 }
447
409 448 // TestReleasePointerWithoutObjectIsRefused is the reason attach uploads first.
410 449 // receive-pack cannot notice — the bytes were never in the pack — so the hook has
411 450 // to read the pointer and check the store, or the release would advertise a