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.
Add named release channels and a generic channel file route
24019cb30892b9fc0118697e8b89cd61e9fab576 · Keenan Nemetz · 19d ago · parent 4f8a3da8
Add named release channels and a generic channel file route A channel is a mutable pointer, channels/<name>.md, to one immutable annotated release. The target tag object is recorded so a rewritten tag is detected rather than silently followed. - metadata: channel parse/render/validate, closed-layout and size checks, set/clear writers - CLI: vole release channel set|list|clear; a dangling target is reported - server: maintain/admin path gate and audit for channel.set/clear - index: release_channels table, incremental refresh, per-tag badge query - web: /channels list, /channels/<name> redirect, and /channels/<name>/<path...> serving the target release's tree with OID ETags, Range, revalidation, and octet-stream responses - tests: metadata round trips, index moves, hook role/audit, page/tree/dangling/ private, and the CLI end to end No apt, yum, or other package-manager code is involved: a package layout is a directory in the release tree. Refs: 01M7BPHANWMSW5HK2GT0PY74QZ
forge/index/channels_test.go +75
| @@ -0,0 +1,75 @@ | |||
| 1 | package index | ||
| 2 | |||
| 3 | import ( | ||
| 4 | "strings" | ||
| 5 | "testing" | ||
| 6 | "time" | ||
| 7 | |||
| 8 | "rodent.software/vole/metadata" | ||
| 9 | ) | ||
| 10 | |||
| 11 | func TestEnsureIndexesChannels(t *testing.T) { | ||
| 12 | t.Parallel() | ||
| 13 | s, m, g := incrementalRepo(t) | ||
| 14 | at := time.Date(2026, 11, 14, 12, 0, 0, 0, time.UTC) | ||
| 15 | ch := &metadata.Channel{ | ||
| 16 | Name: "stable", | ||
| 17 | Release: "v1.0.0", | ||
| 18 | ReleaseObject: strings.Repeat("a", 40), | ||
| 19 | UpdatedBy: "keenan", | ||
| 20 | UpdatedAt: at, | ||
| 21 | Description: "Recommended for production.", | ||
| 22 | } | ||
| 23 | if err := metadata.WriteChannel(g, metadata.Ref, ch, "channel: stable", "keenan"); err != nil { | ||
| 24 | t.Fatal(err) | ||
| 25 | } | ||
| 26 | if err := s.Ensure(m); err != nil { | ||
| 27 | t.Fatal(err) | ||
| 28 | } | ||
| 29 | list, err := s.Channels(m.ID) | ||
| 30 | if err != nil { | ||
| 31 | t.Fatal(err) | ||
| 32 | } | ||
| 33 | if len(list) != 1 || list[0].Name != "stable" || list[0].Release != "v1.0.0" || | ||
| 34 | list[0].Description != ch.Description || !list[0].UpdatedAt.Equal(at) { | ||
| 35 | t.Fatalf("channels = %+v", list) | ||
| 36 | } | ||
| 37 | got, ok, err := s.Channel(m.ID, "stable") | ||
| 38 | if err != nil || !ok || got.ReleaseObject != ch.ReleaseObject { | ||
| 39 | t.Fatalf("Channel = %+v, %v, %v", got, ok, err) | ||
| 40 | } | ||
| 41 | if _, ok, err := s.Channel(m.ID, "missing"); err != nil || ok { | ||
| 42 | t.Fatalf("missing channel = %v, %v", ok, err) | ||
| 43 | } | ||
| 44 | names, err := s.ChannelsForTag(m.ID, "v1.0.0") | ||
| 45 | if err != nil || len(names) != 1 || names[0] != "stable" { | ||
| 46 | t.Fatalf("ChannelsForTag = %v, %v", names, err) | ||
| 47 | } | ||
| 48 | |||
| 49 | // Moving the pointer is an incremental refresh: the channel table is replaced | ||
| 50 | // from the new tree, not appended to. | ||
| 51 | ch.Release = "v2.0.0" | ||
| 52 | ch.ReleaseObject = strings.Repeat("b", 40) | ||
| 53 | if err := metadata.WriteChannel(g, metadata.Ref, ch, "channel: stable -> v2.0.0", "keenan"); err != nil { | ||
| 54 | t.Fatal(err) | ||
| 55 | } | ||
| 56 | if err := s.Ensure(m); err != nil { | ||
| 57 | t.Fatal(err) | ||
| 58 | } | ||
| 59 | if names, _ := s.ChannelsForTag(m.ID, "v1.0.0"); len(names) != 0 { | ||
| 60 | t.Fatalf("old tag still has channels: %v", names) | ||
| 61 | } | ||
| 62 | if names, _ := s.ChannelsForTag(m.ID, "v2.0.0"); len(names) != 1 || names[0] != "stable" { | ||
| 63 | t.Fatalf("new tag channels = %v", names) | ||
| 64 | } | ||
| 65 | |||
| 66 | if err := metadata.DeleteChannel(g, metadata.Ref, "stable", "channel: clear stable", "keenan"); err != nil { | ||
| 67 | t.Fatal(err) | ||
| 68 | } | ||
| 69 | if err := s.Ensure(m); err != nil { | ||
| 70 | t.Fatal(err) | ||
| 71 | } | ||
| 72 | if list, err := s.Channels(m.ID); err != nil || len(list) != 0 { | ||
| 73 | t.Fatalf("after clear = %+v, %v", list, err) | ||
| 74 | } | ||
| 75 | } | ||