diff --git a/cmd/build.go b/cmd/build.go index 0cb22421..93c1becd 100644 --- a/cmd/build.go +++ b/cmd/build.go @@ -60,7 +60,6 @@ Build packages specifying multiple definition trees: $ luet build --tree overlay/path --tree overlay/path2 utils/yq ... `, PreRun: func(cmd *cobra.Command, args []string) { - viper.BindPFlag("clean", cmd.Flags().Lookup("clean")) viper.BindPFlag("tree", cmd.Flags().Lookup("tree")) viper.BindPFlag("destination", cmd.Flags().Lookup("destination")) viper.BindPFlag("backend", cmd.Flags().Lookup("backend")) @@ -87,7 +86,6 @@ Build packages specifying multiple definition trees: }, Run: func(cmd *cobra.Command, args []string) { - clean := viper.GetBool("clean") treePaths := viper.GetStringSlice("tree") dst := viper.GetString("destination") concurrency := LuetCfg.GetGeneral().Concurrency @@ -172,7 +170,6 @@ Build packages specifying multiple definition trees: opts := compiler.NewDefaultCompilerOptions() opts.SolverOptions = *LuetCfg.GetSolverOptions() opts.ImageRepository = imageRepository - opts.Clean = clean opts.PullFirst = pull opts.KeepImg = keepImages opts.Push = push @@ -306,7 +303,6 @@ func init() { if err != nil { Fatal(err) } - buildCmd.Flags().Bool("clean", true, "Build all packages locally without considering the packages present or images available") buildCmd.Flags().StringSliceP("tree", "t", []string{}, "Path of the tree to use.") buildCmd.Flags().String("backend", "docker", "backend used (docker,img)") buildCmd.Flags().Bool("privileged", false, "Privileged (Keep permissions)") diff --git a/pkg/compiler/compiler.go b/pkg/compiler/compiler.go index 36fcae1f..cc4e959b 100644 --- a/pkg/compiler/compiler.go +++ b/pkg/compiler/compiler.go @@ -67,7 +67,6 @@ func NewLuetCompiler(backend CompilerBackend, db pkg.PackageDatabase, opt *Compi CompressionType: opt.CompressionType, KeepImg: opt.KeepImg, Concurrency: opt.Concurrency, - Clean: opt.Clean, Options: *opt, SolverOptions: solvopts, } @@ -505,14 +504,14 @@ func (cs *LuetCompiler) compileWithImage(image, buildertaggedImage, packageImage keepPermissions, keepImg bool, p CompilationSpec, generateArtifact bool) (Artifact, error) { - if !cs.Clean { - exists := cs.Backend.ImageExists(buildertaggedImage) && cs.Backend.ImageExists(packageImage) + if !generateArtifact { + exists := cs.Backend.ImageExists(packageImage) if art, err := LoadArtifactFromYaml(p); err == nil && exists { // If YAML is correctly loaded, and both images exists, no reason to rebuild. Debug("Artifact reloaded from YAML. Skipping build") return art, err } - available := cs.Backend.ImageAvailable(buildertaggedImage) && cs.Backend.ImageAvailable(packageImage) - if (exists || available) && !generateArtifact { + available := cs.Backend.ImageAvailable(packageImage) + if exists || available { return &PackageArtifact{}, nil } } diff --git a/pkg/compiler/interface.go b/pkg/compiler/interface.go index 3efc73a8..1263ea2f 100644 --- a/pkg/compiler/interface.go +++ b/pkg/compiler/interface.go @@ -49,7 +49,6 @@ type CompilerOptions struct { PullFirst, KeepImg, Push bool Concurrency int CompressionType CompressionImplementation - Clean bool KeepImageExport bool OnlyDeps bool @@ -68,7 +67,6 @@ func NewDefaultCompilerOptions() *CompilerOptions { CompressionType: None, KeepImg: true, Concurrency: runtime.NumCPU(), - Clean: true, OnlyDeps: false, NoDeps: false, }