Skip to content

[WIP] Verify images in manifest list are not dangling and pruned #25562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ $(IN_CONTAINER): %-in-container:
$(PODMANCMD) run --rm --env HOME=/root \
-v $(CURDIR):/src -w /src \
--security-opt label=disable \
docker.io/library/golang:1.22 \
docker.io/library/golang:1.23 \
make $(*)


Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,5 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
tags.cncf.io/container-device-interface/specs-go v1.0.0 // indirect
)

replace github.com/containers/common => github.com/rhatdan/common v0.47.1-0.20250318135319-2242b2e1f465
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ github.com/containernetworking/plugins v1.6.2 h1:pqP8Mq923TLyef5g97XfJ/xpDeVek4y
github.com/containernetworking/plugins v1.6.2/go.mod h1:SP5UG3jDO9LtmfbBJdP+nl3A1atOtbj2MBOYsnaxy64=
github.com/containers/buildah v1.39.1-0.20250321123219-bc4d7eb70fe3 h1:F5qpz8HsQ/nxhArveDEgskbyOjFuSsEahevt4JHAePQ=
github.com/containers/buildah v1.39.1-0.20250321123219-bc4d7eb70fe3/go.mod h1:kCk5Le5CiMazPfGhF8yg43LQa1YLKqBZNnI4PTq+W/U=
github.com/containers/common v0.62.3-0.20250321171839-dbeb17e40c80 h1:U605lFaEyA0zsy4+gqZxth9V2Dl1UXBfcamA3cnQ33E=
github.com/containers/common v0.62.3-0.20250321171839-dbeb17e40c80/go.mod h1:IW8fUkTIwJkeclyROeASOV5FvFBpHjtQj/XBXffhuBk=
github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg=
github.com/containers/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I=
github.com/containers/gvisor-tap-vsock v0.8.4 h1:z7MqcldnXYGaU6uTaKVl7RFxTmbhNsd2UL0CyM3fdBs=
Expand Down Expand Up @@ -438,6 +436,8 @@ github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVho
github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI=
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/rhatdan/common v0.47.1-0.20250318135319-2242b2e1f465 h1:aV/PjGzklc+iNdy86HriZ/yQ25h5sctFOFIy8O9inIs=
github.com/rhatdan/common v0.47.1-0.20250318135319-2242b2e1f465/go.mod h1:l7TYE/GilpOcGkrErMCRHfvUnftyhjUGrSL/0gYad0M=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
Expand Down
2 changes: 1 addition & 1 deletion pkg/domain/infra/abi/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ func (ir *ImageEngine) Tree(ctx context.Context, nameOrID string, opts entities.
if err != nil {
return nil, err
}
tree, err := image.Tree(opts.WhatRequires)
tree, err := image.Tree(ctx, opts.WhatRequires)
if err != nil {
return nil, err
}
Expand Down
26 changes: 26 additions & 0 deletions test/system/012-manifest.bats
Original file line number Diff line number Diff line change
Expand Up @@ -324,4 +324,30 @@ function manifestListAddArtifactOnce() {
manifestListAddArtifactOnce
done
}

@test "manifest list images should not be marked as dangling" {
# build image and attach it to a manifest list
mlist=m-$(safename)
run_podman build -q -f - <<< "from scratch"
iid=${output}
run_podman manifest create ${mlist} ${iid}

# verify image is not dangling, and is not remove via prune
run_podman images --filter dangling=true
assert "$output" != "sha256:${iid}" "Verify the filter dangling does not list the image"
run_podman image prune --force
assert "$output" != "${iid}" "Verify the prune does not remove the non dangling image"
run_podman image exists ${iid}

# Remove manifes
run_podman manifest rm ${mlist}

# verify the image is now dangling, and is removed via prune
run_podman images -q --filter dangling=true --no-trunc
assert "$output" == "sha256:${iid}" "Verify the filter dangling does list the image"
run_podman image prune --force
assert "$output" == "${iid}" "Verify that prune does not remove the dangling image"
run_podman 1 image exists ${iid}
}

# vim: filetype=sh
33 changes: 2 additions & 31 deletions vendor/github.com/containers/common/libimage/copier.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/containers/common/libimage/history.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 15 additions & 6 deletions vendor/github.com/containers/common/libimage/image.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions vendor/github.com/containers/common/libimage/image_tree.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/containers/common/libimage/import.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 26 additions & 5 deletions vendor/github.com/containers/common/libimage/layer_tree.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions vendor/github.com/containers/common/libimage/load.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading