Skip to content

Conversation

@rosenhouse
Copy link
Contributor

@rosenhouse rosenhouse commented Oct 28, 2025

This addresses #757 by adding an new --ignore-bundle-check flag to imgpkg copy. That enables shallow-copying a bundle, by treating it like an opaque image.

e.g.

imgpkg copy --ignore-bundle-check -i 'example.com/my-bundle:foo' --to-repo 'destination.corp/a-shallow-copy'

It also works with --to-tar (destination) and --tar (source) and with and without --cosign-signatures although I didn't add tests specifically for those bits.

Update: originally this flag was --image-is-bundle-check (default true) to match the analogous flag on pull. After review, it is now named --ignore-bundle-check (default false) to make it more clear.

@rosenhouse
Copy link
Contributor Author

rosenhouse commented Oct 29, 2025

Failing tests might get fixed by #756 ? Update: rebased on main, hoping that fixes CI.

Signed-off-by: Gabe Rosenhouse <gabriel.rosenhouse@broadcom.com>
Copy link
Member

@joaopapereira joaopapereira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I added 2 comments, do you think you can address them?

}

o.ImageFlags.SetCopy(cmd)
cmd.Flags().BoolVar(&o.ImageIsBundleCheck, "image-is-bundle-check", true, "Error when image is a bundle (disable shallow-copying bundles via -i)")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I like the phrasing here, I know that we used the same verbiage in other places but it feels hard to understand. What do you think about ignore-bundle-check and for the helper text maybe When using -i imgpkg will not check if the image is a bundle. This will allow shallow-copying the bundle image.?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is clearer. Updated.

return nil, nil, err
}
if ok {
if ok && !opts.AllowShallowCopyBundle {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that v1 serves as an API I think we should have a test to ensure the API is working as expected and not only rely on the e2e tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I've added cases in pkg/imgpkg/v1/copy_test.go within the ToTar test , to cover the success case and the missing-flag case. Let me know if I should add similar cases to ToRepo or elsewhere.

@github-project-automation github-project-automation bot moved this to In Progress in Carvel Nov 5, 2025
Signed-off-by: Gabe Rosenhouse <gabriel.rosenhouse@broadcom.com>
Signed-off-by: Gabe Rosenhouse <gabriel.rosenhouse@broadcom.com>
Copy link
Member

@joaopapereira joaopapereira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
The only thing that I am not a fan of is for the API to return errors that only make sense for the CLI, but I guess that is a bigger issues that we have to address in other places as well.

@joaopapereira joaopapereira merged commit e2cab5f into carvel-dev:develop Nov 6, 2025
7 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Closed in Carvel Nov 6, 2025
@rosenhouse rosenhouse deleted the gabe/shallow-copy-bundle branch November 6, 2025 21:19
@rosenhouse
Copy link
Contributor Author

Thanks!

@github-actions github-actions bot added the carvel triage This issue has not yet been reviewed for validity label Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

carvel triage This issue has not yet been reviewed for validity

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants