-
Notifications
You must be signed in to change notification settings - Fork 51
rpm: speed up cross-arch worker builds by installing deps into mounted target rootfs #931
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
base: main
Are you sure you want to change the base?
rpm: speed up cross-arch worker builds by installing deps into mounted target rootfs #931
Conversation
603ebbc to
73adaf7
Compare
8fa6941 to
2330e0d
Compare
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.
Pull request overview
This PR optimizes cross-architecture RPM worker builds by installing build dependencies into a mounted target rootfs while running the package manager on the native BuildKit executor platform. This approach avoids slow QEMU emulation and "exec format error" issues during cross-architecture package installation.
Changes:
- Adds native executor platform detection from BuildKit worker options with platform normalization
- Implements cross-arch build flow: resolve target base image, run install on build platform with --installroot, and return mutated rootfs as target-platform worker
- Adds optional --forcearch support for dnf-based distros (applied when supported by dnf/tdnf)
- Enables CacheAddPlatform for Rocky 8/9, Azure Linux 3, and Mariner 2 to prevent cross-arch cache/repo metadata collisions
- Improves GitHub workflow reliability by simplifying registry mirror setup and adding error handling
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| targets/linux/rpm/distro/worker.go | Adds platform detection, normalization, and cross-arch worker build logic with InstallIntoRoot support |
| targets/linux/rpm/distro/dnf_install.go | Implements DnfForceArch option and InstallIntoRoot function for cross-arch package installation |
| targets/linux/rpm/rockylinux/v8.go | Enables platform-specific cache keys for Rocky Linux 8 |
| targets/linux/rpm/rockylinux/v9.go | Enables platform-specific cache keys for Rocky Linux 9 |
| targets/linux/rpm/azlinux/azlinux3.go | Enables platform-specific cache keys for Azure Linux 3 |
| targets/linux/rpm/azlinux/mariner2.go | Enables platform-specific cache keys for Mariner 2 |
| .github/workflows/worker-images.yml | Simplifies registry mirror setup and adds error handling for gh release view command |
| force_arch="` + forceArch + `" | ||
| install_root="` + installRoot + `" |
Copilot
AI
Jan 21, 2026
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.
The shell variable interpolation in lines 169-170 could be vulnerable to injection attacks if forceArch or installRoot contain shell metacharacters. Consider sanitizing these values or using proper quoting. However, since these values come from trusted internal sources (rpmArchFromPlatform and rootfsPath constant), this is less critical but still a best practice concern.
| force_arch="` + forceArch + `" | |
| install_root="` + installRoot + `" | |
| force_arch=` + fmt.Sprintf("%q", forceArch) + ` | |
| install_root=` + fmt.Sprintf("%q", installRoot) + ` |
c67f6b7 to
4d76b66
Compare
This PR speeds up cross-arch RPM worker image builds by running the package manager on the native BuildKit executor while installing packages into a mounted target rootfs via --installroot. For dnf-based distros we use dnf --forcearch=<target>; for tdnf-based distros we prefer dnf (bootstrapped when needed), with a safe fallback to running tdnf inside the target rootfs under QEMU/chroot when cross-install is not possible. Signed-off-by: Kartik Joshi <[email protected]>
4d76b66 to
889bd33
Compare
Enable faster and more reliable cross-arch RPM worker builds by installing build dependencies into a mounted target rootfs while running the package manager on the native BuildKit executor platform (avoids slow/full emulation and “exec format error” during install).
Changes
1. resolve target base image as target platform
2. run install on build platform and install into mounted target rootfs via --installroot
3. return the mutated rootfs as the target-platform worker