Skip to content

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

Merged
imjasonh merged 4 commits intogoogle:mainfrom
thesayyn:append_oci
Aug 17, 2022
Merged

fix: consider base image media type when appending layers#1437
imjasonh merged 4 commits intogoogle:mainfrom
thesayyn:append_oci

Conversation

@thesayyn
Copy link
Copy Markdown
Contributor

@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
Copy Markdown
Contributor

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
Copy Markdown
Contributor 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
Copy Markdown
Contributor

--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
Copy Markdown
Contributor 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
Copy Markdown
Contributor Author

fixed the unit test. should be ready now

return nil, fmt.Errorf("getting base image: %w", err)
}

if base == nil {
Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor 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
Copy Markdown
Contributor 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
Copy Markdown

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