detached 47fa8de

refactor(config): leave the default CI retention to the CI use case

commit
47fa8def9d18d90770c631e09290ff47c14e4530
author
brice · · 2026-10-12 19:26 UTC
parent
c31fed8
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +4 -6
M internal/config/config.go +2 -4
@@ -52,8 +52,6 @@ const (
5252 DefaultCommitterName = "ermite"
5353 // DefaultOwner is the owner login when ERMITE_OWNER is not set.
5454 DefaultOwner = "owner"
55- // DefaultCIRetention is the retention of CI data.
56- DefaultCIRetention = 90 * 24 * time.Hour
5755 )
5856
5957 // Values of ERMITE_GIT_READER.
@@ -97,7 +95,8 @@ type Config struct {
9795 CommitterName, CommitterEmail string
9896 // Owner is the owner login of the github context of CI runs.
9997 Owner string
100- // CIRetention is how long CI data is kept.
98+ // CIRetention is how long CI data is kept; 0 (variable unset) leaves the
99+ // default to the CI use case.
101100 CIRetention time.Duration
102101 }
103102
@@ -239,7 +238,6 @@ func Load(get func(string) string) (Config, error) {
239238 c.Owner = DefaultOwner
240239 }
241240
242- c.CIRetention = DefaultCIRetention
243241 if raw := strings.TrimSpace(get(EnvCILogRetention)); raw != "" {
244242 d, err := parseRetention(raw)
245243 if err != nil {
@@ -52,8 +52,6 @@ const (
52 DefaultCommitterName = "ermite"52 DefaultCommitterName = "ermite"
53 // DefaultOwner is the owner login when ERMITE_OWNER is not set.53 // DefaultOwner is the owner login when ERMITE_OWNER is not set.
54 DefaultOwner = "owner"54 DefaultOwner = "owner"
55- // DefaultCIRetention is the retention of CI data.
56- DefaultCIRetention = 90 * 24 * time.Hour
57 )55 )
58 56
59 // Values of ERMITE_GIT_READER.57 // Values of ERMITE_GIT_READER.
@@ -97,7 +95,8 @@ type Config struct {
97 CommitterName, CommitterEmail string95 CommitterName, CommitterEmail string
98 // Owner is the owner login of the github context of CI runs.96 // Owner is the owner login of the github context of CI runs.
99 Owner string97 Owner string
100- // CIRetention is how long CI data is kept.98+ // CIRetention is how long CI data is kept; 0 (variable unset) leaves the
99+ // default to the CI use case.
101 CIRetention time.Duration100 CIRetention time.Duration
102 }101 }
103 102
@@ -239,7 +238,6 @@ func Load(get func(string) string) (Config, error) {
239 c.Owner = DefaultOwner238 c.Owner = DefaultOwner
240 }239 }
241 240
242- c.CIRetention = DefaultCIRetention
243 if raw := strings.TrimSpace(get(EnvCILogRetention)); raw != "" {241 if raw := strings.TrimSpace(get(EnvCILogRetention)); raw != "" {
244 d, err := parseRetention(raw)242 d, err := parseRetention(raw)
245 if err != nil {243 if err != nil {
M internal/config/config_test.go +2 -2
@@ -230,8 +230,8 @@ func TestOwnerAndCIRetention(t *testing.T) {
230230 if err != nil {
231231 t.Fatal(err)
232232 }
233- if c.Owner != "owner" || c.CIRetention != 90*24*time.Hour {
234- t.Fatalf("defaults: owner %q, retention %v", c.Owner, c.CIRetention)
233+ if c.Owner != "owner" || c.CIRetention != 0 {
234+ t.Fatalf("defaults (retention is left to the use case): owner %q, retention %v", c.Owner, c.CIRetention)
235235 }
236236
237237 c, err = load(map[string]string{config.EnvOwner: "bnema", config.EnvCILogRetention: "30d"})
@@ -230,8 +230,8 @@ func TestOwnerAndCIRetention(t *testing.T) {
230 if err != nil {230 if err != nil {
231 t.Fatal(err)231 t.Fatal(err)
232 }232 }
233- if c.Owner != "owner" || c.CIRetention != 90*24*time.Hour {233+ if c.Owner != "owner" || c.CIRetention != 0 {
234- t.Fatalf("defaults: owner %q, retention %v", c.Owner, c.CIRetention)234+ t.Fatalf("defaults (retention is left to the use case): owner %q, retention %v", c.Owner, c.CIRetention)
235 }235 }
236 236
237 c, err = load(map[string]string{config.EnvOwner: "bnema", config.EnvCILogRetention: "30d"})237 c, err = load(map[string]string{config.EnvOwner: "bnema", config.EnvCILogRetention: "30d"})

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 2

Tags 44

↑↓ moveenter openesc close