Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiarch support for test image #732

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
43 changes: 21 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
name: Build and Push Image
on: [ push ]
on:
push:
branches:
- main

jobs:
build:
name: Build and push image
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: maistra-test-tool
tags: latest
containerfiles: |
./Dockerfile
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Podman Login action (https://github.com/redhat-actions/podman-login) also be used to log in,
# in which case 'username' and 'password' can be omitted.
- name: Push To quay.io
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
- name: Login to Quay.io
uses: docker/login-action@v3
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: quay.io/maistra
registry: quay.io
username: maistra+kiali
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Print image url
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"

- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
push: true
tags: quay.io/maistra/maistra-test-tool:latest
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@ FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
ARG HELM_VERSION="v3.11.3"
ARG GO_VERSION="1.20.3"
ARG OCP_VERSION="stable"
ARG TARGETARCH

ENV GOPATH=/go
ENV PATH=/usr/local/go/bin:$GOPATH/bin:$PATH
# we need to set HOME when running on OCP with random UID, otherwise the home is set to / and any writing there will fail with permission denied
ENV HOME=$GOPATH/src/maistra-test-tool

RUN microdnf install -y --nodocs tar gzip openssl findutils make git && \
curl -Lo ./oc.tar.gz https://mirror.openshift.com/pub/openshift-v4/clients/ocp/${OCP_VERSION}/openshift-client-linux.tar.gz && \
curl -Lo ./oc.tar.gz https://mirror.openshift.com/pub/openshift-v4/clients/ocp/${OCP_VERSION}/openshift-client-linux-${TARGETARCH}-rhel9.tar.gz && \
tar -xf oc.tar.gz -C /usr/bin && \
rm -f oc.tar.gz && \
curl -Lo ./golang.tar.gz https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz && \
curl -Lo ./golang.tar.gz https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz && \
tar -xf golang.tar.gz -C /usr/local && \
rm -f golang.tar.gz && \
curl -LOk https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz && \
tar -xzf helm-${HELM_VERSION}-linux-amd64.tar.gz && \
mv linux-amd64/helm /usr/bin/ && \
rm -rf helm-${HELM_VERSION}-linux-amd64.tar.gz linux-amd64 && \
curl -LOk https://get.helm.sh/helm-${HELM_VERSION}-linux-${TARGETARCH}.tar.gz && \
tar -xzf helm-${HELM_VERSION}-linux-${TARGETARCH}.tar.gz && \
mv linux-${TARGETARCH}/helm /usr/bin/ && \
rm -rf helm-${HELM_VERSION}-linux-${TARGETARCH}.tar.gz linux-${TARGETARCH} && \
microdnf update -y && \
microdnf clean all -y && \
mkdir -p "$GOPATH/src/maistra-test-tool" "$GOPATH/bin"
Expand Down