Merge branch 'main' into dev
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2021-08-20 14:26:10 +02:00
commit 665106ec23
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
4 changed files with 26 additions and 3 deletions

@ -132,6 +132,11 @@ func main() {
Usage: "Set this flag if you only want to build the image, without pushing to a registry",
EnvVar: "PLUGIN_NO_PUSH",
},
cli.StringFlag{
Name: "verbosity",
Usage: "Set this flag with value as oneof <panic|fatal|error|warn|info|debug|trace> to set the logging level for kaniko. Defaults to info.",
EnvVar: "PLUGIN_VERBOSITY",
},
}
if err := app.Run(os.Args); err != nil {
@ -161,6 +166,7 @@ func run(c *cli.Context) error {
CacheTTL: c.Int("cache-ttl"),
DigestFile: defaultDigestFile,
NoPush: c.Bool("no-push"),
Verbosity: c.String("verbosity"),
},
Artifact: kaniko.Artifact{
Tags: c.StringSlice("tags"),

@ -122,6 +122,11 @@ func main() {
Usage: "Set this flag if you only want to build the image, without pushing to a registry",
EnvVar: "PLUGIN_NO_PUSH",
},
cli.StringFlag{
Name: "verbosity",
Usage: "Set this flag with value as oneof <panic|fatal|error|warn|info|debug|trace> to set the logging level for kaniko. Defaults to info.",
EnvVar: "PLUGIN_VERBOSITY",
},
}
if err := app.Run(os.Args); err != nil {
@ -150,6 +155,7 @@ func run(c *cli.Context) error {
CacheTTL: c.Int("cache-ttl"),
DigestFile: defaultDigestFile,
NoPush: c.Bool("no-push"),
Verbosity: c.String("verbosity"),
},
Artifact: kaniko.Artifact{
Tags: c.StringSlice("tags"),

@ -118,6 +118,11 @@ func main() {
Usage: "Set this flag if you only want to build the image, without pushing to a registry",
EnvVar: "PLUGIN_NO_PUSH",
},
cli.StringFlag{
Name: "verbosity",
Usage: "Set this flag as --verbosity=<panic|fatal|error|warn|info|debug|trace> to set the logging level for kaniko. Defaults to info.",
EnvVar: "PLUGIN_VERBOSITY",
},
}
if err := app.Run(os.Args); err != nil {
@ -150,6 +155,7 @@ func run(c *cli.Context) error {
CacheTTL: c.Int("cache-ttl"),
DigestFile: defaultDigestFile,
NoPush: c.Bool("no-push"),
Verbosity: c.String("verbosity"),
},
Artifact: kaniko.Artifact{
Tags: c.StringSlice("tags"),

@ -27,6 +27,7 @@ type (
CacheTTL int // Cache timeout in hours
DigestFile string // Digest file location
NoPush bool // Set this flag if you only want to build the image, without pushing to a registry
Verbosity string // Log level
}
// Artifact defines content of artifact file
Artifact struct {
@ -88,11 +89,11 @@ func (p Plugin) Exec() error {
if p.Build.EnableCache == true {
cmdArgs = append(cmdArgs, fmt.Sprintf("--cache=true"))
}
if p.Build.CacheRepo != "" {
cmdArgs = append(cmdArgs, fmt.Sprintf("--cache-repo=%s", p.Build.CacheRepo))
}
}
if p.Build.CacheTTL != 0 {
cmdArgs = append(cmdArgs, fmt.Sprintf("--cache-ttl=%d", p.Build.CacheTTL))
@ -115,6 +116,10 @@ func (p Plugin) Exec() error {
}
}
if p.Build.Verbosity != "" {
cmdArgs = append(cmdArgs, fmt.Sprintf("--verbosity=%s", p.Build.Verbosity))
}
cmd := exec.Command("/kaniko/executor", cmdArgs...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr