--squash --layers=false should be allowed

This is the same as what --squash-all is doing, and we already support
--squash with --layers=true since this is the default.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2024-06-10 11:38:11 -04:00
parent e231bf0a46
commit ad8fc6a74b
3 changed files with 9 additions and 5 deletions

View File

@ -136,9 +136,8 @@ func DefineBuildFlags(cmd *cobra.Command, buildOpts *BuildFlagsWrapper, isFarmBu
}
func ParseBuildOpts(cmd *cobra.Command, args []string, buildOpts *BuildFlagsWrapper) (*entities.BuildOptions, error) {
if (cmd.Flags().Changed("squash") && cmd.Flags().Changed("layers")) ||
(cmd.Flags().Changed("squash-all") && cmd.Flags().Changed("squash")) {
return nil, errors.New("cannot specify --squash with --layers and --squash-all with --squash")
if cmd.Flags().Changed("squash-all") && cmd.Flags().Changed("squash") {
return nil, errors.New("cannot specify --squash-all with --squash")
}
if cmd.Flag("output").Changed && registry.IsRemote() {