Skip to content

Commit

Permalink
Unconditionally set the base image annotation. (#745)
Browse files Browse the repository at this point in the history
* Unconditionally set the base image annotation.

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.

* Fold assignment into map initialization.
  • Loading branch information
mattmoor authored Jul 5, 2022
1 parent 809b206 commit 787d625
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions pkg/build/gobuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -889,9 +889,7 @@ func (g *gobuild) Build(ctx context.Context, s string) (Result, error) {

anns := map[string]string{
specsv1.AnnotationBaseImageDigest: baseDigest.String(),
}
if _, ok := baseRef.(name.Tag); ok {
anns[specsv1.AnnotationBaseImageName] = baseRef.Name()
specsv1.AnnotationBaseImageName: baseRef.Name(),
}
base = mutate.Annotations(base, anns).(Result)
}
Expand Down

0 comments on commit 787d625

Please sign in to comment.