1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2025-11-29 21:48:14 +02:00

Add support for default clone image environment variable (#769)

This allows for custom clone images for deployment in air-gap systems.

Co-authored-by: Zav Shotan <zshotan@bloomberg.net>
This commit is contained in:
Zav Shotan
2022-02-10 11:05:19 -05:00
committed by GitHub
parent 51904c9ee1
commit 905350fa15
8 changed files with 51 additions and 15 deletions

View File

@@ -47,20 +47,21 @@ type ResourceLimit struct {
// Compiler compiles the yaml
type Compiler struct {
local bool
escalated []string
prefix string
volumes []string
networks []string
env map[string]string
cloneEnv map[string]string
base string
path string
metadata frontend.Metadata
registries []Registry
secrets map[string]Secret
cacher Cacher
reslimit ResourceLimit
local bool
escalated []string
prefix string
volumes []string
networks []string
env map[string]string
cloneEnv map[string]string
base string
path string
metadata frontend.Metadata
registries []Registry
secrets map[string]Secret
cacher Cacher
reslimit ResourceLimit
defaultCloneImage string
}
// New creates a new Compiler with options.
@@ -120,9 +121,13 @@ func (c *Compiler) Compile(conf *yaml.Config) *backend.Config {
// add default clone step
if !c.local && len(conf.Clone.Containers) == 0 && !conf.SkipClone {
cloneImage := defaultCloneImage
if len(c.defaultCloneImage) > 0 {
cloneImage = c.defaultCloneImage
}
container := &yaml.Container{
Name: defaultCloneName,
Image: defaultCloneImage,
Image: cloneImage,
Settings: map[string]interface{}{"depth": "0"},
Environment: c.cloneEnv,
}