tinkerbell / rufio

Kubernetes Controller for BMC Interactions
Apache License 2.0
37 stars 16 forks source link

Get Dockerfile env vars properly working: #75

Closed jacobweinstock closed 1 year ago

jacobweinstock commented 1 year ago

Description

The TARGETARCH and TARGETOSenv vars weren't making it to the go build command so the GOOS and GOARCH were would be empty and the build would only use amd64.

Why is this needed

Manually tested by running this locally: docker buildx build --cache-from type=registry,ref=quay.io/tinkerbell/rufio:latest --file ./Dockerfile --load -t rufio:test --platform linux/arm64 ./ and then extracting the manager binary and validate the binary type to beARM aarch64.

Also, locally in the build logs you see [builder 7/7] RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -o manager main.go versus in the GitHub actions log you see [linux/amd64 builder 7/7] RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -a -o manager main.go https://github.com/tinkerbell/rufio/actions/runs/3831046658/jobs/6519718105#step:6:269 Fixes: #74

How Has This Been Tested?

How are existing users impacted? What migration steps/scripts do we need?

Checklist:

I have:

codecov[bot] commented 1 year ago

Codecov Report

Merging #75 (a3f3122) into main (58b9f07) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main      #75   +/-   ##
=======================================
  Coverage   59.50%   59.50%           
=======================================
  Files           4        4           
  Lines         321      321           
=======================================
  Hits          191      191           
  Misses         97       97           
  Partials       33       33           

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more