diff --git a/internal/app/run/runner.go b/internal/app/run/runner.go index c9f5f3e..7be1dba 100644 --- a/internal/app/run/runner.go +++ b/internal/app/run/runner.go @@ -183,7 +183,7 @@ func (r *Runner) run(ctx context.Context, task *runnerv1.Task, reporter *report. ActionCacheDir: filepath.FromSlash(r.cfg.Host.WorkdirParent), ReuseContainers: false, - ForcePull: false, + ForcePull: r.cfg.Container.ForcePull, ForceRebuild: false, LogOutput: true, JSONLogger: false, diff --git a/internal/pkg/config/config.example.yaml b/internal/pkg/config/config.example.yaml index 0dc9f0d..df4f6cc 100644 --- a/internal/pkg/config/config.example.yaml +++ b/internal/pkg/config/config.example.yaml @@ -80,6 +80,8 @@ container: # If it's "-", act_runner will find an available docker host automatically, but the docker host won't be mounted to the job containers and service containers. # If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work. docker_host: "" + # Pull docker image(s) even if already present + force_pull: 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 6b3c6e6..46fd059 100644 --- a/internal/pkg/config/config.go +++ b/internal/pkg/config/config.go @@ -50,6 +50,7 @@ type Container struct { WorkdirParent string `yaml:"workdir_parent"` // WorkdirParent specifies the parent directory for the container's working directory. 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 } // Host represents the configuration for the host.