Uh oh!
There was an error while loading. Please reload this page.
auto-detect build runtime arch - #2256
Conversation
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>
There was a problem hiding this comment.
It shows perfect fine for me 👍
The CI will check this command for all types. See here
So, since it passed all still working.
Just a nit.: It is missing an entry in the CHANGELOG.
Could you please add it?
joelanford
commented
Nov 22, 2019
The code to explicitly set GOARCH to amd64 has been around for awhile, and I'm not sure of the origins of that. If I had to guess, the originial reasoning is that Obviously that isn't always true (like in your case), but if we make this change, we could break a lot of other users that build from one architecture and target another for their operator deployments. /hold @AlexNPavel@hasbro17@estroz any thoughts on this? |
estroz
commented
Nov 24, 2019
@joelanford@clnperez yes that is why |
hasbro17
commented
Nov 25, 2019
Ditto to not breaking existing behavior if we can mitigate this by setting |
camilamacedo86
left a comment
There was a problem hiding this comment.
Could please you check the review comments?
Hm. So -- when you do the build on a non-AMD arch, you still get the outer container for the arch you're on b/c the UBI images are using manifest lists. How would, for example, you keep from getting an arm image with a AMD binary? IOW -- what is the build procedure/use-case we'd be breaking exactly? |
clnperez
commented
Nov 25, 2019
Oops. Typo there ^ (edited). ARM image with an AMD binary. |
@clnperez users may not be building the operator binary on an amd64 system (operator-sdk builds directly on the host), so following current workflows after changing to the suggested behavior could cause runtime errors when running the binary in a container created from the default base image. We currently provide the ability to set |
clnperez
commented
Nov 25, 2019
@estroz I guess I'm trying to say that the default base image isn't an x86 one per se, so I don't think that this is actually going to break anything. That |
joelanford
commented
Nov 25, 2019
@clnperez That's a good point. There are possibilities for how things may already be broken.
Either way, I think I'm convinced that users are already broken or are just getting lucky. Does anyone see something I don't? This is yet another reason why I'm a fan of ditching the In the meantime, perhaps the best option would be to use Go's default GOARCH handling. I'm pretty sure the logic that's in this PR would be identical to the logic the Thoughts? |
clnperez
commented
Nov 25, 2019
If we just delte those lines, that would probably be fine. I think you could still override by setting GOARCH on a build if someone wanted to cross-compile. |
Considering that users have been "broken" since we switched base images, and multi-arch support in UBI and eventually the docker cli, the only way to get expected behavior is to delete GOARCH setting logic (as @clnperez suggested). Users should rely on existing go binary configuration. |
joelanford
commented
Nov 25, 2019
I don't know if there actually was a breakage, but if alpine was not a multi-arch image, and UBI was, then we introduced the possibility of building an amd64 binary into a non-amd64 image.
Just everything else that's in the base image, e.g. |
clnperez
commented
Nov 25, 2019
@joelanford you mean this bin from the ubi base? (this is on my power vm, so it pulled down the power ubi image) |
clnperez
commented
Nov 25, 2019
Was this what you were thinking @joelanford#2268 ? |
camilamacedo86
commented
Dec 7, 2019
openshift-ci-robot
commented
Dec 7, 2019
@clnperez: PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
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 (the current behaviour).
Signed-off-by: Christy Norman christy@linux.vnet.ibm.com
Description of the change:
use the go runtime's goarch instead of a potentially (probably) un-set local environment variable
Motivation for the change:
an internal build team was getting a ppc64le docker image with an x86 binary inside and was super confused :D