Skip to content

Add multi-platform container builds for amd64 and arm64#985

Open
pditommaso wants to merge 16 commits intomasterfrom
refactor/child-entries
Open

Add multi-platform container builds for amd64 and arm64#985
pditommaso wants to merge 16 commits intomasterfrom
refactor/child-entries

Conversation

@pditommaso
Copy link
Collaborator

@pditommaso pditommaso commented Mar 3, 2026

Summary

  • Add support for multi-platform container builds targeting both linux/amd64 and linux/arm64 architectures
  • Multi-platform builds are triggered by specifying a multi-arch containerPlatform value (e.g. linux/amd64,linux/arm64) — the previous multiPlatform boolean flag has been removed
  • Introduce ContainerPlatform.Platform inner class to properly model per-platform {os, arch, variant} tuples instead of a shared OS with a list of bare arch names
  • Introduce ChildRefs value type to track per-platform child build and scan IDs with proper Moshi serialization
  • Per-architecture security scanning: each platform gets its own scan ID and independent scan execution
  • MultiPlatformBuildService orchestrates parallel per-arch builds and assembles an OCI image index (manifest list)

Test plan

  • ContainerPlatformTest — single/multi-arch parsing, round-trip, equality, matching
  • ContainerControllerTest — multi-platform validation and request handling
  • ChildEntriesTest — encoding, round-trip, Jackson serialization, template binding
  • BuildRequestTest — Jackson serialization with child entries
  • ContainerScanServiceImplTest — multi-platform scan fan-out

🤖 Generated with Claude Code

pditommaso and others added 5 commits March 2, 2026 21:04
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Refactor ContainerPlatform to support multi-arch builds natively,
replacing MultiContainerPlatform with a unified model. Fan out security
scans per architecture since Trivy only accepts a single --platform flag.

Key changes:
- Consolidate ContainerPlatform to handle both single and multi-arch
- Add ScanIds helper for encoding/decoding per-platform scan IDs
- Fan out scans in ContainerScanServiceImpl per architecture
- Add BuildRequest.withScanId() for propagating multi-scan IDs
- Update views and email templates for per-arch scan links
- Poll all per-arch scans in ContainerStatusServiceImpl
- Extract ScanIds.populateScanBinding() to DRY scan binding logic

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ildIds field

- Create ChildEntries as a shared value type for encoding/decoding per-platform
  child IDs (builds and scans), with Jackson serialization support
- Stop overloading scanId with multi-platform encoded IDs; add dedicated
  scanChildIds field to BuildRequest, ContainerRequest, WaveBuildRecord,
  and WaveContainerRecord
- Change buildChildIds from String to ChildEntries type across all data classes
- Remove scan/build child entries and scan info from mail notifications
- Delete ScanIds utility class and its tests, replaced by ChildEntries

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pditommaso pditommaso changed the base branch from multi-platform to master March 3, 2026 17:48
pditommaso and others added 4 commits March 3, 2026 19:31
- Remove dead `withScanId()` method from BuildRequest
- Add explicit `= null` initialization for scanChildIds in ContainerController
- Fix pre-existing bug: `this.mirror == that.mirror` → `=` in WaveContainerRecord copy constructor
- Rename mismatched getter `getChildScanIds()` → `getScanChildIds()` in ContainerRequest
- Add Jackson round-trip serialization tests for ChildEntries

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add @JsonCreator/@jsonvalue to ContainerPlatform for proper serialization
  in persistence records (fixes mirror record tests)
- Add missing getScanId() stubs to ScanEntry mocks in ContainerStatusServiceTest
  (scanResult uses scan.scanId not request.scanId for URL)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace separate os/arch/variant/archs fields with a List<Platform> to
properly model multi-platform combinations where each platform can have
its own OS. Move parsing logic into Platform.of() static factory method.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove the boolean multiPlatform field from SubmitContainerTokenRequest.
Multi-platform builds are now triggered by specifying a multi-arch
containerPlatform value (e.g. "linux/amd64,linux/arm64"). Add validation
that only the linux/amd64+arm64 pair is currently allowed. Add
@JsonPropertyOrder to BuildRequest to fix CI field ordering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pditommaso pditommaso changed the title Replace ScanIds with ChildEntries value type Add multi-platform container builds for amd64 and arm64 Mar 3, 2026
pditommaso and others added 2 commits March 3, 2026 22:13
ChildEntries no longer extends ArrayList — it wraps a List<Entry>
field that Moshi can serialize/deserialize correctly through
BuildStateStore. Replace Jackson-based tests with Moshi roundtrip
tests using the same MoshiEncodeStrategy as production. Remove
unused @JsonPropertyOrder from BuildRequest.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pditommaso pditommaso requested a review from munishchouhan March 3, 2026 21:36
@pditommaso
Copy link
Collaborator Author

@munishchouhan when you have some capacity, it would be useful to stress this a bit to make sure there no regression.

containerPlatform allow linux/amd64,linux/arm64 in the build request. For all others it should remain the same

pditommaso and others added 4 commits March 4, 2026 09:19
# Conflicts:
#	src/test/groovy/io/seqera/wave/service/persistence/impl/SurrealPersistenceServiceTest.groovy
Add ContainerPlatform.validateSinglePlatform() helper and use it in
InspectController to prevent comma-separated platform values (e.g.
linux/amd64,linux/arm64) which should only be allowed for container
build requests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants