add skip-tls-verify flag for insecure private registries (#11)
Co-authored-by: beniamin.calota <beniamin.calota@emag.ro>
This commit is contained in:
parent
3e4dad8cae
commit
9cca954ec6
@ -94,6 +94,11 @@ func main() {
|
|||||||
Usage: "docker password",
|
Usage: "docker password",
|
||||||
EnvVar: "PLUGIN_PASSWORD",
|
EnvVar: "PLUGIN_PASSWORD",
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag {
|
||||||
|
Name: "skip-tls-verify",
|
||||||
|
Usage: "Skip registry tls verify",
|
||||||
|
EnvVar: "PLUGIN_SKIP_TLS_VERIFY",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
@ -116,6 +121,7 @@ func run(c *cli.Context) error {
|
|||||||
Target: c.String("target"),
|
Target: c.String("target"),
|
||||||
Repo: c.String("repo"),
|
Repo: c.String("repo"),
|
||||||
Labels: c.StringSlice("custom-labels"),
|
Labels: c.StringSlice("custom-labels"),
|
||||||
|
SkipTlsVerify: c.Bool("skip-tls-verify"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return plugin.Exec()
|
return plugin.Exec()
|
||||||
|
19
kaniko.go
19
kaniko.go
@ -10,13 +10,14 @@ import (
|
|||||||
type (
|
type (
|
||||||
// Build defines Docker build parameters.
|
// Build defines Docker build parameters.
|
||||||
Build struct {
|
Build struct {
|
||||||
Dockerfile string // Docker build Dockerfile
|
Dockerfile string // Docker build Dockerfile
|
||||||
Context string // Docker build context
|
Context string // Docker build context
|
||||||
Tags []string // Docker build tags
|
Tags []string // Docker build tags
|
||||||
Args []string // Docker build args
|
Args []string // Docker build args
|
||||||
Target string // Docker build target
|
Target string // Docker build target
|
||||||
Repo string // Docker build repository
|
Repo string // Docker build repository
|
||||||
Labels []string // Label map
|
Labels []string // Label map
|
||||||
|
SkipTlsVerify bool // Docker skip tls certificate verify for registry
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plugin defines the Docker plugin parameters.
|
// Plugin defines the Docker plugin parameters.
|
||||||
@ -57,6 +58,10 @@ func (p Plugin) Exec() error {
|
|||||||
cmdArgs = append(cmdArgs, fmt.Sprintf("--target=%s", p.Build.Target))
|
cmdArgs = append(cmdArgs, fmt.Sprintf("--target=%s", p.Build.Target))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if p.Build.SkipTlsVerify {
|
||||||
|
cmdArgs = append(cmdArgs, fmt.Sprintf("--skip-tls-verify=true"))
|
||||||
|
}
|
||||||
|
|
||||||
cmd := exec.Command("/kaniko/executor", cmdArgs...)
|
cmd := exec.Command("/kaniko/executor", cmdArgs...)
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
|
Loading…
Reference in New Issue
Block a user