diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-10-12 19:32:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-12 19:32:10 +0200 |
commit | 214c13da0a3958e001835288488d24f933337519 (patch) | |
tree | 6f1d67247500c982fdfb61b833d6a66925000683 | |
parent | 2905bc351b6ba9d1565584cb7dfd07cc2522f5c5 (diff) | |
parent | ab8fb3876d25efa2196dbea9d6e07e3ea6493c23 (diff) | |
download | podman-214c13da0a3958e001835288488d24f933337519.tar.gz podman-214c13da0a3958e001835288488d24f933337519.tar.bz2 podman-214c13da0a3958e001835288488d24f933337519.zip |
Merge pull request #11932 from flouthoc/build-prune
builder: Add support for builder prune
-rw-r--r-- | cmd/podman/images/buildx.go | 11 | ||||
-rw-r--r-- | cmd/podman/images/prune.go | 5 | ||||
-rw-r--r-- | test/e2e/images_test.go | 21 |
3 files changed, 32 insertions, 5 deletions
diff --git a/cmd/podman/images/buildx.go b/cmd/podman/images/buildx.go index 5c8e5aaa0..2577a3a74 100644 --- a/cmd/podman/images/buildx.go +++ b/cmd/podman/images/buildx.go @@ -14,11 +14,12 @@ var ( // If we are adding new buildx features, we will add them by default // to podman build. buildxCmd = &cobra.Command{ - Use: "buildx", - Short: "Build images", - Long: "Build images", - RunE: validate.SubCommandExists, - Hidden: true, + Use: "buildx", + Aliases: []string{"builder"}, + Short: "Build images", + Long: "Build images", + RunE: validate.SubCommandExists, + Hidden: true, } ) diff --git a/cmd/podman/images/prune.go b/cmd/podman/images/prune.go index 6c39e5c69..fc7451c41 100644 --- a/cmd/podman/images/prune.go +++ b/cmd/podman/images/prune.go @@ -36,6 +36,11 @@ var ( func init() { registry.Commands = append(registry.Commands, registry.CliCommand{ Command: pruneCmd, + Parent: buildxCmd, + }) + + registry.Commands = append(registry.Commands, registry.CliCommand{ + Command: pruneCmd, Parent: imageCmd, }) diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go index b4ec7447e..56af64f04 100644 --- a/test/e2e/images_test.go +++ b/test/e2e/images_test.go @@ -446,4 +446,25 @@ RUN > file2 }) + It("podman builder prune", func() { + dockerfile := `FROM quay.io/libpod/alpine:latest +RUN > file +` + dockerfile2 := `FROM quay.io/libpod/alpine:latest +RUN > file2 +` + podmanTest.BuildImageWithLabel(dockerfile, "foobar.com/workdir:latest", "false", "abc") + podmanTest.BuildImageWithLabel(dockerfile2, "foobar.com/workdir:latest", "false", "xyz") + // --force used to to avoid y/n question + result := podmanTest.Podman([]string{"builder", "prune", "--filter", "label=abc", "--force"}) + result.WaitWithDefaultTimeout() + Expect(result).Should(Exit(0)) + Expect(len(result.OutputToStringArray())).To(Equal(1)) + + //check if really abc is removed + result = podmanTest.Podman([]string{"image", "list", "--filter", "label=abc"}) + Expect(len(result.OutputToStringArray())).To(Equal(0)) + + }) + }) |