forked from redhat-openshift-ecosystem/operator-pipelines
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (71 loc) · 2.73 KB
/
build-multi-arch-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
name: Build and Push Multi-arch Image
on: # yamllint disable-line rule:truthy
workflow_run:
workflows:
- validation
branches:
- main
types:
- completed
workflow_dispatch:
env:
IMAGE_TAG: multi-arch
IMAGE_NAME: operator-pipelines-images
IMAGE_REGISTRY: quay.io
IMAGE_NAMESPACE: redhat-isv
jobs:
build-multiarch-images:
name: Build and push multi-architecture image
strategy:
matrix:
architecture: [amd64, ppc64le, s390x, arm64]
platform: [linux]
runs-on: ubuntu-latest
steps:
- name: add checkout action...
uses: actions/checkout@v4
- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Build image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE_NAME }}
tags: ${{ matrix.platform }}-${{ matrix.architecture }}
arch: ${{ matrix.architecture }}
build-args: |
ARCH=${{ matrix.architecture }}
containerfiles: |
./operator-pipeline-images/Dockerfile
- name: Push Image
id: push-image
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ env.IMAGE_NAME }}
tags: ${{ matrix.platform }}-${{ matrix.architecture }}
registry: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
build-multiarch:
needs: build-multiarch-images
runs-on: ubuntu-latest
steps:
- name: Create and add to manifest
run: |
buildah manifest create ${{ env.IMAGE_NAME }}
buildah manifest add ${{ env.IMAGE_NAME }} ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:linux-amd64
buildah manifest add ${{ env.IMAGE_NAME }} ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:linux-ppc64le
buildah manifest add ${{ env.IMAGE_NAME }} ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:linux-s390x
buildah manifest add ${{ env.IMAGE_NAME }} ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:linux-arm64
# Authenticate to container image registry to push the image
- name: Podman Login
uses: redhat-actions/podman-login@v1
with:
registry: quay.io
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Push manifest
run: |
podman manifest push ${{ env.IMAGE_NAME }} ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} --all