mirror of
https://github.com/containers/podman.git
synced 2025-11-29 09:37:38 +08:00
Merge pull request #27182 from skyraider256526/main
feat: add `--format` flag to artifact inspect
This commit is contained in:
@@ -668,6 +668,20 @@ var _ = Describe("Podman artifact", func() {
|
||||
// Verify we have 2 layers
|
||||
Expect(a.Manifest.Layers).To(HaveLen(2))
|
||||
})
|
||||
|
||||
It("podman artifact inspect with --format", func() {
|
||||
artifact1File, err := createArtifactFile(4192)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
artifact1Name := "localhost/test/artifact1"
|
||||
addArtifact1 := podmanTest.PodmanExitCleanly("artifact", "add", artifact1Name, artifact1File)
|
||||
|
||||
artifactDigest := addArtifact1.OutputToString()
|
||||
|
||||
session := podmanTest.PodmanExitCleanly("artifact", "inspect", artifactDigest, "--format", "{{.Digest}}")
|
||||
Expect(session.OutputToString()).To(Equal("sha256:" + artifactDigest))
|
||||
session = podmanTest.PodmanExitCleanly("artifact", "inspect", artifactDigest[:12], "-f", "{{.Name}}")
|
||||
Expect(session.OutputToString()).To(Equal(artifact1Name))
|
||||
})
|
||||
})
|
||||
|
||||
func digestToFilename(digest string) string {
|
||||
|
||||
@@ -12,6 +12,7 @@ function teardown() {
|
||||
run_podman '?' secret rm "s-$(safename)"
|
||||
run_podman '?' pod rm -f "p-$(safename)"
|
||||
run_podman '?' rm -f -t0 "c-$(safename)"
|
||||
run_podman '?' artifact rm "a-$(safename)"
|
||||
|
||||
basic_teardown
|
||||
}
|
||||
@@ -125,10 +126,12 @@ function check_subcommand() {
|
||||
ctrname="c-$(safename)"
|
||||
podname="p-$(safename)"
|
||||
secretname="s-$(safename)"
|
||||
artifactname="a-$(safename)"
|
||||
# Setup: some commands need a container, pod, secret, ...
|
||||
run_podman run -d --name $ctrname $IMAGE top
|
||||
run_podman pod create $podname
|
||||
run_podman secret create $secretname /etc/hosts
|
||||
run_podman artifact add $artifactname /etc/hosts
|
||||
|
||||
# For 'search' and 'image search': if local cache registry is available,
|
||||
# use it. This bypasses quay, and thus prevents flakes.
|
||||
@@ -147,7 +150,7 @@ image inspect | $IMAGE
|
||||
container inspect | $ctrname
|
||||
inspect | $ctrname
|
||||
|
||||
|
||||
artifact inspect | $artifactname
|
||||
volume inspect | -a
|
||||
secret inspect | $secretname
|
||||
network inspect | podman
|
||||
@@ -200,6 +203,7 @@ stats | --no-stream
|
||||
run_podman rm -f -t0 $ctrname
|
||||
run_podman secret rm $secretname
|
||||
run_podman '?' machine rm -f $machinename
|
||||
run_podman artifact rm $artifactname
|
||||
|
||||
# Make sure there are no leftover commands in our table - this would
|
||||
# indicate a typo in the table, or a flaw in our logic such that
|
||||
|
||||
Reference in New Issue
Block a user