From 648f77153c1aff043491de693a7b1e927f88d46f Mon Sep 17 00:00:00 2001 From: Rajakumar Battula Date: Mon, 11 May 2026 10:52:44 +0530 Subject: [PATCH] MULTIARCH-5995: add ppc64le support to the build Signed-off-by: Rajakumar Battula --- .github/workflows/build_unstable_image.yml | 99 ++++++++++++++++++---- .github/workflows/release.yml | 2 +- Dockerfile | 2 +- Dockerfile.ppc64le | 97 +++++++++++++++++++++ 4 files changed, 180 insertions(+), 20 deletions(-) create mode 100644 Dockerfile.ppc64le diff --git a/.github/workflows/build_unstable_image.yml b/.github/workflows/build_unstable_image.yml index 3f34de8b3..dd05e98db 100644 --- a/.github/workflows/build_unstable_image.yml +++ b/.github/workflows/build_unstable_image.yml @@ -9,12 +9,25 @@ env: IMG_REGISTRY_HOST: quay.io IMG_REGISTRY_ORG: kuadrant IMG_NAME: testsuite - IMG_TAGS: unstable ${{ github.sha }} jobs: - build-unstable: - name: Build unstable images every new push to main + build: + name: Build (${{ matrix.arch }}) runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - platform: linux/amd64 + arch: amd64 + dockerfile: Dockerfile + - platform: linux/arm64 + arch: arm64 + dockerfile: Dockerfile + - platform: linux/ppc64le + arch: ppc64le + dockerfile: Dockerfile.ppc64le + steps: - name: Check out code uses: actions/checkout@v3 @@ -22,23 +35,73 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v3 - - name: Build unstable and sha images - id: build-image - uses: redhat-actions/buildah-build@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to registry + uses: docker/login-action@v3 + with: + registry: ${{ env.IMG_REGISTRY_HOST }} + username: ${{ secrets.IMG_REGISTRY_USERNAME }} + password: ${{ secrets.IMG_REGISTRY_TOKEN }} + + - name: Build and push by digest + id: build + uses: docker/build-push-action@v5 + with: + context: . + file: ${{ matrix.dockerfile }} + platforms: ${{ matrix.platform }} + build-args: TARGETARCH=${{ matrix.arch }} + outputs: type=image,name=${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/${{ env.IMG_NAME }},push-by-digest=true,name-canonical=true,push=true + provenance: false + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: digests-${{ matrix.arch }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + name: Merge manifests + runs-on: ubuntu-latest + needs: build + steps: + - name: Download all digests + uses: actions/download-artifact@v4 with: - image: ${{ env.IMG_NAME }} - tags: ${{ env.IMG_TAGS }} - layers: true - platforms: linux/amd64,linux/arm64 - containerfiles: | - ./Dockerfile - - - name: Push images to quay - uses: redhat-actions/push-to-registry@v2 + pattern: digests-* + path: /tmp/digests + merge-multiple: true + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to registry + uses: docker/login-action@v3 with: - image: ${{ steps.build-image.outputs.image }} - tags: ${{ steps.build-image.outputs.tags }} - registry: ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }} + registry: ${{ env.IMG_REGISTRY_HOST }} username: ${{ secrets.IMG_REGISTRY_USERNAME }} password: ${{ secrets.IMG_REGISTRY_TOKEN }} + - name: Create and push manifest + working-directory: /tmp/digests + run: | + docker buildx imagetools create \ + -t ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/${{ env.IMG_NAME }}:unstable \ + -t ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/${{ env.IMG_NAME }}:${{ github.sha }} \ + $(printf '${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/${{ env.IMG_NAME }}@sha256:%s ' \ + $(find . -type f -exec basename {} \;)) + + - name: Inspect manifest + run: | + docker buildx imagetools inspect \ + ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/${{ env.IMG_NAME }}:unstable \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cbc1d28e9..7d6c21495 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,7 +46,7 @@ jobs: image: ${{ env.IMG_NAME }} tags: ${{ env.IMG_TAGS }} layers: true - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/arm64,linux/ppc64le containerfiles: | ./Dockerfile diff --git a/Dockerfile b/Dockerfile index 39560959b..ab4613b31 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,4 +43,4 @@ RUN make poetry-no-dev && \ rm -Rf $HOME/.cache/* ENTRYPOINT [ "make" ] -CMD [ "test" ] +CMD [ "test" ] \ No newline at end of file diff --git a/Dockerfile.ppc64le b/Dockerfile.ppc64le new file mode 100644 index 000000000..87ec496c0 --- /dev/null +++ b/Dockerfile.ppc64le @@ -0,0 +1,97 @@ +FROM --platform=${BUILDPLATFORM} quay.io/centos/centos:stream9 AS builder + +RUN dnf install -y \ + python3.11 \ + python3.11-pip \ + python3.11-devel \ + gcc \ + gcc-c++ \ + make \ + git \ + libxml2-devel \ + libxslt-devel \ + libffi-devel \ + openssl-devel \ + zlib-devel \ + && dnf clean all + +# Install poetry + export plugin natively +RUN python3.11 -m pip --no-cache-dir install \ + poetry \ + poetry-plugin-export + +WORKDIR /opt/workdir/kuadrant-testsuite +COPY . . + +# Export deps excluding playwright (no ppc64le wheel) +RUN poetry export \ + --without-hashes \ + --without dev \ + -f requirements.txt \ + -o /tmp/requirements.txt && \ + grep -v "playwright" /tmp/requirements.txt \ + > /tmp/requirements-ppc64le.txt && \ + python3.11 -m pip install \ + --no-cache-dir \ + --target /tmp/ppc64le-deps \ + -r /tmp/requirements-ppc64le.txt + +FROM quay.io/centos/centos:stream9 +LABEL description="Run Kuadrant integration tests \ +Default ENTRYPOINT: 'make' and CMD: 'test' \ +Bind dynaconf settings to /opt/secrets.yaml \ +Bind kubeconfig to /opt/kubeconfig \ +Bind a dir to /test-run-results to get reports " + +ARG TARGETARCH=ppc64le + +RUN useradd --no-log-init -u 1001 -g root -m testsuite + +RUN dnf install -y \ + python3.11 \ + python3.11-pip \ + make \ + git \ + && dnf clean all + +RUN curl -LO \ + "https://dl.k8s.io/release/v1.30.2/bin/linux/${TARGETARCH}/kubectl" && \ + mv kubectl /usr/local/bin && \ + chmod +x /usr/local/bin/kubectl + +RUN curl -L \ + "https://github.com/cloudflare/cfssl/releases/download/v1.6.4/cfssl_1.6.4_linux_${TARGETARCH}" \ + >/usr/bin/cfssl && \ + chmod +x /usr/bin/cfssl + +RUN curl -fL \ + "https://github.com/kube-burner/kube-burner/releases/download/v1.16.4/kube-burner-V1.16.4-linux-ppc64le.tar.gz" \ + -o /tmp/kube-burner.tar.gz && \ + tar -xz -C /usr/bin --wildcards "kube-burner" \ + -f /tmp/kube-burner.tar.gz && \ + chmod 0755 /usr/bin/kube-burner && \ + rm /tmp/kube-burner.tar.gz + +COPY --from=builder /tmp/ppc64le-deps /usr/local/lib/python3.11/site-packages/ +COPY --from=builder /opt/workdir /opt/workdir + +RUN mkdir -p -m 0770 /test-run-results && \ + chmod 0750 /opt/workdir/virtualenvs 2>/dev/null || true && \ + chown testsuite -R /opt/workdir/ && \ + chown testsuite /test-run-results + +RUN touch /run/kubeconfig && \ + chmod 660 /run/kubeconfig && \ + chown testsuite /run/kubeconfig + +USER testsuite + +ENV KUBECONFIG=/run/kubeconfig \ + SECRETS_FOR_DYNACONF=/run/secrets.yaml \ + POETRY_VIRTUALENVS_PATH=/opt/workdir/virtualenvs/ \ + SSL_CERT_FILE=/etc/pki/tls/certs/ca-bundle.crt \ + junit=yes \ + resultsdir=/test-run-results + +ENTRYPOINT [ "make" ] +CMD [ "test" ] \ No newline at end of file