mirror of
https://github.com/containers/podman.git
synced 2025-06-28 22:53:21 +08:00
--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:
@ -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() {
|
||||
|
@ -190,12 +190,11 @@ var _ = Describe("Podman build", func() {
|
||||
// Test if entire build is used from cache
|
||||
Expect(session.OutputToString()).To(ContainSubstring("Using cache"))
|
||||
|
||||
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RootFS.Layers}}", "test-squash-d"})
|
||||
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RootFS.Layers}}", "test"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
// Check for one layers
|
||||
Expect(strings.Fields(session.OutputToString())).To(HaveLen(1))
|
||||
|
||||
})
|
||||
|
||||
It("podman build Containerfile locations", func() {
|
||||
|
@ -1110,6 +1110,12 @@ EOF
|
||||
run_podman build -t build_test $tmpdir/link
|
||||
}
|
||||
|
||||
@test "podman build --squash --squash-all should conflict" {
|
||||
echo FROM scratch > $PODMAN_TMPDIR/Dockerfile
|
||||
run_podman 125 build -t build_test --squash-all --squash $PODMAN_TMPDIR
|
||||
is "$output" "Error: cannot specify --squash-all with --squash" "--squash and --sqaush-all should conflict"
|
||||
}
|
||||
|
||||
@test "podman build --volumes-from conflict" {
|
||||
rand_content=$(random_string 50)
|
||||
|
||||
|
Reference in New Issue
Block a user