Skip to content

Copy to tar and back to repository doesn't always work #499

@joaopapereira

Description

@joaopapereira

What steps did you take:
This is a little bit of an edge case where an image is shared between bundles which are nested bundles and only 1 of these bundles are collocated. This is more or less the diagram of the use case

repo1/-shared-img

repo2/
   bundle-1
   -shared-img

repo3/
   bundle-2
   -shared-img
   bundle-3 (This points to repo2 bundle1 and bundle2)

To accomplish this we can do
1- Create one bundle with 1 image from repo1
2- Create a second bundle with the same image from repo1
3- Create a bundle on repo3 that points to both the previous bundles
4- imgpkg copy the bundle created in step 1 to the same repo as the bundle created in step 3

After this setup the issue can be triggered doing the following

1- Copy bundle from step 3 to tar
2- imgpkg copy the tar to a new repository

What happened:
imgpkg panics

panic: Expected: 1 images to be written to Location OCI. Actual: 0 were written

goroutine 1 [running]:
github.com/vmware-tanzu/carvel-imgpkg/pkg/imgpkg/bundle.(*Bundle).NoteCopy(0xc00041e0a0, 0xc00026a600?, {0x29bfdc18, 0xc0000cb500}, {0x18969e0, 0xc000010cf0?})
	github.com/vmware-tanzu/carvel-imgpkg/pkg/imgpkg/bundle/bundle.go:161 +0x8a9
github.com/vmware-tanzu/carvel-imgpkg/pkg/imgpkg/cmd.CopyRepoSrc.CopyToRepo({{{0x0, 0x0}}, {{0x0, 0x0}}, {{0x0, 0x0}}, {{0x7ff7bfeff70d, 0x52}, {0x0, 0x0}, ...}, ...}, ...)
	github.com/vmware-tanzu/carvel-imgpkg/pkg/imgpkg/cmd/copy_repo_src.go:103 +0xa46
github.com/vmware-tanzu/carvel-imgpkg/pkg/imgpkg/cmd.(*CopyOptions).Run(0xc0000c90e0)
	github.com/vmware-tanzu/carvel-imgpkg/pkg/imgpkg/cmd/copy.go:156 +0x918
github.com/vmware-tanzu/carvel-imgpkg/pkg/imgpkg/cmd.NewCopyCmd.func1(0xc0000d7c60?, {0xc000099360?, 0xc0001a3ef8?, 0xc0001dc400?})
	github.com/vmware-tanzu/carvel-imgpkg/pkg/imgpkg/cmd/copy.go:49 +0x1d
github.com/cppforlife/cobrautil.WrapRunEForCmd.func1.1(0x0?, {0xc000099360, 0x0, 0x5})
	github.com/cppforlife/cobrautil@v0.0.0-20221021151949-d60711905d65/misc.go:45 +0x6d
github.com/cppforlife/cobrautil.WrapRunEForCmd.func1.1(0x0?, {0xc000099360, 0x0, 0x5})
	github.com/cppforlife/cobrautil@v0.0.0-20221021151949-d60711905d65/misc.go:45 +0x6d
github.com/cppforlife/cobrautil.WrapRunEForCmd.func1.1(0xc000212900?, {0xc000099360, 0x0, 0x5})
	github.com/cppforlife/cobrautil@v0.0.0-20221021151949-d60711905d65/misc.go:45 +0x6d
github.com/spf13/cobra.(*Command).execute(0xc000212900, {0xc000099310, 0x5, 0x5})
	github.com/spf13/cobra@v1.6.1/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0xc000005b00)
	github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3bd
github.com/spf13/cobra.(*Command).Execute(0x17966b7?)
	github.com/spf13/cobra@v1.6.1/command.go:968 +0x19
main.main()
	github.com/vmware-tanzu/carvel-imgpkg/cmd/imgpkg/imgpkg.go:35 +0x105

What did you expect:
[A description of what was expected]

Anything else you would like to add:
The Root Cause problem is that when copying images from tar, imgpkg does not use the same path to generate an internal cache of the processed images that we are currently using in the copy from the repository to the repository. So when imgpkg is trying to create the ImagesLocation image and tries to see if the image will have all the needed images associated with the bundle it does not.
The bundle cache points to an OCI image in one repository but when we read the images from the tar the Ref present is from a different repository.

Environment:

  • imgpkg version (use imgpkg --version): 0.36.0
  • Docker registry used (e.g. Docker HUB): All
  • OS (e.g. from /etc/os-release): All

Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help work on this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue describes a defect or unexpected behaviorcarvel acceptedThis issue should be considered for future work and that the triage process has been completed

    Type

    No type

    Projects

    Status

    Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions