ko
ko copied to clipboard
Define common build tags to consume in `.ko.yaml`
Since .ko.yaml
is likely going to be used for more CI automation and releasing artifacts, it would be great to have access to common build variables, e.g. date/time
(RFC3339), commit
(short/long) and perhaps (git) tag
instead of having to manually create them in the environment to reference them in .ko.yaml
.
I know this might be out of scope for ko
due to reasons (e.g. relying on git
) but just wanted to throw this out so people can find this issue and an answer why this won't be implemented or if this is something you think is useful for the project.
Since .ko.yaml
is inspired by goreleaser
, we could reuse some of the standard build-related variables/templates (full list here).
Example .ko.yaml
idea:
ldflags:
- -s -w
- -extldflags "-static"
- -X main.commit={{.Env.KO_COMMIT_LONG}}
- -X main.shortCommit={{.Env.KO_COMMIT_SHORT}}
- -X main.buildDate={{.Env.KO_DATETIME}}
This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Keep fresh with the 'lifecycle/frozen' label.
This seems reasonable to me, I just don't know if any current maintainers have any time to prioritize it. Maybe if someone reading this feels like throwing together a PR to get an idea for how it might work, that could be helpful.