Skip to content

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Jan 23, 2026

What does this PR do?

It allows building cross-platform docker images. We can already cross-build agent binaries, but for docker images we had a check specifically limiting them to the host architecture. However, buildx makes this pretty straightforward. This PR adds a check for buildx platform availability, and uses it if the host arch doesn't match the requested container image arch.

The cross-built container images gets the arch appended to the tag, so when building main for arm64 on a amd64 host, we get the 9.0.0-SNAPSHOT-arm64 tag. The native image gets a tag without the suffix, which is a bit inconsistent, but preserves the current behaviour.

This doesn't change anything for our CI, which builds arm images on arm hosts, but it makes cross-building locally much simpler.

This is a resubmission of #6256, which ended up having to be reverted due to unexpected breakage in unified release. We're now much better at testing that workflow in our PR CI, so this should be much safer.

Why is it important?

It's useful sometimes to be able to locally create a cross-platform manifest. I was troubleshooting some issues in our internal clusters, and wanted the SRE team to test a custom image I built, and had to hack around the build system to make it work.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas

How to test this PR locally

DEV=true SNAPSHOT=true PACKAGES=docker DOCKER_VARIANTS=basic PLATFORMS="linux/arm64,linux/amd64" EXTERNAL=true mage package

Should build two docker images.


This is an automatic backport of pull request #12363 done by [Mergify](https://mergify.com).

* Allow locally building multiplatform docker images (#6256)

(cherry picked from commit 508271b)

* Assume Docker version >=23.0

(cherry picked from commit 4ea63eb)
@mergify mergify bot added the backport label Jan 23, 2026
@mergify mergify bot requested a review from a team as a code owner January 23, 2026 18:28
@mergify mergify bot requested review from michel-laterman and swiatekm and removed request for a team January 23, 2026 18:28
@github-actions github-actions bot added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team skip-changelog chore Tasks that just need to be done, they are neither bug, nor enhancements labels Jan 23, 2026
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@mergify
Copy link
Contributor Author

mergify bot commented Jan 26, 2026

This pull request has not been merged yet. Could you please review and merge it @swiatekm? 🙏

@swiatekm
Copy link
Contributor

FYI, I'm waiting for the 9.3.0 release to merge this. There's no rush, and I want to avoid doing anything that could impact the unified release process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport chore Tasks that just need to be done, they are neither bug, nor enhancements skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants