feat(executor): docker actions join the job network; container: and services: are no longer refused
- commit
- 4d5e5f860710eca872f4f25675ea1a09f0399a47
- author
- brice · · 2026-10-14 05:53 UTC
- parent
- 3a3049c
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +16 -6
M internal/executor/actions_docker.go +11 -0
| @@ -224,6 +224,17 @@ func (j *job) runDocker(s *stepRun, def *actionDef, in *inputSet, env *ordered, | |||
| 224 | 224 | if entry != "" { | |
| 225 | 225 | parts = append(parts, entrypointOpt(entry)) | |
| 226 | 226 | } | |
| 227 | + | // A docker action joins the network of the job's containers, so that it | |
| 228 | + | // reaches the services by their aliases (ContainerActionHandler.cs:172-175 | |
| 229 | + | // reads job.container.network; the read creates job.container, which is why | |
| 230 | + | // the context of any job that ran a docker action has "container": {}). | |
| 231 | + | j.mu.Lock() | |
| 232 | + | j.state.TouchJobContainer() | |
| 233 | + | network := j.state.JobContainerNetwork() | |
| 234 | + | j.mu.Unlock() | |
| 235 | + | if network != "" { | |
| 236 | + | parts = append(parts, raw("--network", network)) | |
| 237 | + | } | |
| 227 | 238 | parts = append(parts, | |
| 228 | 239 | volumeOpt("/var/run/docker.sock", "/var/run/docker.sock"), | |
| 229 | 240 | volumeOpt(temp, "/github/runner_temp"), | |
| @@ -224,6 +224,17 @@ func (j *job) runDocker(s *stepRun, def *actionDef, in *inputSet, env *ordered, | |||||
| 224 | if entry != "" { | 224 | if entry != "" { | ||
| 225 | parts = append(parts, entrypointOpt(entry)) | 225 | parts = append(parts, entrypointOpt(entry)) | ||
| 226 | } | 226 | } | ||
| 227 | + | // A docker action joins the network of the job's containers, so that it | |||
| 228 | + | // reaches the services by their aliases (ContainerActionHandler.cs:172-175 | |||
| 229 | + | // reads job.container.network; the read creates job.container, which is why | |||
| 230 | + | // the context of any job that ran a docker action has "container": {}). | |||
| 231 | + | j.mu.Lock() | |||
| 232 | + | j.state.TouchJobContainer() | |||
| 233 | + | network := j.state.JobContainerNetwork() | |||
| 234 | + | j.mu.Unlock() | |||
| 235 | + | if network != "" { | |||
| 236 | + | parts = append(parts, raw("--network", network)) | |||
| 237 | + | } | |||
| 227 | parts = append(parts, | 238 | parts = append(parts, | ||
| 228 | volumeOpt("/var/run/docker.sock", "/var/run/docker.sock"), | 239 | volumeOpt("/var/run/docker.sock", "/var/run/docker.sock"), | ||
| 229 | volumeOpt(temp, "/github/runner_temp"), | 240 | volumeOpt(temp, "/github/runner_temp"), | ||
M internal/executor/job_test.go +5 -6
| @@ -192,13 +192,12 @@ jobs: | |||
| 192 | 192 | _ = rec | |
| 193 | 193 | } | |
| 194 | 194 | ||
| 195 | - | func TestNotSupportedYet(t *testing.T) { | |
| 195 | + | // Reusable workflows stay refused; container: and services: are supported. | |
| 196 | + | func TestReusableWorkflowNotSupportedYet(t *testing.T) { | |
| 196 | 197 | needTools(t, "bash") | |
| 197 | - | for _, f := range []string{"container: alpine", "services:\n s:\n image: x"} { | |
| 198 | - | rec2, res2 := runLocal(t, wfHead+" "+f+"\n steps:\n - run: echo hi\n", "j", nil) | |
| 199 | - | if res2.Conclusion != ConclusionFailure || res2.Error == "" || !strings.Contains(logOf(rec2.steps[0]), "not supported yet") { | |
| 200 | - | t.Errorf("%q: %+v %v", f, res2, rec2.names()) | |
| 201 | - | } | |
| 198 | + | rec, res := runLocal(t, "on: push\njobs:\n j:\n uses: ./.github/workflows/x.yml\n", "j", nil) | |
| 199 | + | if res.Conclusion != ConclusionFailure || !strings.Contains(logOf(rec.steps[0]), "not supported yet") { | |
| 200 | + | t.Errorf("%+v %v", res, rec.names()) | |
| 202 | 201 | } | |
| 203 | 202 | } | |
| 204 | 203 | ||
| @@ -192,13 +192,12 @@ jobs: | |||||
| 192 | _ = rec | 192 | _ = rec | ||
| 193 | } | 193 | } | ||
| 194 | 194 | ||||
| 195 | - | func TestNotSupportedYet(t *testing.T) { | 195 | + | // Reusable workflows stay refused; container: and services: are supported. |
| 196 | + | func TestReusableWorkflowNotSupportedYet(t *testing.T) { | |||
| 196 | needTools(t, "bash") | 197 | needTools(t, "bash") | ||
| 197 | - | for _, f := range []string{"container: alpine", "services:\n s:\n image: x"} { | 198 | + | rec, res := runLocal(t, "on: push\njobs:\n j:\n uses: ./.github/workflows/x.yml\n", "j", nil) |
| 198 | - | rec2, res2 := runLocal(t, wfHead+" "+f+"\n steps:\n - run: echo hi\n", "j", nil) | 199 | + | if res.Conclusion != ConclusionFailure || !strings.Contains(logOf(rec.steps[0]), "not supported yet") { |
| 199 | - | if res2.Conclusion != ConclusionFailure || res2.Error == "" || !strings.Contains(logOf(rec2.steps[0]), "not supported yet") { | 200 | + | t.Errorf("%+v %v", res, rec.names()) |
| 200 | - | t.Errorf("%q: %+v %v", f, res2, rec2.names()) | |||
| 201 | - | } | |||
| 202 | } | 201 | } | ||
| 203 | } | 202 | } | ||
| 204 | 203 | ||||