Repository navigation
Cross-compile go-discover instead of building it under QEMU - #409
Open
suresh-hashicorp wants to merge 1 commit into
Open
suresh-hashicorp wants to merge 1 commit into
suresh-hashicorp wants to merge 1 commit into
Conversation
Pin the go-discover stage to the build platform and cross-compile discover for the target platform. This avoids compiling Go under QEMU emulation for the arm and arm64 image builds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
suresh-hashicorp
deployed
to
dockerhub/hashicorpdev
October 30, 2026 07:47 — with
GitHub Actions
Active
suresh-hashicorp
deployed
to
dockerhub/hashicorpdev
October 30, 2026 07:47 — with
GitHub Actions
Active
Go Test Coverage: 74.1%Patch coverage: N/A (no coverable Go lines changed) See the workflow run for the full per-package breakdown and downloadable HTML report. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #409 +/- ##
=======================================
Coverage 59.34% 59.34%
=======================================
Files 34 34
Lines 2890 2890
=======================================
Hits 1715 1715
Misses 978 978
Partials 197 197 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3 of 5 tasks
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes proposed in this PR:
go-discoverstage of theDockerfileto$BUILDPLATFORMand cross-compilediscoverfor the target platform (GOOS,GOARCH, andGOARMfor 32-bit arm).buildrun onmain, that single step took about 1372s (arm), 671s (arm64) and about 100s (amd64) of the Docker job time.go installwrites the binary to/go/bin/<os>_<arch>/, so it is moved to/go/bin/and the finalCOPY --from=go-discover /go/bin/discover /bin/is unchanged.How I've tested this PR:
Built the
go-discoverstage locally withdocker buildx build --target go-discover --platform <p> --loadforlinux/amd64,linux/arm64,linux/386,linux/arm/v6,linux/arm/v7andlinux/arm.fileandgo version -mon each extracted binary show the expectedGOOS/GOARCH/GOARM,CGO_ENABLED=0andgo-discover v1.5.0. Passed for all.Also built the full
release-defaultimage forlinux/arm/v7andlinux/arm64, then randocker run --platform <p> --entrypoint /bin/discover <image> -h. Both images built and printed the usage text.Build time comparison:
Docker job durations from the
buildworkflow. Before is the last full run onmain(run 39953679234,83643d6); after is this PR'spull_requestrun (41021844924).The slowest Docker job drops from about 23.5 minutes to about 2.4 minutes. The
pushrun for this branch gives similar numbers (arm 131s, arm64 134s, arm64 FIPS 134s). amd64 and 386 are unaffected; their differences are normal run-to-run variance.How I expect reviewers to test this PR:
buildworkflow passes and the ARM Docker jobs take about 2-3 minutes.Artifact Validation Resultspasses after merge (artifact names don't change).Checklist:
PCI review checklist
go-discoverversion are unchanged.)