Skip unused stages flag (#49)

* skip unused stages flag

* re-add smithy
This commit is contained in:
Peter Novotnak 2022-04-08 22:27:17 -07:00 committed by GitHub
parent c39a1155b5
commit 89b4f6b0c9
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 110 additions and 87 deletions

@ -181,6 +181,11 @@ func main() {
Usage: "Allows to build with another default platform than the host, similarly to docker build --platform",
EnvVar: "PLUGIN_PLATFORM",
},
cli.BoolFlag{
Name: "skip-unused-stages",
Usage: "build only used stages",
EnvVar: "PLUGIN_SKIP_UNUSED_STAGES",
},
}
if err := app.Run(os.Args); err != nil {
@ -223,6 +228,7 @@ func run(c *cli.Context) error {
NoPush: noPush,
Verbosity: c.String("verbosity"),
Platform: c.String("platform"),
SkipUnusedStages: c.Bool("skip-unused-stages"),
},
Artifact: kaniko.Artifact{
Tags: c.StringSlice("tags"),

@ -204,6 +204,11 @@ func main() {
Usage: "Allows to build with another default platform than the host, similarly to docker build --platform",
EnvVar: "PLUGIN_PLATFORM",
},
cli.BoolFlag{
Name: "skip-unused-stages",
Usage: "build only used stages",
EnvVar: "PLUGIN_SKIP_UNUSED_STAGES",
},
}
if err := app.Run(os.Args); err != nil {
@ -288,6 +293,7 @@ func run(c *cli.Context) error {
NoPush: noPush,
Verbosity: c.String("verbosity"),
Platform: c.String("platform"),
SkipUnusedStages: c.Bool("skip-unused-stages"),
},
Artifact: kaniko.Artifact{
Tags: c.StringSlice("tags"),

@ -160,6 +160,11 @@ func main() {
Usage: "Allows to build with another default platform than the host, similarly to docker build --platform",
EnvVar: "PLUGIN_PLATFORM",
},
cli.BoolFlag{
Name: "skip-unused-stages",
Usage: "build only used stages",
EnvVar: "PLUGIN_SKIP_UNUSED_STAGES",
},
}
if err := app.Run(os.Args); err != nil {
@ -203,6 +208,7 @@ func run(c *cli.Context) error {
NoPush: noPush,
Verbosity: c.String("verbosity"),
Platform: c.String("platform"),
SkipUnusedStages: c.Bool("skip-unused-stages"),
},
Artifact: kaniko.Artifact{
Tags: c.StringSlice("tags"),

@ -37,6 +37,7 @@ type (
NoPush bool // Set this flag if you only want to build the image, without pushing to a registry
Verbosity string // Log level
Platform string // Allows to build with another default platform than the host, similarly to docker build --platform
SkipUnusedStages bool // Build only used stages
}
// Artifact defines content of artifact file
@ -207,6 +208,10 @@ func (p Plugin) Exec() error {
cmdArgs = append(cmdArgs, fmt.Sprintf("--customPlatform=%s", p.Build.Platform))
}
if p.Build.SkipUnusedStages {
cmdArgs = append(cmdArgs, "--skip-unused-stages")
}
cmd := exec.Command("/kaniko/executor", cmdArgs...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr