Closed houshengbo closed 5 months ago
@nmittler possibly related to some of your recent go flag changes? Can you take a look?
To repro use the env-var
export KO_FLAGS="--platform=linux/amd64"
Yeah git bisect shows
2a4c12f410f678ee72c2dcd8036ceb1b9b113c10 is the first bad commit
commit 2a4c12f410f678ee72c2dcd8036ceb1b9b113c10
Author: Nathan Mittler <nmittler@aviatrix.com>
Date: Wed May 15 13:16:12 2024 -0700
Add global flags and ldflags
Fixes #1304
docs/configuration.md | 25 ++++++++++++++
pkg/build/gobuild.go | 50 ++++++++++++++++++---------
pkg/build/gobuild_test.go | 49 ++++++++++++++++++++++++++
pkg/build/options.go | 16 +++++++++
pkg/commands/options/build.go | 20 ++++++++---
pkg/commands/options/build_test.go | 23 +++++++++---
pkg/commands/options/testdata/config/.ko.yaml | 5 +++
pkg/commands/resolver.go | 2 ++
8 files changed, 165 insertions(+), 25 deletions(-)
bisect found first bad commit
hmm ... possibly https://github.com/ko-build/ko/pull/1314? In pkg/commands/options/build.go
I added v.GetStringSlice("flags")
. Not sure if this is interacting with KO_FLAGS
?
Actually .. is KO_FLAGS
even an environment variable that ko previously supported? Maybe a viper thing?
Yeah
On Fri, May 17, 2024 at 12:35 Nathan Mittler @.***> wrote:
Actually .. is KO_FLAGS even an environment variable that ko previously supported?
— Reply to this email directly, view it on GitHub https://github.com/ko-build/ko/issues/1317#issuecomment-2117969650, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAERARZTMI2XEFRBA3SBRDZCYWWDAVCNFSM6AAAAABH4IRAQSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJXHE3DSNRVGA . You are receiving this because you commented.Message ID: @.***>
Unfortunately, I'm definitely not a viper expert :). I'm guessing that <EnvPrefix>_FLAGS
is a default variable exposed and used by viper, but I don't see it mentioned in the docs. Any links on how this works?
Actually sorry I made a mistake - KO_FLAGS
is not a ko
thing. I guess in your commit you're now reading it for some reason.
I guess when you added that GetStringSlice it prepends KO
in front of the envvar - https://github.com/ko-build/ko/blame/bb99eccfe235e7b583c857bb1bafbf45f72178d1/pkg/commands/options/build.go#L112
maybe you should rename the flag? eg. go_flags
or something? Then it can be set using KO_GO_FLAGS
likewise with the ldflags
- since those are go build
specific
@dprotaso yeah, that's was my thought as well. Will send a PR shortly.
0.15.3 has breaking issues
https://github.com/knative/serving/actions/runs/9127229170/job/25097079749?pr=15219