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

Unconditionally set the base image annotation. #745

Merged
merged 2 commits into from
Jul 5, 2022

Conversation

mattmoor
Copy link
Collaborator

@mattmoor mattmoor commented Jul 3, 2022

Previously we only set this annotation when our base image was a tag, but this means when folks actually follow the best practice of use digest base images they get strictly worse resulting images!

It sounds like maybe the original motivation for this condition was that it was supposed to contain the mutable reference (tag), but I don't see anything detailing such a restriction (just an example), so there should be nothing
precluding this from the spec.

Previously we only set this annotation when our base image was a tag, but this means when folks actually follow the best practice of use digest base images they get strictly worse resulting images!

It sounds like maybe the original motivation for this condition was that it was supposed to contain the mutable reference (tag), but I don't see anything detailing such a restriction (just an example), so there should be nothing
precluding this from the spec.
@mattmoor
Copy link
Collaborator Author

mattmoor commented Jul 3, 2022

This also supports: #744

@codecov-commenter
Copy link

Codecov Report

Merging #745 (195c844) into main (d17aca8) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #745      +/-   ##
==========================================
- Coverage   51.38%   51.35%   -0.03%     
==========================================
  Files          44       44              
  Lines        3295     3293       -2     
==========================================
- Hits         1693     1691       -2     
  Misses       1390     1390              
  Partials      212      212              
Impacted Files Coverage Δ
pkg/build/gobuild.go 61.34% <100.00%> (-0.11%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d17aca8...195c844. Read the comment docs.

if _, ok := baseRef.(name.Tag); ok {
anns[specsv1.AnnotationBaseImageName] = baseRef.Name()
}
anns[specsv1.AnnotationBaseImageName] = baseRef.Name()
Copy link
Member

Choose a reason for hiding this comment

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

The nittiest of nits: can you just put this in the map initialization expression above, with the other one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

@mattmoor mattmoor requested a review from imjasonh July 4, 2022 17:15
@mattmoor mattmoor merged commit 787d625 into ko-build:main Jul 5, 2022
@mattmoor mattmoor deleted the remove-annotation-condition branch July 5, 2022 18:17
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.

3 participants