add flag --registry-mirrors (#42)
This commit is contained in:
parent
427f9abb99
commit
8bd45524d4
|
@ -116,6 +116,11 @@ func main() {
|
|||
Value: v1RegistryURL,
|
||||
EnvVar: "PLUGIN_REGISTRY",
|
||||
},
|
||||
cli.StringSliceFlag{
|
||||
Name: "registry-mirrors",
|
||||
Usage: "docker registry mirrors",
|
||||
EnvVar: "PLUGIN_REGISTRY_MIRRORS",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "username",
|
||||
Usage: "docker username",
|
||||
|
@ -202,6 +207,7 @@ func run(c *cli.Context) error {
|
|||
Args: c.StringSlice("args"),
|
||||
Target: c.String("target"),
|
||||
Repo: c.String("repo"),
|
||||
Mirrors: c.StringSlice("registry-mirrors"),
|
||||
Labels: c.StringSlice("custom-labels"),
|
||||
SkipTlsVerify: c.Bool("skip-tls-verify"),
|
||||
SnapshotMode: c.String("snapshot-mode"),
|
||||
|
|
|
@ -139,6 +139,11 @@ func main() {
|
|||
Usage: "ECR registry",
|
||||
EnvVar: "PLUGIN_REGISTRY",
|
||||
},
|
||||
cli.StringSliceFlag{
|
||||
Name: "registry-mirrors",
|
||||
Usage: "docker registry mirrors",
|
||||
EnvVar: "PLUGIN_REGISTRY_MIRRORS",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "access-key",
|
||||
Usage: "ECR access key",
|
||||
|
@ -273,6 +278,7 @@ func run(c *cli.Context) error {
|
|||
Args: c.StringSlice("args"),
|
||||
Target: c.String("target"),
|
||||
Repo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("repo")),
|
||||
Mirrors: c.StringSlice("registry-mirrors"),
|
||||
Labels: c.StringSlice("custom-labels"),
|
||||
SnapshotMode: c.String("snapshot-mode"),
|
||||
EnableCache: c.Bool("enable-cache"),
|
||||
|
|
|
@ -110,6 +110,11 @@ func main() {
|
|||
Value: "gcr.io",
|
||||
EnvVar: "PLUGIN_REGISTRY",
|
||||
},
|
||||
cli.StringSliceFlag{
|
||||
Name: "registry-mirrors",
|
||||
Usage: "docker registry mirrors",
|
||||
EnvVar: "PLUGIN_REGISTRY_MIRRORS",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "json-key",
|
||||
Usage: "docker username",
|
||||
|
@ -188,6 +193,7 @@ func run(c *cli.Context) error {
|
|||
Args: c.StringSlice("args"),
|
||||
Target: c.String("target"),
|
||||
Repo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("repo")),
|
||||
Mirrors: c.StringSlice("registry-mirrors"),
|
||||
Labels: c.StringSlice("custom-labels"),
|
||||
SnapshotMode: c.String("snapshot-mode"),
|
||||
EnableCache: c.Bool("enable-cache"),
|
||||
|
|
|
@ -26,6 +26,7 @@ type (
|
|||
Args []string // Docker build args
|
||||
Target string // Docker build target
|
||||
Repo string // Docker build repository
|
||||
Mirrors []string // Docker repository mirrors
|
||||
Labels []string // Label map
|
||||
SkipTlsVerify bool // Docker skip tls certificate verify for registry
|
||||
SnapshotMode string // Kaniko snapshot mode
|
||||
|
@ -162,7 +163,10 @@ func (p Plugin) Exec() error {
|
|||
for _, label := range p.Build.Labels {
|
||||
cmdArgs = append(cmdArgs, fmt.Sprintf("--label=%s", label))
|
||||
}
|
||||
|
||||
// Set repository mirrors
|
||||
for _, mirror := range p.Build.Mirrors {
|
||||
cmdArgs = append(cmdArgs, fmt.Sprintf("--registry-mirror=%s", mirror))
|
||||
}
|
||||
if p.Build.Target != "" {
|
||||
cmdArgs = append(cmdArgs, fmt.Sprintf("--target=%s", p.Build.Target))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue