From 99db394346732d619dc320c8d44d3d3b5918a36b Mon Sep 17 00:00:00 2001 From: Adrian Riobo Date: Fri, 18 Oct 2024 10:18:10 +0200 Subject: [PATCH] chore: enable gh runner to build mutiarch Signed-off-by: Adrian Riobo --- .github/workflows/build-oci.yaml | 74 +++++++++++++++++--------------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build-oci.yaml b/.github/workflows/build-oci.yaml index f3b0b248..ec7189a2 100644 --- a/.github/workflows/build-oci.yaml +++ b/.github/workflows/build-oci.yaml @@ -13,38 +13,44 @@ jobs: name: build-mapt runs-on: ubuntu-24.04 steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Build image for PR - if: ${{ github.event_name == 'pull_request' }} - shell: bash - run: | - IMG=ghcr.io/redhat-developer/mapt:pr-${{ github.event.number }} make oci-build - podman save -o mapt.tar ghcr.io/redhat-developer/mapt:pr-${{ github.event.number }} - echo "ghcr.io/redhat-developer/mapt:pr-${{ github.event.number }}" > mapt-image - - - name: Save image for PR - uses: actions/upload-artifact@v4 - with: - name: mapt - path: mapt* - - - name: Build image - if: ${{ github.event_name != 'pull_request' }} - shell: bash - run: make oci-build - - - name: Log in to quay.io Registry - if: ${{ github.event_name != 'pull_request' }} - uses: redhat-actions/podman-login@v1 - with: - registry: quay.io - username: ${{ secrets.QUAY_IO_USERNAME }} - password: ${{ secrets.QUAY_IO_PASSWORD }} - - - name: Push image - if: ${{ github.event_name != 'pull_request' }} - shell: bash - run: make oci-push + # Allow emulation for building multi arch images + - name: Prepare runner + shell: bash + run: | + sudo apt-get install -y qemu-user-static + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Build image for PR + if: ${{ github.event_name == 'pull_request' }} + shell: bash + run: | + IMG=ghcr.io/redhat-developer/mapt:pr-${{ github.event.number }} make oci-build + podman save -o mapt.tar ghcr.io/redhat-developer/mapt:pr-${{ github.event.number }} + echo "ghcr.io/redhat-developer/mapt:pr-${{ github.event.number }}" > mapt-image + + - name: Save image for PR + uses: actions/upload-artifact@v4 + with: + name: mapt + path: mapt* + + - name: Build image + if: ${{ github.event_name != 'pull_request' }} + shell: bash + run: make oci-build + + - name: Log in to quay.io Registry + if: ${{ github.event_name != 'pull_request' }} + uses: redhat-actions/podman-login@v1 + with: + registry: quay.io + username: ${{ secrets.QUAY_IO_USERNAME }} + password: ${{ secrets.QUAY_IO_PASSWORD }} + + - name: Push image + if: ${{ github.event_name != 'pull_request' }} + shell: bash + run: make oci-push