diff --git a/command/daemon/config.go b/command/daemon/config.go index 248bdc4..af7131c 100644 --- a/command/daemon/config.go +++ b/command/daemon/config.go @@ -58,6 +58,7 @@ type Config struct { Devices []string `envconfig:"DRONE_RUNNER_DEVICES"` Networks []string `envconfig:"DRONE_RUNNER_NETWORKS"` Privileged []string `envconfig:"DRONE_RUNNER_PRIVILEGED_IMAGES"` + Clone string `envconfig:"DRONE_RUNNER_CLONE_IMAGE"` } Platform struct { diff --git a/command/daemon/daemon.go b/command/daemon/daemon.go index 64cc8b5..b0d8d3f 100644 --- a/command/daemon/daemon.go +++ b/command/daemon/daemon.go @@ -119,6 +119,7 @@ func (c *daemonCommand) run(*kingpin.ParseContext) error { config.Limit.Trusted, ), Compiler: &compiler.Compiler{ + Clone: config.Runner.Clone, Environ: config.Runner.Environ, Privileged: append(config.Runner.Privileged, compiler.Privileged...), Networks: config.Runner.Networks, diff --git a/engine/compiler/compiler.go b/engine/compiler/compiler.go index 2829937..14e630c 100644 --- a/engine/compiler/compiler.go +++ b/engine/compiler/compiler.go @@ -114,6 +114,10 @@ type Compiler struct { // mounted to each pipeline container. Volumes map[string]string + // Clone overrides the default plugin image used + // when cloning a repository. + Clone string + // Resources provides global resource constraints // applies to pipeline containers. Resources Resources @@ -269,6 +273,12 @@ func (c *Compiler) Compile(ctx context.Context, args Args) *engine.Spec { step.Volumes = append(step.Volumes, mount) spec.Steps = append(spec.Steps, step) + // if the clone image is customized, override + // the default image. + if c.Clone != "" { + step.Image = c.Clone + } + // if the repository is mounted from a local // volume we should disable cloning. if c.Mount != "" {