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/refresh.go +23−1
| @@ -85,6 +85,10 @@ func (s *Store) IndexRepo(m *repo.Meta) error { | |||
| 85 | 85 | if err != nil { | |
| 86 | 86 | return err | |
| 87 | 87 | } | |
| 88 | channels, err := metadata.LoadChannelsAt(g, commit) | ||
| 89 | if err != nil { | ||
| 90 | return err | ||
| 91 | } | ||
| 88 | 92 | // State changes are the metadata commits' subjects, so a rebuild reads the | |
| 89 | 93 | // whole branch and takes every one of them. A repository that never pushed | |
| 90 | 94 | // metadata has no branch to read, which is not an error. | |
| @@ -156,6 +160,9 @@ func (s *Store) IndexRepo(m *repo.Meta) error { | |||
| 156 | 160 | if err := replaceArtifacts(tx, m.ID, artifacts); err != nil { | |
| 157 | 161 | return err | |
| 158 | 162 | } | |
| 163 | if err := replaceChannels(tx, m.ID, channels); err != nil { | ||
| 164 | return err | ||
| 165 | } | ||
| 159 | 166 | if _, _, err := replaceReleaseEvents(tx, m.ID, tags); err != nil { | |
| 160 | 167 | return err | |
| 161 | 168 | } | |
| @@ -183,7 +190,7 @@ func (s *Store) IndexRepo(m *repo.Meta) error { | |||
| 183 | 190 | func (s *Store) indexFrom(m *repo.Meta, from, to string) error { | |
| 184 | 191 | g := m.Git() | |
| 185 | 192 | changes, err := g.DiffStatusPaths(from, to, | |
| 186 | metadata.IssuesDir, metadata.ChangesDir, metadata.ReleasesDir) | ||
| 193 | metadata.IssuesDir, metadata.ChangesDir, metadata.ReleasesDir, metadata.ChannelsDir) | ||
| 187 | 194 | if err != nil { | |
| 188 | 195 | return err | |
| 189 | 196 | } | |
| @@ -210,6 +217,7 @@ func (s *Store) indexFrom(m *repo.Meta, from, to string) error { | |||
| 210 | 217 | } | |
| 211 | 218 | } | |
| 212 | 219 | releasesChanged := false | |
| 220 | channelsChanged := false | ||
| 213 | 221 | for path := range changes { | |
| 214 | 222 | switch { | |
| 215 | 223 | case strings.HasPrefix(path, metadata.IssuesDir+"/"): | |
| @@ -222,6 +230,8 @@ func (s *Store) indexFrom(m *repo.Meta, from, to string) error { | |||
| 222 | 230 | } | |
| 223 | 231 | case strings.HasPrefix(path, metadata.ReleasesDir+"/"): | |
| 224 | 232 | releasesChanged = true | |
| 233 | case strings.HasPrefix(path, metadata.ChannelsDir+"/"): | ||
| 234 | channelsChanged = true | ||
| 225 | 235 | } | |
| 226 | 236 | } | |
| 227 | 237 | ||
| @@ -272,6 +282,12 @@ func (s *Store) indexFrom(m *repo.Meta, from, to string) error { | |||
| 272 | 282 | return err | |
| 273 | 283 | } | |
| 274 | 284 | } | |
| 285 | var channels []metadata.Channel | ||
| 286 | if channelsChanged { | ||
| 287 | if channels, err = metadata.LoadChannelsAt(g, to); err != nil { | ||
| 288 | return err | ||
| 289 | } | ||
| 290 | } | ||
| 275 | 291 | ||
| 276 | 292 | // Numbers are historical: a deleted entity keeps its number, and a creation | |
| 277 | 293 | // that was deleted again inside the range still consumed one. The additions | |
| @@ -354,6 +370,11 @@ func (s *Store) indexFrom(m *repo.Meta, from, to string) error { | |||
| 354 | 370 | return err | |
| 355 | 371 | } | |
| 356 | 372 | } | |
| 373 | if channelsChanged { | ||
| 374 | if err := replaceChannels(tx, m.ID, channels); err != nil { | ||
| 375 | return err | ||
| 376 | } | ||
| 377 | } | ||
| 357 | 378 | if err := bumpEventCount(tx, m.ID, eventDelta); err != nil { | |
| 358 | 379 | return err | |
| 359 | 380 | } | |
| @@ -379,6 +400,7 @@ func deleteRepoRows(tx execer, repoID string) error { | |||
| 379 | 400 | `DELETE FROM request_approvals WHERE repo_id=?`, | |
| 380 | 401 | `DELETE FROM comments WHERE repo_id=?`, | |
| 381 | 402 | `DELETE FROM artifacts WHERE repo_id=?`, | |
| 403 | `DELETE FROM release_channels WHERE repo_id=?`, | ||
| 382 | 404 | `DELETE FROM state_changes WHERE repo_id=?`, | |
| 383 | 405 | `DELETE FROM events WHERE repo_id=?`, | |
| 384 | 406 | `DELETE FROM entity_numbers WHERE repo_id=?`, | |