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.
Let a release change until a channel names it
214e7ea67ccb37d356a52097f8ce838bdf4c1731 · Keenan Nemetz · 17d ago · parent 502119f4
Let a release change until a channel names it A release is mutable again. Notes can be edited and files added, replaced, or removed after publication, because a mistyped note or a rebuilt binary is not a reason to cut a new version. Editing the notes re-tags the same commit, which the old rule refused from the first attached file. The one thing that stays frozen is a release a channel names. A channel records the tag name and the tag object, so a re-tag would dangle it and a changed pointer would serve different bytes under a URL a package manager already cached. Pre-receive reads the channel table from the instance database and refuses every change to a channeled release — tag moves and deletes, and added, replaced, or removed pointers alike — naming the channel and how to move it. The browser applies the same rule: the edit form, the attach form, and the list link are all drawn from it. Attaching also works from the browser now, at parity with the CLI. The Artifacts card takes files, or a directory, and an optional directory to publish under; the handler streams each part to a temp file while hashing it, checks the object-store quota before storing anything, writes bytes first and pointers second, and calls the same metadata writer the CLI does. A directory upload keeps its paths, which is why the body is read as a multipart stream rather than through ParseForm.
server/hook/hook.go +27−7
| @@ -16,6 +16,7 @@ import ( | |||
| 16 | 16 | "rodent.software/vole/core/git" | |
| 17 | 17 | "rodent.software/vole/core/lfs" | |
| 18 | 18 | "rodent.software/vole/forge/access" | |
| 19 | "rodent.software/vole/forge/channel" | ||
| 19 | 20 | "rodent.software/vole/forge/identity" | |
| 20 | 21 | "rodent.software/vole/forge/index" | |
| 21 | 22 | "rodent.software/vole/forge/landing" | |
| @@ -88,6 +89,7 @@ func PreReceive(cfg Config) int { | |||
| 88 | 89 | var ( | |
| 89 | 90 | acls *access.Store | |
| 90 | 91 | lockTable *lfs.LockStore | |
| 92 | chanStore *channel.Store | ||
| 91 | 93 | err error | |
| 92 | 94 | ) | |
| 93 | 95 | if cfg.InstanceDB != "" { | |
| @@ -119,6 +121,14 @@ func PreReceive(cfg Config) int { | |||
| 119 | 121 | return 1 | |
| 120 | 122 | } | |
| 121 | 123 | defer lockTable.Close() | |
| 124 | // Channels share that database and decide whether a release may change, so | ||
| 125 | // the push path reads them at the same single point as the rest of the gate. | ||
| 126 | chanStore, err = channel.Open(cfg.InstanceDB) | ||
| 127 | if err != nil { | ||
| 128 | reject(cfg.Out, "cannot open the channel table: %v", err) | ||
| 129 | return 1 | ||
| 130 | } | ||
| 131 | defer chanStore.Close() | ||
| 122 | 132 | } | |
| 123 | 133 | // GIT_DIR may be "." — that is what git hands a hook — so the directory is made | |
| 124 | 134 | // absolute before anything is derived from it. | |
| @@ -200,6 +210,15 @@ func PreReceive(cfg Config) int { | |||
| 200 | 210 | // before any per-ref work: a push that cannot be accepted should say so in one | |
| 201 | 211 | // line rather than after a page of review findings. | |
| 202 | 212 | problems := quotaProblems(cfg, g, changes) | |
| 213 | // Which channels name a tag decides whether that release may change. One | ||
| 214 | // closure serves every ref in the push, and an unreadable table refuses the | ||
| 215 | // change rather than letting it through. | ||
| 216 | channels := func(tag string) ([]string, error) { | ||
| 217 | if chanStore == nil || cfg.RepoID == "" { | ||
| 218 | return nil, nil | ||
| 219 | } | ||
| 220 | return chanStore.ForTag(cfg.RepoID, tag) | ||
| 221 | } | ||
| 203 | 222 | for _, c := range changes { | |
| 204 | 223 | // Only branches and tags are writable. The namespace beside them used to hold | |
| 205 | 224 | // the ACL; nothing lives there now (see the access package), so it needs no rule | |
| @@ -331,13 +350,14 @@ func PreReceive(cfg Config) int { | |||
| 331 | 350 | } | |
| 332 | 351 | } | |
| 333 | 352 | ||
| 334 | // A published release is immutable: the tag that names it and the pointers | ||
| 335 | // that carry its bytes. This sits with the integrity checks rather than | ||
| 336 | // with the review gate, because a download that can change bytes is broken | ||
| 337 | // no matter who pushed it — but an admin may override, audited, since a | ||
| 338 | // mistyped tag is a real problem and the alternative is a repository | ||
| 339 | // nobody can repair. | ||
| 340 | if relProblems := releaseFindings(g, c); len(relProblems) > 0 { | ||
| 353 | // A release may be edited, but not while a channel serves it: the channel is | ||
| 354 | // the stable URL, and its record pins this tag object. This sits with the | ||
| 355 | // integrity checks rather than with the review gate, because a channel that | ||
| 356 | // silently served different bytes would have been a broken promise no matter | ||
| 357 | // who pushed it — but an admin may override, audited, since a release a | ||
| 358 | // maintainer cannot move out from under a channel is still a release nobody | ||
| 359 | // can repair. | ||
| 360 | if relProblems := releaseFindings(g, c, channels); len(relProblems) > 0 { | ||
| 341 | 361 | if role.AtLeast(access.Admin) { | |
| 342 | 362 | for _, p := range relProblems { | |
| 343 | 363 | if err := auditLine(cfg.AuditPath, audit.Record{ | |