Saving bundles as an intermediate ocitar#612
Saving bundles as an intermediate ocitar#612ashpect wants to merge 20 commits intocarvel-dev:developfrom
Conversation
Signed-off-by: ashpect <ashishndiitr@gmail.com>
Signed-off-by: ashpect <ashishndiitr@gmail.com>
Signed-off-by: ashpect <ashishndiitr@gmail.com>
Signed-off-by: ashpect <ashishndiitr@gmail.com>
joaopapereira
left a comment
There was a problem hiding this comment.
Thanks for the PR, made some comments in the code.
On a more generic note:
- We need to add some tests to this new feature
- Can we use ggcr to read/write the tarballs for us, since this is a regular OCI tar we should be able to use something like https://github.com/google/go-containerregistry/tree/main/pkg/v1/tarball to do this work.
- In terms of form, I think I would prefer us to provide variables like
ociTarPathto the Push functions instead of providing them to the constructors since that has been the pattern we have been using. The idea here is that when you call the function you choose the Repository/location where you want to store the result. Another option that might make more sense here is instead of calling NewContents().Push maybe we should have a new function function called NewContents().PushToTar() since we do not need the majority of the code in Push because we are not building tags or writing them
| processedImages, err = c.tarImageSet.Import(tempDir, importRepo, c.registry, true) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("Importing OCI tar: %s", err) | ||
| } |
There was a problem hiding this comment.
Since this is similar to the else case, maybe we can move this outside the if statement
| if err != nil { | ||
| return nil, err | ||
| } | ||
| err = image.ExtractOciTarGz(c.OciFlags.OcitoReg, tempDir) |
There was a problem hiding this comment.
Let us make sure we clean up after ourselves
| err = image.ExtractOciTarGz(c.OciFlags.OcitoReg, tempDir) | |
| defer os.RemoveAll(tempDir) | |
| err = image.ExtractOciTarGz(c.OciFlags.OcitoReg, tempDir) |
pkg/imgpkg/cmd/copy_repo_src.go
Outdated
There was a problem hiding this comment.
Is this commented out because if we copy from oci-tar to the repository, we do not have all the images? If that is the case, we should change the comment to highlight something like:
// When copying images from an oci-tar to a repository, imgpkg will not try to access the origin repositories and will only copy the OCI Image to the registry, similar to the behavior we currently have on the `imgpkg push` command.
pkg/imgpkg/cmd/copy_repo_src.go
Outdated
There was a problem hiding this comment.
Added a prior comment that I think it would be better to use than this part of the code. Because if anything fails in the meanwhile we will leave the folder back
| err = os.RemoveAll(tempDir) | |
| if err != nil { | |
| fmt.Println("Error cleaning up temporary directory:", err) | |
| } |
pkg/imgpkg/cmd/oci_flags.go
Outdated
There was a problem hiding this comment.
| // Copyright 2023 The Carvel Authors. | |
| // Copyright 2024 The Carvel Authors. |
pkg/imgpkg/image/tar_image.go
Outdated
pkg/imgpkg/image/tar_image.go
Outdated
There was a problem hiding this comment.
Why are we deleting the source folder?
If I do imgpkg push -b repo/app1-config -f config/ --to-oci-tar /path/to/file.tar is my config folder going to be deleted? We should not do that
pkg/imgpkg/image/tar_image.go
Outdated
There was a problem hiding this comment.
| // Copyright 2023 The Carvel Authors. | |
| // Copyright 2024 The Carvel Authors. |
Signed-off-by: ashpect <ashishndiitr@gmail.com>
|
@ashpect , could i request you to rebase and send for review again. (unfortunately, it will not be a straight forward rebase) |
|
Yes, sure. I will get to it this upcoming week. |

Implements this proposal.
Implemented except writing the tests, waiting for initial review, after which e2e tests can be written.