-
Notifications
You must be signed in to change notification settings - Fork 407
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
Document setting ldflags to embed version into docker image / go binary? #167
Comments
I thought the reproducible builds env var was SOURCE_DATE_EPOCH. I thought we respected that, but I may be mistaken. |
ko does respect SOURCE_DATE_EPOCH but provides no mechanism for injecting the git SHA1 as far as I can tell. Reproducible builds spec says to inject the commit as well, but does not specify the name of the environment variable. |
This was added at some point and never properly documented. I'd bet it's exactly what you want: |
Ah yes! That is exactly what I wanted! Oh thanks! I am updating the ticket to clarify that this issue should be for documenting that. |
This section never actually worked in ko. See ko-build/ko#167 We don't appear to be setting the ldflags anywhere else, so maybe we don't need them?
This section never actually worked in ko. See ko-build/ko#167 We don't appear to be setting the ldflags anywhere else, so maybe we don't need them?
This issue is stale because it has been open for 90 days with no |
Even more updated: It turns out that the update below never worked.
GOFLAGS
is the only way to set the ldflags at present. Still need to document this fact somewhere to show how to embed git commit SHA1 into docker image / go binary:Update: This issue should now be to document how to set the ldflags to embed git commit SHA1 into docker image / go binary. ~~Use baseBuildOverrides as below.~~The below snippet does not work, and never has:
We are committed to embedding the SOURCE_COMMIT into both our Docker images and the go binaries built into them. How would we translate that to using ko?
— From reproducible builds version information
Currently we
export SOURCE_COMMIT=$(git rev-parse HEAD)
and in ourDockerfile
we do:The go apps standardly support
-version
flag to spit out the metadata so we can debug build pipeline problems.The text was updated successfully, but these errors were encountered: