Skip to content

Add multi-arch builder pipeline for amd64 + arm64 support - #314

Open
jvulgan wants to merge 5 commits into
mainfrom
multiarch-builder
Open

Add multi-arch builder pipeline for amd64 + arm64 support#314
jvulgan wants to merge 5 commits into
mainfrom
multiarch-builder

Conversation

@jvulgan

@jvulgan jvulgan commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

The builder image Containerfile already handles multiple architectures via AUDITWHEEL_ARCH, but the CI pipeline was hardcoded to single-arch buildah-oci-ta. This adds a new build-multiarch pipeline that uses buildah-remote-oci-ta with Tekton matrix fan-out, and makes the Containerfile auto-detect the target architecture from uname -m when PLATFORM is not explicitly set.

Assisted-by: Claude Opus 4.6 noreply@anthropic.com

Summary by Sourcery

Introduce a multi-architecture container image build pipeline and wire CI to use it for builder images.

Enhancements:

  • Enable automatic architecture detection in builder scripts and Containerfile when platform is not explicitly specified.

Build:

  • Add a Tekton build-multiarch pipeline that fans out builds per platform and assembles a multi-arch image index.
  • Update pull request and push Tekton plumbing pipelines to invoke the multi-arch image pipeline and build images for amd64 and arm64.

@sourcery-ai

sourcery-ai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Reviewer's Guide

Introduces a new Tekton multi-architecture builder pipeline that fans out per-platform builds via buildah-remote-oci-ta, assembles a multi-arch image index, and adjusts the builder image scripts/Containerfile to auto-detect the target architecture when PLATFORM/AUDITWHEEL_ARCH are not explicitly set. The existing PR/push pipelines are re-pointed to this new multiarch pipeline and configured to build amd64 and arm64 images.

Sequence diagram for the new multi-arch Tekton build-multiarch pipeline

sequenceDiagram
  participant Pipeline as build_multiarch
  participant init
  participant clone_repository as git_clone_oci_ta
  participant prefetch as prefetch_dependencies_oci_ta
  participant build_images as buildah_remote_oci_ta
  participant build_index as build_image_index

  Pipeline->>init: task init
  init-->>Pipeline: result build
  Pipeline->>clone_repository: task git-clone-oci-ta
  clone_repository-->>Pipeline: results commit, SOURCE_ARTIFACT
  Pipeline->>prefetch: task prefetch-dependencies-oci-ta
  prefetch-->>Pipeline: results SOURCE_ARTIFACT, CACHI2_ARTIFACT

  loop [for each PLATFORM in build-platforms]
    Pipeline->>build_images: task buildah-remote-oci-ta (matrix PLATFORM)
    build_images-->>Pipeline: result IMAGE_REF
  end

  Pipeline->>build_index: task build-image-index
  build_index-->>Pipeline: results IMAGE_URL, IMAGE_DIGEST (multi-arch index)
Loading

Flow diagram for AUDITWHEEL_ARCH and PLATFORM auto-detection in builder image

flowchart LR
  A[Start build_scripts.sh] --> B{AUDITWHEEL_ARCH set?}
  B -- Yes --> C[Use AUDITWHEEL_ARCH]
  B -- No --> D[Set AUDITWHEEL_ARCH = uname -m]
  C --> E[Set AUDITWHEEL_PLAT = AUDITWHEEL_POLICY + '_' + AUDITWHEEL_ARCH]
  D --> E
  E --> F[export AUDITWHEEL_ARCH, AUDITWHEEL_PLAT]

  subgraph Containerfile
    G[ARG PLATFORM]
    G --> H{PLATFORM provided?}
    H -- Yes --> I[Use given PLATFORM in build]
    H -- No --> J[Builder scripts derive arch from AUDITWHEEL_ARCH]
  end

  F --> J
Loading

File-Level Changes

Change Details Files
Wire existing PR and push builder pipelines to a new multi-arch pipeline and task, enabling amd64 + arm64 builds.
  • Add build-platforms parameter with linux/amd64 and linux/arm64 values to plumbing builder PR and push pipelines.
  • Rename pipeline taskRunSpecs from build-container to build-images to match the new pipeline task name.
  • Switch pipelineRef in PR and push plumbing configs from build to build-multiarch.
.tekton/plumbing-builder-pull-request.yaml
.tekton/plumbing-builder-push.yaml
Make builder scripts/container auto-detect architecture for multi-arch builds instead of hardcoding x86_64.
  • Initialize AUDITWHEEL_ARCH from uname -m when not set, and derive/export AUDITWHEEL_PLAT from AUDITWHEEL_POLICY and AUDITWHEEL_ARCH in build_utils.sh.
  • Change Containerfile PLATFORM argument default from x86_64 to empty so it can be supplied per-platform or via auto-detection.
builder/build_scripts/build_utils.sh
builder/Containerfile
Add a new Tekton build-multiarch pipeline that fans out builds per platform using buildah-remote-oci-ta and creates a multi-arch image index plus follow-up checks.
  • Define build-multiarch pipeline with standard init, clone, prefetch, and post-build scanning tasks (clair, clamav, SAST checks, deprecated image, RPM signature, etc.).
  • Configure build-images matrix task to run buildah-remote-oci-ta once per entry in build-platforms, appending platform to image names and passing through existing build parameters and artifacts.
  • Add build-image-index task that collects per-platform IMAGE_REFs from build-images and creates a multi-arch image manifest, whose URL/digest are exposed as pipeline results.
  • Wire optional source image build, tag application, and Dockerfile push tasks off the multi-arch index image.
  • Expose pipeline params/results consistent with existing single-arch workflow, including build-args and build-args-file for buildah.
