Skip to content

Commit

Permalink
history: correctly set tags
Browse files Browse the repository at this point in the history
Requires vendoring fixes from c/common and to update the transformation
code.  Also add a test to avoid future regressions.

Fixes: containers#17763
Signed-off-by: Valentin Rothberg <[email protected]>
  • Loading branch information
vrothberg committed May 2, 2023
1 parent 91da62d commit 9e9bcec
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 19 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/containernetworking/cni v1.1.2
github.com/containernetworking/plugins v1.2.0
github.com/containers/buildah v1.30.0
github.com/containers/common v0.53.0
github.com/containers/common v0.53.1-0.20230502134647-9cd0cc23c80f
github.com/containers/conmon v2.0.20+incompatible
github.com/containers/image/v5 v5.25.0
github.com/containers/libhvee v0.0.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ github.com/containernetworking/plugins v1.2.0 h1:SWgg3dQG1yzUo4d9iD8cwSVh1VqI+bP
github.com/containernetworking/plugins v1.2.0/go.mod h1:/VjX4uHecW5vVimFa1wkG4s+r/s9qIfPdqlLF4TW8c4=
github.com/containers/buildah v1.30.0 h1:mdp2COGKFFEZNEGP8VZ5ITuUFVNPFoH+iK2sSesNfTA=
github.com/containers/buildah v1.30.0/go.mod h1:lyMLZIevpAa6zSzjRl7z4lFJMCMQLFjfo56YIefaB/U=
github.com/containers/common v0.53.0 h1:Ax814cLeX5VXSnkKUdxz762g+27fJj1st4UvKoXmkKs=
github.com/containers/common v0.53.0/go.mod h1:pABPxJwlTE8oYk9/2BW0e0mumkuhJHIPsABHTGRXN3w=
github.com/containers/common v0.53.1-0.20230502134647-9cd0cc23c80f h1:NGr0tr+qnavYQ3m+ajnrCLCp7y/YlGj14OXsYD5RhqY=
github.com/containers/common v0.53.1-0.20230502134647-9cd0cc23c80f/go.mod h1:uG5iTo9KbPxcyj3nsq0OPbBRTrSsrXKIMNRw4D6rt/w=
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/image/v5 v5.25.0 h1:TJ0unmalbU+scd0i3Txap2wjGsAnv06MSCwgn6bsizk=
Expand Down
13 changes: 7 additions & 6 deletions pkg/domain/infra/abi/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,16 @@ func (ir *ImageEngine) Prune(ctx context.Context, opts entities.ImagePruneOption
}

func toDomainHistoryLayer(layer *libimage.ImageHistory) entities.ImageHistoryLayer {
l := entities.ImageHistoryLayer{}
l.ID = layer.ID
l := entities.ImageHistoryLayer{
Comment: layer.Comment,
CreatedBy: layer.CreatedBy,
ID: layer.ID,
Size: layer.Size,
Tags: layer.Tags,
}
if layer.Created != nil {
l.Created = *layer.Created
}
l.CreatedBy = layer.CreatedBy
copy(l.Tags, layer.Tags)
l.Size = layer.Size
l.Comment = layer.Comment
return l
}

Expand Down
4 changes: 2 additions & 2 deletions test/apiv2/10-images.at
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ for i in $iid ${iid:0:12} $PODMAN_TEST_IMAGE_NAME; do
t GET libpod/images/$i/history 200 \
.[0].Id=$iid \
.[0].Created~[0-9]\\{10\\} \
.[0].Tags=null \
.[0].Tags[0]="$IMAGE" \
.[0].Size=0 \
.[0].Comment=
done
Expand All @@ -82,7 +82,7 @@ for i in $iid ${iid:0:12} $PODMAN_TEST_IMAGE_NAME; do
t GET images/$i/history 200 \
.[0].Id="sha256:"$iid \
.[0].Created~[0-9]\\{10\\} \
.[0].Tags=null \
.[0].Tags[0]="$IMAGE" \
.[0].Size=0 \
.[0].Comment=
done
Expand Down
3 changes: 3 additions & 0 deletions test/system/110-history.bats
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ load helpers
while IFS= read -r row; do
is "$row" ".* .*$"
done <<<$output

run_podman history --format "{{.Tags}}" $IMAGE
is "$output" "\[$IMAGE\].*" "podman history sets tags"
}

@test "podman history - json" {
Expand Down

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.

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

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ github.com/containers/buildah/pkg/rusage
github.com/containers/buildah/pkg/sshagent
github.com/containers/buildah/pkg/util
github.com/containers/buildah/util
# github.com/containers/common v0.53.0
# github.com/containers/common v0.53.1-0.20230502134647-9cd0cc23c80f
## explicit; go 1.18
github.com/containers/common/libimage
github.com/containers/common/libimage/define
Expand Down

0 comments on commit 9e9bcec

Please sign in to comment.