From d9aceadeaa478eafd1252201c822e9f5cf72fa02 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Wed, 9 Nov 2022 16:06:05 -0500 Subject: [PATCH] Allow podman manigest push --purge|-p as alias for --rm Signed-off-by: Daniel J Walsh --- cmd/podman/manifest/push.go | 2 ++ cmd/podman/utils/alias.go | 2 -- test/e2e/manifest_test.go | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/podman/manifest/push.go b/cmd/podman/manifest/push.go index 2b4c570a5c..84178358a0 100644 --- a/cmd/podman/manifest/push.go +++ b/cmd/podman/manifest/push.go @@ -47,6 +47,8 @@ func init() { flags := pushCmd.Flags() flags.BoolVar(&manifestPushOpts.Rm, "rm", false, "remove the manifest list if push succeeds") flags.BoolVar(&manifestPushOpts.All, "all", true, "also push the images in the list") + flags.BoolVarP(&manifestPushOpts.Rm, "purge", "p", false, "remove the local manifest list after push") + _ = flags.MarkHidden("purge") authfileFlagName := "authfile" flags.StringVar(&manifestPushOpts.Authfile, authfileFlagName, auth.GetDefaultAuthFile(), "path of the authentication file. Use REGISTRY_AUTH_FILE environment variable to override") diff --git a/cmd/podman/utils/alias.go b/cmd/podman/utils/alias.go index f6ea5110ef..a1ddff4e5b 100644 --- a/cmd/podman/utils/alias.go +++ b/cmd/podman/utils/alias.go @@ -23,8 +23,6 @@ func AliasFlags(f *pflag.FlagSet, name string) pflag.NormalizedName { name = "ns" case "storage": name = "external" - case "purge": - name = "rm" case "notruncate": name = "no-trunc" case "override-arch": diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go index b0a5e7d033..fd2c5c4a10 100644 --- a/test/e2e/manifest_test.go +++ b/test/e2e/manifest_test.go @@ -464,6 +464,10 @@ var _ = Describe("Podman manifest", func() { session = podmanTest.Podman([]string{"manifest", "push", "--purge", "foo", "dir:" + dest}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) + session = podmanTest.Podman([]string{"manifest", "push", "-p", "foo", "dir:" + dest}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(125)) + Expect(session.ErrorToString()).To(ContainSubstring("retrieving local image from image name foo: foo: image not known")) session = podmanTest.Podman([]string{"images", "-q", "foo"}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0))