Add --single-snapshot flag to snapshot once after the build

This commit is contained in:
Priya Wadhwa
2018-06-13 11:22:12 -07:00
parent e18ef26a6c
commit 89c9f15bde
3 changed files with 39 additions and 10 deletions
+9 -1
View File
@@ -40,6 +40,7 @@ var (
force bool
buildArgs multiArg
tarPath string
singleSnapshot bool
)
func init() {
@@ -54,6 +55,7 @@ func init() {
RootCmd.PersistentFlags().StringVarP(&logLevel, "verbosity", "v", constants.DefaultLogLevel, "Log level (debug, info, warn, error, fatal, panic")
RootCmd.PersistentFlags().BoolVarP(&force, "force", "", false, "Force building outside of a container")
RootCmd.PersistentFlags().StringVarP(&tarPath, "tarPath", "", "", "Path to save the image in as a tarball instead of pushing")
RootCmd.PersistentFlags().BoolVarP(&singleSnapshot, "single-snapshot", "", false, "Set this flag to take a single snapshot at the end of the build.")
}
var RootCmd = &cobra.Command{
@@ -79,7 +81,13 @@ var RootCmd = &cobra.Command{
logrus.Error(err)
os.Exit(1)
}
ref, image, err := executor.DoBuild(dockerfilePath, srcContext, snapshotMode, buildArgs)
ref, image, err := executor.DoBuild(executor.KanikoBuildArgs{
DockerfilePath: dockerfilePath,
SrcContext: srcContext,
SnapshotMode: snapshotMode,
Args: buildArgs,
SingleSnapshot: singleSnapshot,
})
if err != nil {
logrus.Error(err)
os.Exit(1)