Open imjasonh opened 3 years ago
SGTM. We can use the same thing to annotate with ko version info.
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.
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.