nutanix-cloud-native / cluster-api-runtime-extensions-nutanix

https://nutanix-cloud-native.github.io/cluster-api-runtime-extensions-nutanix/
Apache License 2.0
7 stars 4 forks source link

build: Ensure clean go build environment for goreleaser and ko #824

Closed jimmidyson closed 1 month ago

jimmidyson commented 1 month ago

Previous builds were overriding the GOOS and GOARCH enviroment variables, which is fine to do when using ko directly, but appears to be broken when building via ko using goreleaser.

This commit ensures that GOOS and GOARCH are always unset when running builds by undefining them via make undefine. The override keyword ensures that the env vars are always undefined regardless of the source (e.g. enviroment, make variables, etc) to ensure a clean build environment.

Instead of using GOARCH env var for building for the local build architecure, this commit uses goreleaser's {{ .Runtime.Goarch }} variable available via templating which contains the architecture of the build machine.

This commit also removes the ldflags config from the ko configuration in goreleaser config as this is automatically inherited from the build config referenced in the ko config.

jimmidyson commented 1 month ago

The error on Nutanix is to do with reserving the IPs for the CP endpoint:

failed to wait for task completion: failed to wait for task ZXJnb24=:2c4527f5-30b4-4562-98d7-c99345cb9410 to complete: context deadline exceeded

I think we may have a leak but this is blocking PR merges so we need to fix this ASAP.