-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
use go's built-in runtime arch #2268
use go's built-in runtime arch #2268
Conversation
cmd/operator-sdk/build/cmd.go
Outdated
if value, ok := os.LookupEnv("GOARCH"); ok { | ||
goBuildEnv = append(goBuildEnv, "GOARCH="+value) | ||
} else { | ||
goBuildEnv = append(goBuildEnv, "GOARCH=amd64") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entire section can be removed. goBuildEnv
is setup from the current environment int line 92, so line 95 doesn't actually do anything. Either GOARCH is already set in the environment, or it is unset, in which case go will use the default GOARCH (based on the architecture of the go
binary itself).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also probably need a CHANGELOG update for this change.
I'm thinking a bugfix:
Updates `operator-sdk build` for go operators to compile the operator binary based on Go's built-in GOARCH detection. This fixes an issue that caused an `amd64` binary to be built into non-`amd64` base images when using operator-sdk on non-`amd64` architectures. ([#2268](https://github.com/operator-framework/operator-sdk/pull/2268))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated and tested @joelanford
793bd9c
to
ad82d47
Compare
If the user hasn't explictyly set GOARCH, don't default to amd64. This way, a user has to expliciltly cross-compile, instead of needing to know to set GOARCH on build for a native arch that isn't amd64. Signed-off-by: Christy Norman <christy@linux.vnet.ibm.com>
ad82d47
to
7d7487c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approved for me as well
@joelanford can we merge this one?
I think that I faced problem related and I'd like to test it more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just need to resolve the merge conflict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approved
Test locally with ansible Memcached sample and ios.
All great. 👍
New changes are detected. LGTM label has been removed. |
Merging this one 👍 |
Sorry - was out on vacation. Thanks all! |
If the user hasn't explictyly set GOARCH, don't default to amd64. This way, a user has to expliciltly cross-compile, instead of needing to know to set GOARCH on build for a native arch that isn't amd64. operator-framework/operator-sdk#2268 Signed-off-by: Christy Norman <christy@linux.vnet.ibm.com> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
If the user hasn't explictyly set GOARCH, don't default to amd64. This way, a user has to expliciltly cross-compile, instead of needing to know to set GOARCH on build for a native arch that isn't amd64. operator-framework/operator-sdk#2268 Signed-off-by: Christy Norman <christy@linux.vnet.ibm.com> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
If the user hasn't explictyly set GOARCH, don't default to amd64. This way, a user has to expliciltly cross-compile, instead of needing to know to set GOARCH on build for a native arch that isn't amd64. operator-framework/operator-sdk#2268 Signed-off-by: Christy Norman <christy@linux.vnet.ibm.com> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
If the user hasn't explictyly set GOARCH, don't default to amd64. This
way, a user has to expliciltly cross-compile, instead of needing to know
to set GOARCH on build for a native arch that isn't amd64.
Signed-off-by: Christy Norman christy@linux.vnet.ibm.com
Description of the change:
See #2256
Motivation for the change:
See #2256