Skip to content
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

Merged
merged 2 commits into from
Dec 7, 2019

Conversation

clnperez
Copy link
Contributor

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

@openshift-ci-robot openshift-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Nov 25, 2019
Comment on lines 94 to 96
if value, ok := os.LookupEnv("GOARCH"); ok {
goBuildEnv = append(goBuildEnv, "GOARCH="+value)
} else {
goBuildEnv = append(goBuildEnv, "GOARCH=amd64")
}
Copy link
Member

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).

Copy link
Member

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))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated and tested @joelanford

@clnperez clnperez force-pushed the build-runtime-2 branch 2 times, most recently from 793bd9c to ad82d47 Compare December 3, 2019 22:16
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>
Copy link
Member

@estroz estroz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 3, 2019
camilamacedo86
camilamacedo86 previously approved these changes Dec 4, 2019
Copy link
Contributor

@camilamacedo86 camilamacedo86 left a 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?

@camilamacedo86 camilamacedo86 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 4, 2019
@camilamacedo86 camilamacedo86 dismissed their stale review December 5, 2019 19:13

I think that I faced problem related and I'd like to test it more

Copy link
Member

@joelanford joelanford left a 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.

Copy link
Contributor

@camilamacedo86 camilamacedo86 left a 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. 👍

@openshift-ci-robot
Copy link

New changes are detected. LGTM label has been removed.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Dec 7, 2019
@camilamacedo86
Copy link
Contributor

Merging this one 👍

@camilamacedo86 camilamacedo86 merged commit ee5a9e7 into operator-framework:master Dec 7, 2019
@clnperez
Copy link
Contributor Author

Sorry - was out on vacation. Thanks all!

yselkowitz pushed a commit to yselkowitz/ocp-release-operator-sdk that referenced this pull request Dec 16, 2019
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>
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/ocp-release-operator-sdk that referenced this pull request Dec 17, 2019
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>
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/ocp-release-operator-sdk that referenced this pull request Dec 18, 2019
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants