From 1478bfa0fc0922f621f720d3c98cda08bfa2f5ef Mon Sep 17 00:00:00 2001 From: Henadz Trubach <10942688+gtrubach@users.noreply.github.com> Date: Mon, 6 Apr 2026 10:20:13 +0000 Subject: [PATCH 1/4] Add job-run entrypoint override option --- core/runjob.go | 27 ++++++----- core/runjob_test.go | 115 +++++++++++++++++++++++++------------------- docs/jobs.md | 4 ++ 3 files changed, 85 insertions(+), 61 deletions(-) diff --git a/core/runjob.go b/core/runjob.go index 877d182e0b..119cb6c29b 100644 --- a/core/runjob.go +++ b/core/runjob.go @@ -33,6 +33,7 @@ type RunJob struct { Network string Hostname string Container string + Entrypoint *string Volume []string VolumesFrom []string `gcfg:"volumes-from" mapstructure:"volumes-from,"` Environment []string @@ -163,18 +164,22 @@ func (j *RunJob) pullImage() error { } func (j *RunJob) buildContainer() (*docker.Container, error) { + config := &docker.Config{ + Image: j.Image, + AttachStdin: false, + AttachStdout: true, + AttachStderr: true, + Tty: j.TTY, + Cmd: args.GetArgs(j.Command), + User: j.User, + Env: j.Environment, + Hostname: j.Hostname, + } + if j.Entrypoint != nil { + config.Entrypoint = args.GetArgs(*j.Entrypoint) + } c, err := j.Client.CreateContainer(docker.CreateContainerOptions{ - Config: &docker.Config{ - Image: j.Image, - AttachStdin: false, - AttachStdout: true, - AttachStderr: true, - Tty: j.TTY, - Cmd: args.GetArgs(j.Command), - User: j.User, - Env: j.Environment, - Hostname: j.Hostname, - }, + Config: config, NetworkingConfig: &docker.NetworkingConfig{}, HostConfig: &docker.HostConfig{ Binds: j.Volume, diff --git a/core/runjob_test.go b/core/runjob_test.go index da80ef50e6..683c47546d 100644 --- a/core/runjob_test.go +++ b/core/runjob_test.go @@ -33,56 +33,71 @@ func (s *SuiteRunJob) SetUpTest(c *C) { } func (s *SuiteRunJob) TestRun(c *C) { - job := &RunJob{Client: s.client} - job.Image = ImageFixture - job.Command = `echo -a "foo bar"` - job.User = "foo" - job.TTY = true - job.Delete = "true" - job.Network = "foo" - job.Hostname = "test-host" - job.Name = "test" - job.Environment = []string{"test_Key1=value1", "test_Key2=value2"} - job.Volume = []string{"/test/tmp:/test/tmp:ro", "/test/tmp:/test/tmp:rw"} - - ctx := &Context{} - ctx.Execution = NewExecution() - ctx.Logger = NewSlogLogger(io.Discard) - ctx.Job = job - - go func() { - // Docker Test Server doesn't actually start container - // so "job.Run" will hang until container is stopped - if err := job.Run(ctx); err != nil { - c.Fatal(err) - } - }() - - time.Sleep(200 * time.Millisecond) - container, err := job.getContainer() - c.Assert(err, IsNil) - c.Assert(container.Config.Cmd, DeepEquals, []string{"echo", "-a", "foo bar"}) - c.Assert(container.Config.User, Equals, job.User) - c.Assert(container.Config.Image, Equals, job.Image) - c.Assert(container.State.Running, Equals, true) - c.Assert(container.Config.Env, DeepEquals, job.Environment) - - // this doesn't seem to be working with DockerTestServer - // c.Assert(container.Config.Hostname, Equals, job.Hostname) - // c.Assert(container.HostConfig.Binds, DeepEquals, job.Volume) - - // stop container, we don't need it anymore - err = job.stopContainer(0) - c.Assert(err, IsNil) - - // wait and double check if container was deleted on "stop" - time.Sleep(watchDuration * 2) - container, _ = job.getContainer() - c.Assert(container, IsNil) - - containers, err := s.client.ListContainers(docker.ListContainersOptions{All: true}) - c.Assert(err, IsNil) - c.Assert(containers, HasLen, 0) + overridenEntrypoint := "/bin/bash -c" + emptyEntrypoint := "" + testCases := []struct { + entrypoint *string + expectedEntrypoint []string + }{ + {nil, nil}, + {&overridenEntrypoint, []string{"/bin/bash", "-c"}}, + {&emptyEntrypoint, []string{}}, + } + + for _, tc := range testCases { + job := &RunJob{Client: s.client} + job.Image = ImageFixture + job.Command = `echo -a "foo bar"` + job.User = "foo" + job.TTY = true + job.Delete = "true" + job.Network = "foo" + job.Hostname = "test-host" + job.Name = "test" + job.Environment = []string{"test_Key1=value1", "test_Key2=value2"} + job.Volume = []string{"/test/tmp:/test/tmp:ro", "/test/tmp:/test/tmp:rw"} + job.Entrypoint = tc.entrypoint + + ctx := &Context{} + ctx.Execution = NewExecution() + ctx.Logger = NewSlogLogger(io.Discard) + ctx.Job = job + + go func() { + // Docker Test Server doesn't actually start container + // so "job.Run" will hang until container is stopped + if err := job.Run(ctx); err != nil { + c.Fatal(err) + } + }() + + time.Sleep(200 * time.Millisecond) + container, err := job.getContainer() + c.Assert(err, IsNil) + c.Assert(container.Config.Entrypoint, DeepEquals, tc.expectedEntrypoint) + c.Assert(container.Config.Cmd, DeepEquals, []string{"echo", "-a", "foo bar"}) + c.Assert(container.Config.User, Equals, job.User) + c.Assert(container.Config.Image, Equals, job.Image) + c.Assert(container.State.Running, Equals, true) + c.Assert(container.Config.Env, DeepEquals, job.Environment) + + // this doesn't seem to be working with DockerTestServer + // c.Assert(container.Config.Hostname, Equals, job.Hostname) + // c.Assert(container.HostConfig.Binds, DeepEquals, job.Volume) + + // stop container, we don't need it anymore + err = job.stopContainer(0) + c.Assert(err, IsNil) + + // wait and double check if container was deleted on "stop" + time.Sleep(watchDuration * 2) + container, _ = job.getContainer() + c.Assert(container, IsNil) + + containers, err := s.client.ListContainers(docker.ListContainersOptions{All: true}) + c.Assert(err, IsNil) + c.Assert(containers, HasLen, 0) + } } func (s *SuiteRunJob) TestBuildPullImageOptionsBareImage(c *C) { diff --git a/docs/jobs.md b/docs/jobs.md index e40c5936e0..d964303ac5 100644 --- a/docs/jobs.md +++ b/docs/jobs.md @@ -84,6 +84,10 @@ This job can be used in 2 situations: - *description*: Command you want to run inside the container. - *value*: String, e.g. `touch /tmp/example` - *default*: Default container command +- **Entrypoint** (1) + - *description*: Override container default entrypoint. + - *value*: String, e.g. `/bin/bash -c` + - *default*: Default container entrypoint - **Image** (1) - *description*: Image you want to use for the job. - *value*: String, e.g. `nginx:latest` From c0b4c0dced9b9acbaf58d72fc9171cc4a441fb52 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 7 Apr 2026 21:30:54 +0000 Subject: [PATCH 2/4] chore(deps): update dependency go to v1.26.2 --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 71c05823f7..6f092ac052 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/mcuadros/ofelia go 1.25.0 -toolchain go1.26.1 +toolchain go1.26.2 require ( github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2 From 3e716d5af24729c5d57601849b20b69a638520d6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 17:35:40 +0000 Subject: [PATCH 3/4] fix(deps): update module github.com/magefile/mage to v1.17.1 --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 6f092ac052..186ac73f52 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/gohugoio/hashstructure v0.6.0 github.com/jessevdk/go-flags v1.6.1 github.com/lmittmann/tint v1.1.3 - github.com/magefile/mage v1.16.1 + github.com/magefile/mage v1.17.1 github.com/mcuadros/go-defaults v1.2.0 github.com/robfig/cron/v3 v3.0.1 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c diff --git a/go.sum b/go.sum index 455e09a496..aab7ec0c6b 100644 --- a/go.sum +++ b/go.sum @@ -50,6 +50,8 @@ github.com/lmittmann/tint v1.1.3 h1:Hv4EaHWXQr+GTFnOU4VKf8UvAtZgn0VuKT+G0wFlO3I= github.com/lmittmann/tint v1.1.3/go.mod h1:HIS3gSy7qNwGCj+5oRjAutErFBl4BzdQP6cJZ0NfMwE= github.com/magefile/mage v1.16.1 h1:j5UwkdA48xTlGs0Hcm1Q3sSAcxBorntQjiewDNMsqlo= github.com/magefile/mage v1.16.1/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= +github.com/magefile/mage v1.17.1 h1:F1d2lnLSlbQDM0Plq6Ac4NtaHxkxTK8t5nrMY9SkoNA= +github.com/magefile/mage v1.17.1/go.mod h1:Yj51kqllmsgFpvvSzgrZPK9WtluG3kUhFaBUVLo4feA= github.com/mcuadros/go-defaults v1.2.0 h1:FODb8WSf0uGaY8elWJAkoLL0Ri6AlZ1bFlenk56oZtc= github.com/mcuadros/go-defaults v1.2.0/go.mod h1:WEZtHEVIGYVDqkKSWBdWKUVdRyKlMfulPaGDWIVeCWY= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= From 32b612ad1baca6a889977510c8f4d7fc6bbf4346 Mon Sep 17 00:00:00 2001 From: Taras <9948629+taraspos@users.noreply.github.com> Date: Sat, 11 Apr 2026 09:02:11 +0100 Subject: [PATCH 4/4] Add renovate branch to workflow triggers --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9d7ec0d346..61cfeb30d9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,6 +4,7 @@ on: branches: - master - 0.3.x + - 'renovate/**' pull_request: branches: - master