diff options
author | gratux <gratux@noreply.code.forgejo.org> | 2024-12-29 17:13:04 +0100 |
---|---|---|
committer | gratux <gratux@noreply.code.forgejo.org> | 2024-12-29 17:13:04 +0100 |
commit | 3947276c79e826e93c71bc554e146fe48cbd99fa (patch) | |
tree | 0644176e8f930db9e9298e76e4270bc45d09117e | |
parent | Merge pull request 'chore(docs): 6.0.0 release notes' (#401) from earl-warren... (diff) | |
download | forgejo-runner-3947276c79e826e93c71bc554e146fe48cbd99fa.tar.xz forgejo-runner-3947276c79e826e93c71bc554e146fe48cbd99fa.zip |
expose "ForceRebuild" as a config option
-rw-r--r-- | internal/app/run/runner.go | 2 | ||||
-rw-r--r-- | internal/pkg/config/config.example.yaml | 2 | ||||
-rw-r--r-- | internal/pkg/config/config.go | 1 | ||||
-rw-r--r-- | internal/pkg/config/config_test.go | 1 |
4 files changed, 5 insertions, 1 deletions
diff --git a/internal/app/run/runner.go b/internal/app/run/runner.go index 5f03638..27bdf3e 100644 --- a/internal/app/run/runner.go +++ b/internal/app/run/runner.go @@ -209,7 +209,7 @@ func (r *Runner) run(ctx context.Context, task *runnerv1.Task, reporter *report. ReuseContainers: false, ForcePull: r.cfg.Container.ForcePull, - ForceRebuild: false, + ForceRebuild: r.cfg.Container.ForceRebuild, LogOutput: true, JSONLogger: false, Env: r.envs, diff --git a/internal/pkg/config/config.example.yaml b/internal/pkg/config/config.example.yaml index dbdf46e..bcd2117 100644 --- a/internal/pkg/config/config.example.yaml +++ b/internal/pkg/config/config.example.yaml @@ -95,6 +95,8 @@ container: docker_host: "-" # Pull docker image(s) even if already present force_pull: false + # Rebuild local docker image(s) even if already present + force_rebuild: false host: # The parent directory of a job's working directory. diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go index 60be651..3d95044 100644 --- a/internal/pkg/config/config.go +++ b/internal/pkg/config/config.go @@ -55,6 +55,7 @@ type Container struct { ValidVolumes []string `yaml:"valid_volumes"` // ValidVolumes specifies the volumes (including bind mounts) can be mounted to containers. DockerHost string `yaml:"docker_host"` // DockerHost specifies the Docker host. It overrides the value specified in environment variable DOCKER_HOST. ForcePull bool `yaml:"force_pull"` // Pull docker image(s) even if already present + ForceRebuild bool `yaml:"force_rebuild"` // Rebuild local docker image(s) even if already present } // Host represents the configuration for the host. diff --git a/internal/pkg/config/config_test.go b/internal/pkg/config/config_test.go index 2f046c0..43d0f10 100644 --- a/internal/pkg/config/config_test.go +++ b/internal/pkg/config/config_test.go @@ -42,4 +42,5 @@ func TestDefaultSettings(t *testing.T) { assert.EqualValues(t, config.Container.DockerHost, "-") assert.EqualValues(t, config.Log.JobLevel, "info") + assert.EqualValues(t, config.Container.ForceRebuild, false) } |