.tekton/build-multiarch-pipeline.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • The build-platforms default in build-multiarch-pipeline.yaml is linux/x86_64 but the PR wires linux/amd64 and linux/arm64 in the plumbing pipelines; consider aligning the default with the values actually used to avoid confusing or non-working defaults.
  • In the build-images matrix, the PLATFORM param is set via value: - $(params.build-platforms); for a Tekton array parameter matrix this likely needs the [*] expansion ($(params.build-platforms[*])) so each platform is fanned out correctly rather than being passed as a single list element.
  • Clearing the PLATFORM ARG in the Containerfile and relying on AUDITWHEEL_ARCH=$(uname -m) is a behavior change; double-check any existing build paths or scripts that assumed the previous default x86_64 ARG so they don't regress when PLATFORM is now empty by default.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `build-platforms` default in `build-multiarch-pipeline.yaml` is `linux/x86_64` but the PR wires `linux/amd64` and `linux/arm64` in the plumbing pipelines; consider aligning the default with the values actually used to avoid confusing or non-working defaults.
- In the `build-images` matrix, the `PLATFORM` param is set via `value: - $(params.build-platforms)`; for a Tekton array parameter matrix this likely needs the `[*]` expansion (`$(params.build-platforms[*])`) so each platform is fanned out correctly rather than being passed as a single list element.
- Clearing the `PLATFORM` ARG in the `Containerfile` and relying on `AUDITWHEEL_ARCH=$(uname -m)` is a behavior change; double-check any existing build paths or scripts that assumed the previous default `x86_64` ARG so they don't regress when `PLATFORM` is now empty by default.

## Individual Comments

### Comment 1
<location path=".tekton/build-multiarch-pipeline.yaml" line_range="170-171" />
<code_context>
+          workspace: git-auth
+        - name: netrc
+          workspace: netrc
+    - name: build-images
+      matrix:
+        params:
+          - name: PLATFORM
</code_context>
<issue_to_address>
**issue (bug_risk):** Matrix parameter definition likely creates a nested array instead of a flat list of platforms.

In the `build-images` task, `PLATFORM` is defined as:
```yaml
matrix:
  params:
    - name: PLATFORM
      value:
        - $(params.build-platforms)
```
This makes `value` a single element that is itself an array, so the matrix will iterate once over the whole list instead of per platform. To get one iteration per platform, pass `$(params.build-platforms)` directly as the flat list (e.g. `value: $(params.build-platforms)`).
</issue_to_address>

### Comment 2
<location path=".tekton/build-multiarch-pipeline.yaml" line_range="77-81" />
<code_context>
+      default: 'false'
+      description: Enable cache proxy configuration
+      type: string
+    - default:
+        - linux/x86_64
+      description: List of platforms to build on. Available values depend on multi-platform-controller configuration.
+      name: build-platforms
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Default platform identifier (`linux/x86_64`) is inconsistent with the values used in plumbing configs (`linux/amd64`).

The `build-platforms` param defaults to `linux/x86_64`, while the plumbing YAML uses `linux/amd64` and `linux/arm64`. If the underlying task/controller expects the `linux/amd64` convention, this inconsistency could lead to unexpected behavior when the default is used. Please align the default with the values used elsewhere, or clearly document/normalize the accepted platform identifiers in this pipeline.

```suggestion
    - default:
        - linux/amd64
      description: List of platforms to build on (for example: linux/amd64, linux/arm64). Available values depend on multi-platform-controller configuration.
      name: build-platforms
      type: array
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .tekton/build-multiarch-pipeline.yaml
Comment thread .tekton/build-multiarch-pipeline.yaml
jvulgan added 4 commits June 30, 2026 13:20
The builder image Containerfile already handles multiple architectures
via AUDITWHEEL_ARCH, but the CI pipeline was hardcoded to single-arch
buildah-oci-ta. This adds a new build-multiarch pipeline that uses
buildah-remote-oci-ta with Tekton matrix fan-out, and makes the
Containerfile auto-detect the target architecture from uname -m when
PLATFORM is not explicitly set.

Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
The rustup-init binary is architecture-specific, so each platform has a
different sha256 hash. Split the single RUST_HASH into per-arch variables
(RUST_HASH_x86_64, RUST_HASH_aarch64) and select the correct one based
on AUDITWHEEL_ARCH.

Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
Multi-arch builds require the image index to assemble per-platform
images into a manifest list. The param defaulted to "false" (carried
over from the single-arch pipeline), causing build-image-index to skip
generation when multiple images were supplied.

Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
When PLATFORM is empty, ENV sets AUDITWHEEL_PLAT to "manylinux_2_28_"
(trailing underscore). The := operator treated this as non-empty and
skipped recomputation, so auditwheel repair failed with an invalid
platform tag. Always recompute AUDITWHEEL_PLAT after resolving
AUDITWHEEL_ARCH.

Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
@jvulgan
jvulgan force-pushed the multiarch-builder branch from 219703e to e655cf0 Compare June 30, 2026 11:20
@jvulgan jvulgan changed the title DRAFT: Add multi-arch builder pipeline for amd64 + arm64 support Add multi-arch builder pipeline for amd64 + arm64 support Jun 30, 2026
The auditwheel repair step used hardcoded *linux_x86_64.whl patterns,
so native wheels on aarch64 (linux_aarch64) would be silently skipped.
Derive the glob from AUDITWHEEL_ARCH / uname -m so the script works on
any architecture.

Assisted-by: Claude Opus 4.6 <noreply@anthropic.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.

1 participant