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

ci/agent/artifacts_test.go +44−1

@@ -59,10 +59,53 @@ func TestCollectArtifactFiles(t *testing.T) {
59 59 }
60 60
61 61 // Two files with one base name would collide as downloads; say so instead of
62 // publishing whichever the walk reached first.
62 // publishing whichever the walk reached first. A nested pattern is the way to
63 // keep both.
63 64 if _, err := collectArtifactFiles(root, []string{"dist/tool-linux", "other/tool-linux"}); err == nil {
64 65 t.Fatal("two files were published under one name")
65 66 } else if !strings.Contains(err.Error(), "tool-linux") {
66 67 t.Fatalf("the error does not name the collision: %v", err)
67 68 }
68 69 }
70
71 func TestCollectArtifactFilesKeepsATree(t *testing.T) {
72 root := siteWithFiles(t, map[string]string{
73 "dist/apt/Packages": "packages\n",
74 "dist/apt/Packages.gz": "gz\n",
75 "dist/yum/repodata/repomd.xml": "repomd\n",
76 "dist/apt/vole.deb": "deb\n",
77 })
78
79 // The static prefix is the segments before the first glob: dist/*/* keeps
80 // one directory level, so apt and yum stay distinct.
81 files, err := collectArtifactFiles(root, []string{"dist/*/*"})
82 if err != nil {
83 t.Fatal(err)
84 }
85 got := make([]string, len(files))
86 for i, f := range files {
87 got[i] = f.Name
88 }
89 want := []string{"apt/Packages", "apt/Packages.gz", "apt/vole.deb"}
90 if strings.Join(got, ",") != strings.Join(want, ",") {
91 t.Fatalf("dist/*/* = %v, want %v", got, want)
92 }
93
94 // A deeper pattern describes a deeper tree.
95 files, err = collectArtifactFiles(root, []string{"dist/*/*/*"})
96 if err != nil {
97 t.Fatal(err)
98 }
99 if len(files) != 1 || files[0].Name != "yum/repodata/repomd.xml" {
100 t.Fatalf("dist/*/*/* = %+v", files)
101 }
102
103 // A pattern rooted in one directory keeps that directory out of the target.
104 files, err = collectArtifactFiles(root, []string{"dist/apt/*"})
105 if err != nil {
106 t.Fatal(err)
107 }
108 if len(files) != 3 || files[0].Name != "Packages" {
109 t.Fatalf("dist/apt/* = %+v", files)
110 }
111 }