-
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
Refactor global values to be defaults #1318
Conversation
The integration test I added does seem to indicate that the original error is gone. However, it fails on my m1 macbook. with:
The test should be using the I can't see how my recent changes could be related, however. |
It's not - so knative uses this in our scripts and we invoke Hence why I think it might be better to be more descriptive with the flags. eg. |
Ah, that makes sense ... I apparently missed your comment on the issue where you clarified this. But given that ko is effectively reserving the I'm a little concerned with defaultBaseImage: ...
defaultPlatforms:
- linux/arm64
- linux/amd64
goBuildEnv:
- FOO=bar
goBuildFlags:
- -v
goBuildLdflags:
- -s
builds:
- id: foo
dir: .
main: ./foobar/foo
flags:
- -trimpath
ldflags:
- -w
... This seems to break the naming convention that was established with From the perspective of ko, just sticking with the Thoughts? |
35e1087
to
9500660
Compare
Any concerns about the breaking changes in this PR? I think regardless which way we go, something will break between 0.15.3 and 0.15.4. Alternatively, we could just patch the immediate issue by using viper's |
There was recent work to add global values for `env`, `flags`, and `ldflags`. The global values would be merged with per-build values to generate the value used for the builds. There are a couple issues with this: - It's inconsistent with the existing code, which only has `default` values declared globally (there is no merging today). - The name of the `flag` variable, caused a conflict with knative's `KO_FLAGS` environment variable (see ko-build#1317) This PR does the following: - Refactors the logic to use `defaultEnv`, `defaultFlags`, and `defaultLdflags`. This resolves both issues described above. - Updates documentation Fixes ko-build#1317
I'm comfortable breaking behavior from 0.15.3 -> 0.15.4, since it's very unlikely anybody has come to rely on it during that short window. (If you're here because you came to rely on it during that short window, I'm sorry, I owe you a beer! 🍻 ) |
There was recent work to add global values for
env
,flags
, andldflags
. The global values would be merged with per-build values to generate the value used for the builds.There are a couple issues with this:
default
values declared globally (there is no merging today).flag
variable, caused a conflict with knative'sKO_FLAGS
environment variable (see 0.15.3 has breaking issues error resolving image references: build: go build: exit status 2: flag provided but not defined: -platform #1317)This PR does the following:
defaultEnv
,defaultFlags
, anddefaultLdflags
. This resolves both issues described above.Fixes #1317