ko icon indicating copy to clipboard operation
ko copied to clipboard

Annotate images with version control information by default

Open imjasonh opened this issue 3 years ago • 3 comments

Similar to (and possibly to be built upon) https://github.com/golang/go/issues/37475

Images built by ko can automatically be annotated with information about the commit of the source the image was built from. This would help tie the image to the source that created it. This information would include the commit digest, and whether there are any additional uncommitted changes on top of that commit (a "dirty bit").

https://github.com/golang/go/issues/37475 proposes adding this metadata to Go binaries themselves, whereupon ko could inspect and extract this information. I don't think ko should duplicate this logic itself, especially if Go wants to do it for us.

We should consider some way to disable the annotation, if users don't want to include it for some reason, or possibly just document that we will set it, and that users should scrub this information if they want to.

imjasonh avatar May 18 '21 15:05 imjasonh

SGTM. We can use the same thing to annotate with ko version info.

jonjohnsonjr avatar May 18 '21 15:05 jonjohnsonjr

See https://github.com/google/ko/issues/221

imjasonh avatar May 18 '21 15:05 imjasonh

https://github.com/golang/go/issues/37475 is now implemented, and should be released with Go 1.18. After that, we can have ko check for the existence of stamped vcs information in the built binary, and add annotations/labels to the image by default.

imjasonh avatar Oct 26 '21 13:10 imjasonh