-
Notifications
You must be signed in to change notification settings - Fork 35
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
fix(ci): specify target machine architecture for binary build #525
fix(ci): specify target machine architecture for binary build #525
Conversation
Signed-off-by: Raphanus Lo <yunchang.lo@suse.com>
WalkthroughThis pull request updates environment variable handling in two areas. In the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant BuildScript as scripts/build
participant System
User->>BuildScript: Execute build script (optionally sets ARCHS)
alt ARCHS variable provided
BuildScript->>BuildScript: Parse ARCHS variable into array
else ARCHS not provided
BuildScript->>System: Invoke uname -m to determine architecture
System-->>BuildScript: Return architecture (amd64/arm64)
end
BuildScript->>System: Proceed with build using determined architecture(s)
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
scripts/build (1)
23-38
: LGTM! Architecture detection logic effectively prevents segfaults.The dynamic architecture detection with fallback to
uname -m
ensures correct library linking by:
- Supporting external architecture specification via
ARCHS
- Mapping system architectures to Go architectures (
aarch64
/arm64
→arm64
,x86_64
→amd64
)- Failing fast on unsupported architectures
Consider adding comments to explain the architecture mapping.
Adding comments would help explain why
aarch64
is mapped toarm64
andx86_64
toamd64
.case $(uname -m) in + # Map ARM architectures (aarch64 is the system name, arm64 is the Go name) aarch64 | arm64) ARCHS=(arm64) ;; + # Map x86 architectures (x86_64 is the system name, amd64 is the Go name) x86_64) ARCHS=(amd64) ;;
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
Dockerfile.dapper
(2 hunks)scripts/build
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Build binaries
- GitHub Check: Summary
🔇 Additional comments (3)
scripts/build (1)
39-41
: LGTM! Build configuration prevents library linking issues.The build configuration effectively prevents segfaults by:
- Using
CGO_ENABLED=0
for static linking- Setting architecture-specific
GOARCH
- Including version and git info in binary
Dockerfile.dapper (2)
9-9
: LGTM! Environment variable addition enables architecture control.Adding
ARCHS
toDAPPER_ENV
allows specifying target architectures in the CI pipeline, which is essential for preventing segfaults during library linking.
34-34
: LGTM!
Which issue(s) this PR fixes:
GHA segfault while linking libs during binary build on CI pipe.
What this PR does / why we need it:
Prevent link amd64 libs accidentally in arm64 build environment.
Special notes for your reviewer:
Additional documentation or context