detached 9596a73

chore(executor): lint fixes for the container code

commit
9596a7326953aec7a2f7935eb0c5f8509bb07ccc
author
brice · · 2026-10-14 06:00 UTC
parent
59a9c3a
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
3 files · +4 -36
M internal/executor/containers_fake_test.go +0 -9
@@ -5,7 +5,6 @@ package executor
55 import (
66 "os"
77 "path/filepath"
8- "strings"
98 "testing"
109 "time"
1110 )
@@ -104,14 +103,6 @@ func ctrRunC(t *testing.T, f *fakeCtr, cancel *Canceller, jobYAML, steps string,
104103 })
105104 }
106105
107-func joinCalls(cs [][]string) string {
108- var b strings.Builder
109- for _, c := range cs {
110- b.WriteString(strings.Join(c, " ") + "\n")
111- }
112- return b.String()
113-}
114-
115106 // concl is the conclusion of the step called name.
116107 func (r *recorder) concl(name string) Conclusion {
117108 r.mu.Lock()
@@ -5,7 +5,6 @@ package executor
5 import (5 import (
6 "os"6 "os"
7 "path/filepath"7 "path/filepath"
8- "strings"
9 "testing"8 "testing"
10 "time"9 "time"
11 )10 )
@@ -104,14 +103,6 @@ func ctrRunC(t *testing.T, f *fakeCtr, cancel *Canceller, jobYAML, steps string,
104 })103 })
105 }104 }
106 105
107-func joinCalls(cs [][]string) string {
108- var b strings.Builder
109- for _, c := range cs {
110- b.WriteString(strings.Join(c, " ") + "\n")
111- }
112- return b.String()
113-}
114-
115 // concl is the conclusion of the step called name.106 // concl is the conclusion of the step called name.
116 func (r *recorder) concl(name string) Conclusion {107 func (r *recorder) concl(name string) Conclusion {
117 r.mu.Lock()108 r.mu.Lock()
M internal/executor/containers_init.go +4 -4
@@ -50,10 +50,10 @@ func (j *job) initContainersStep() qstep {
5050 // (StepsRunner.cs:314-340): a cancellation is logged and cancels the step,
5151 // anything else is logged with its message and fails it.
5252 func (j *job) containerResult(s *stepRun, err error) stepResult {
53- switch {
54- case err == nil:
53+ if err == nil {
5554 return resSucceeded
56- case err == errCancelled:
55+ }
56+ if err == errCancelled {
5757 return j.cancelledStep(s)
5858 }
5959 j.errorf(s.num, "%s", err.Error())
@@ -210,7 +210,7 @@ func (j *job) registryLogin(s *stepRun, c *container, cancel <-chan struct{}) (s
210210 j.addMask(c.credPass)
211211 dir := filepath.Join(j.state.Layout().Temp, ".docker_"+strings.ReplaceAll(newImageTag(""), ":", ""))
212212 if err := os.MkdirAll(dir, 0o700); err != nil {
213- return "", fmt.Errorf("Failed to create directory to store registry client credentials: %v", err)
213+ return "", ghErrorf("Failed to create directory to store registry client credentials: %v", err)
214214 }
215215 j.own(dir)
216216 args := []string{j.dockerPath(), "--config", dir, "login"}
@@ -50,10 +50,10 @@ func (j *job) initContainersStep() qstep {
50 // (StepsRunner.cs:314-340): a cancellation is logged and cancels the step,50 // (StepsRunner.cs:314-340): a cancellation is logged and cancels the step,
51 // anything else is logged with its message and fails it.51 // anything else is logged with its message and fails it.
52 func (j *job) containerResult(s *stepRun, err error) stepResult {52 func (j *job) containerResult(s *stepRun, err error) stepResult {
53- switch {53+ if err == nil {
54- case err == nil:
55 return resSucceeded54 return resSucceeded
56- case err == errCancelled:55+ }
56+ if err == errCancelled {
57 return j.cancelledStep(s)57 return j.cancelledStep(s)
58 }58 }
59 j.errorf(s.num, "%s", err.Error())59 j.errorf(s.num, "%s", err.Error())
@@ -210,7 +210,7 @@ func (j *job) registryLogin(s *stepRun, c *container, cancel <-chan struct{}) (s
210 j.addMask(c.credPass)210 j.addMask(c.credPass)
211 dir := filepath.Join(j.state.Layout().Temp, ".docker_"+strings.ReplaceAll(newImageTag(""), ":", ""))211 dir := filepath.Join(j.state.Layout().Temp, ".docker_"+strings.ReplaceAll(newImageTag(""), ":", ""))
212 if err := os.MkdirAll(dir, 0o700); err != nil {212 if err := os.MkdirAll(dir, 0o700); err != nil {
213- return "", fmt.Errorf("Failed to create directory to store registry client credentials: %v", err)213+ return "", ghErrorf("Failed to create directory to store registry client credentials: %v", err)
214 }214 }
215 j.own(dir)215 j.own(dir)
216 args := []string{j.dockerPath(), "--config", dir, "login"}216 args := []string{j.dockerPath(), "--config", dir, "login"}
D internal/executor/zz_dump_test.go +0 -23
@@ -1,23 +0,0 @@
1-package executor
2-
3-import (
4- "os"
5- "strings"
6- "testing"
7-)
8-
9-func TestZZDump(t *testing.T) {
10- docker := realDocker(t)
11- y, _ := os.ReadFile(os.Getenv("DUMP_YAML"))
12- rec, _ := runLocal(t, string(y), os.Getenv("DUMP_JOB"), func(c *Config) {
13- c.Actions.DockerPath = docker
14- c.BaseEnv = append(c.BaseEnv, "XDG_RUNTIME_DIR="+os.Getenv("XDG_RUNTIME_DIR"))
15- c.Actions.ExternalsDir = fakeNode(t)
16- c.Runner.Environment = "github-hosted"
17- })
18- var b strings.Builder
19- for _, s := range rec.steps {
20- b.WriteString("=== STEP " + s.Name + " " + string(s.Conclusion) + "\n" + logOf(s) + "\n")
21- }
22- os.WriteFile(os.Getenv("DUMP_OUT"), []byte(b.String()), 0o644)
23-}
@@ -1,23 +0,0 @@
1-package executor
2-
3-import (
4- "os"
5- "strings"
6- "testing"
7-)
8-
9-func TestZZDump(t *testing.T) {
10- docker := realDocker(t)
11- y, _ := os.ReadFile(os.Getenv("DUMP_YAML"))
12- rec, _ := runLocal(t, string(y), os.Getenv("DUMP_JOB"), func(c *Config) {
13- c.Actions.DockerPath = docker
14- c.BaseEnv = append(c.BaseEnv, "XDG_RUNTIME_DIR="+os.Getenv("XDG_RUNTIME_DIR"))
15- c.Actions.ExternalsDir = fakeNode(t)
16- c.Runner.Environment = "github-hosted"
17- })
18- var b strings.Builder
19- for _, s := range rec.steps {
20- b.WriteString("=== STEP " + s.Name + " " + string(s.Conclusion) + "\n" + logOf(s) + "\n")
21- }
22- os.WriteFile(os.Getenv("DUMP_OUT"), []byte(b.String()), 0o644)
23-}

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 4

Tags 11

↑↓ moveenter openesc close