Skip to content

Commit ee5a9e7

Browse files
clnperezcamilamacedo86
authored andcommitted
auto-detect build runtime arch (#2268)
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 <[email protected]>
1 parent 3f48ada commit ee5a9e7

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
### Bug Fixes
2828
- Fix issue faced in the Ansible based operators when `jmespath` queries are used because it was not installed. ([#2252](https://github.com/operator-framework/operator-sdk/pull/2252))
29+
- 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))
2930
- Fix scorecard behavior such that a CSV file is read correctly when `olm-deployed` is set to `true`. ([#2274](https://github.com/operator-framework/operator-sdk/pull/2274))
3031
- A CSV config's `operator-name` field will be used if `--operator-name` is not set. ([#2297](https://github.com/operator-framework/operator-sdk/pull/2297))
3132
- Populates a CSV's `spec.install` strategy if either name or strategy body are missing with a deployment-type strategy. ([#2298](https://github.com/operator-framework/operator-sdk/pull/2298))

cmd/operator-sdk/build/cmd.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,6 @@ func buildFunc(cmd *cobra.Command, args []string) error {
9191
projutil.MustInProjectRoot()
9292
goBuildEnv := append(os.Environ(), "GOOS=linux")
9393

94-
if value, ok := os.LookupEnv("GOARCH"); ok {
95-
goBuildEnv = append(goBuildEnv, "GOARCH="+value)
96-
} else {
97-
goBuildEnv = append(goBuildEnv, "GOARCH=amd64")
98-
}
99-
10094
// If CGO_ENABLED is not set, set it to '0'.
10195
if _, ok := os.LookupEnv("CGO_ENABLED"); !ok {
10296
goBuildEnv = append(goBuildEnv, "CGO_ENABLED=0")

0 commit comments

Comments
 (0)