system-reset: use CleanCacheMount to clear build cache

Just like buildkit buildah must allow cleaning the buildcache and cache generated on host by --mount=type=cache just like buildkit's prune command.

See: https://github.com/moby/buildkit#cache

Signed-off-by: Aditya R <arajan@redhat.com>
This commit is contained in:
Aditya R
2023-02-02 14:26:36 +05:30
parent 5ca35d6de7
commit 9e7f1bea42
4 changed files with 30 additions and 0 deletions

View File

@ -874,4 +874,20 @@ RUN ls /dev/test1`, ALPINE)
build.WaitWithDefaultTimeout()
Expect(build).To(Exit(0))
})
It("podman system reset must clean host shared cache", func() {
SkipIfRemote("podman-remote does not have system reset -f")
podmanTest.AddImageToRWStore(ALPINE)
session := podmanTest.Podman([]string{"build", "--pull-never", "--file", "build/cache/Dockerfilecachewrite", "build/cache/"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"system", "reset", "-f"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"build", "--pull-never", "--file", "build/cache/Dockerfilecacheread", "build/cache/"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(1))
})
})