Skip to content
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

fix: consider base image media type when appending layers #1437

Merged
merged 4 commits into from Aug 17, 2022

Conversation

thesayyn
Copy link
Collaborator

@thesayyn thesayyn commented Aug 17, 2022

As discussed with @jonjohnsonjr. We still need to bikeshed name for the new --oci flag.

Closes #1427

@imjasonh
Copy link
Collaborator

How about crane append --oci-empty?

At some point we might have a crane append --oci-layout-path=path/foo to pull and append a layer then write it to a local OCI layout. We should make sure the names don't conflict and get too confusing.

@thesayyn
Copy link
Collaborator Author

At some point we might have a crane append --oci-layout-path=path/foo to pull and append a layer then write it to a local OCI layout. We should make sure the names don't conflict and get too confusing.

I agree.

How about crane append --oci-empty?

This is a bit unclear I think. --oci-empty-base?

@imjasonh
Copy link
Collaborator

--oci-empty-base sounds good. crane should fail if --oci-empty-base is set while -b is set, to be clear it only works when appending to an empty image.

@thesayyn
Copy link
Collaborator Author

--oci-empty-base sounds good. crane should fail if --oci-empty-base is set while -b is set, to be clear it only works when appending to an empty image.

I am not sure why the unit test is failing. do you have any pointers? using go1.19 locally.

@thesayyn
Copy link
Collaborator Author

fixed the unit test. should be ready now

@@ -47,9 +48,25 @@ func Append(base v1.Image, paths ...string) (v1.Image, error) {
return nil, fmt.Errorf("getting base image: %w", err)
}

if base == nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

isWindows checks for img==nil already, we could remove that and put the == nil check before isWindows.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

makes sense.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed it

@codecov-commenter
Copy link

Codecov Report

Merging #1437 (bf9d90b) into main (7196cf3) will decrease coverage by 0.09%.
The diff coverage is 88.00%.

@@            Coverage Diff             @@
##             main    #1437      +/-   ##
==========================================
- Coverage   73.40%   73.31%   -0.10%     
==========================================
  Files         115      115              
  Lines        8757     8772      +15     
==========================================
+ Hits         6428     6431       +3     
- Misses       1688     1696       +8     
- Partials      641      645       +4     
Impacted Files Coverage Δ
pkg/crane/append.go 55.17% <82.35%> (-15.67%) ⬇️
pkg/v1/stream/layer.go 88.05% <100.00%> (+0.38%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@imjasonh imjasonh merged commit 2b54510 into google:main Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

crane: mutate and append adds layer with docker mediaType regardless of what base image uses
3 participants