Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 81 additions & 18 deletions .github/workflows/build_unstable_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,99 @@ 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

- 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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ RUN make poetry-no-dev && \
rm -Rf $HOME/.cache/*

ENTRYPOINT [ "make" ]
CMD [ "test" ]
CMD [ "test" ]
97 changes: 97 additions & 0 deletions Dockerfile.ppc64le
Original file line number Diff line number Diff line change
@@ -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" ]