1717 default : stable
1818
1919env :
20- IMG_TAGS : ${{ github.sha }}
2120 IMG_REGISTRY_HOST : quay.io
2221 IMG_REGISTRY_ORG : kuadrant
2322 MAIN_BRANCH_NAME : main
3231 steps :
3332 - name : Check out code
3433 uses : actions/checkout@v4
35- - name : Add latest tag
36- if : ${{ github.ref_name == env.MAIN_BRANCH_NAME }}
37- id : add-latest-tag
38- run : |
39- echo "IMG_TAGS=latest ${{ env.IMG_TAGS }}" >> $GITHUB_ENV
40- - name : Add branch tag
41- if : ${{ github.ref_name != env.MAIN_BRANCH_NAME }}
42- id : add-branch-tag
43- run : |
44- echo "IMG_TAGS=${GITHUB_REF_NAME/\//-} ${{ env.IMG_TAGS }}" >> $GITHUB_ENV
34+ - name : Set up Docker Buildx
35+ uses : docker/setup-buildx-action@v3
4536 - name : Set Operator version
4637 id : operator-version
4738 run : |
@@ -50,39 +41,45 @@ jobs:
5041 else
5142 echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV
5243 fi
53- - name : Set up QEMU
54- uses : docker/setup-qemu-action@v3
44+ - name : Extract metadata
45+ id : meta
46+ uses : docker/metadata-action@v5
47+ with :
48+ images : ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/${{ env.OPERATOR_NAME }}
49+ tags : |
50+ type=raw,value=${{ github.sha }}
51+ type=raw,value=latest,enable={{is_default_branch}}
52+ type=ref,event=branch,enable={{is_not_default_branch}}
5553 - name : Install yq dependency
5654 run : make yq
5755 - name : Set default authorino image
5856 run : |
5957 echo "DEFAULT_AUTHORINO_IMAGE=$(./bin/yq e -e '.config.authorinoImage' ${{ env.BUILD_CONFIG_FILE }} || echo ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/authorino:${{ env.LATEST_AUTHORINO_GITREF }})" >> $GITHUB_ENV
58+ - name : Login to Container Registry
59+ if : ${{ !env.ACT }}
60+ uses : docker/login-action@v3
61+ with :
62+ registry : ${{ env.IMG_REGISTRY_HOST }}
63+ username : ${{ secrets.IMG_REGISTRY_USERNAME }}
64+ password : ${{ secrets.IMG_REGISTRY_TOKEN }}
6065 - name : Build Image
6166 id : build-image
62- uses : redhat-actions/buildah- build@v2
67+ uses : docker/ build-push-action@v5
6368 with :
64- image : ${{ env.OPERATOR_NAME }}
65- tags : ${{ env.IMG_TAGS }}
69+ context : .
6670 platforms : linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
71+ push : ${{ !env.ACT }}
72+ tags : ${{ steps.meta.outputs.tags }}
6773 build-args : |
6874 OPERATOR_VERSION=${{ env.VERSION }}
6975 GIT_SHA=${{ github.sha }}
7076 DIRTY=false
7177 DEFAULT_AUTHORINO_IMAGE=${{ env.DEFAULT_AUTHORINO_IMAGE }}
72- containerfiles : |
73- ./Dockerfile
74- - name : Push Image
75- if : ${{ !env.ACT }}
76- id : push-to-quay
77- uses : redhat-actions/push-to-registry@v2
78- with :
79- image : ${{ steps.build-image.outputs.image }}
80- tags : ${{ steps.build-image.outputs.tags }}
81- registry : ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}
82- username : ${{ secrets.IMG_REGISTRY_USERNAME }}
83- password : ${{ secrets.IMG_REGISTRY_TOKEN }}
78+ provenance : false
8479 - name : Print Image URL
85- run : echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
80+ run : |
81+ echo "Image(s) pushed:"
82+ echo "${{ steps.meta.outputs.tags }}"
8683
8784 build-bundle :
8885 needs : build
9794 with :
9895 go-version-file : go.mod
9996 id : go
100- - name : Add latest tag
101- if : ${{ github.ref_name == env.MAIN_BRANCH_NAME }}
102- id : add-latest-tag
103- run : |
104- echo "IMG_TAGS=latest ${{ env.IMG_TAGS }}" >> $GITHUB_ENV
105- - name : Add release tag
106- if : ${{ github.ref_name != env.MAIN_BRANCH_NAME }}
107- id : add-branch-tag
108- run : |
109- TAG_NAME=${GITHUB_REF_NAME/\//-}
110- echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
111- echo "IMG_TAGS=${TAG_NAME} ${{ env.IMG_TAGS }}" >> $GITHUB_ENV
97+ - name : Set up Docker Buildx
98+ uses : docker/setup-buildx-action@v3
11299 - name : Set Operator version
113100 id : operator-version
114101 run : |
@@ -118,8 +105,15 @@ jobs:
118105 else
119106 echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV
120107 fi
121- - name : Set up QEMU
122- uses : docker/setup-qemu-action@v3
108+ - name : Extract metadata
109+ id : meta
110+ uses : docker/metadata-action@v5
111+ with :
112+ images : ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/${{ env.OPERATOR_NAME }}-bundle
113+ tags : |
114+ type=raw,value=${{ github.sha }}
115+ type=raw,value=latest,enable={{is_default_branch}}
116+ type=ref,event=branch,enable={{is_not_default_branch}}
123117 - name : Run make bundle (main)
124118 if : ${{ github.ref_name == env.MAIN_BRANCH_NAME }}
125119 run : make bundle REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} IMAGE_TAG=${{ github.sha }} AUTHORINO_VERSION=${{ env.LATEST_AUTHORINO_GITREF }}
@@ -134,29 +128,29 @@ jobs:
134128 - name : Verify manifests and bundle (release)
135129 if : ${{ github.ref_name != env.MAIN_BRANCH_NAME }}
136130 run : make verify-manifests verify-bundle REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} VERSION=${{env.VERSION}} AUTHORINO_VERSION=${{ github.event.inputs.authorinoVersion }} CHANNELS=${{ github.event.inputs.channels }} DEFAULT_CHANNEL=stable
131+ - name : Login to Container Registry
132+ if : ${{ !env.ACT }}
133+ uses : docker/login-action@v3
134+ with :
135+ registry : ${{ env.IMG_REGISTRY_HOST }}
136+ username : ${{ secrets.IMG_REGISTRY_USERNAME }}
137+ password : ${{ secrets.IMG_REGISTRY_TOKEN }}
137138 - name : Build Image
138139 id : build-image
139- uses : redhat-actions/buildah- build@v2
140+ uses : docker/ build-push-action@v5
140141 with :
141- image : ${{ env.OPERATOR_NAME }}-bundle
142- tags : ${{ env.IMG_TAGS }}
142+ context : .
143+ file : ./bundle.Dockerfile
143144 platforms : linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
145+ push : ${{ !env.ACT }}
146+ tags : ${{ steps.meta.outputs.tags }}
144147 build-args : |
145148 version=${{ env.VERSION }}
146- containerfiles : |
147- ./bundle.Dockerfile
148- - name : Push Image
149- if : ${{ !env.ACT }}
150- id : push-to-quay
151- uses : redhat-actions/push-to-registry@v2
152- with :
153- image : ${{ steps.build-image.outputs.image }}
154- tags : ${{ steps.build-image.outputs.tags }}
155- registry : ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}
156- username : ${{ secrets.IMG_REGISTRY_USERNAME }}
157- password : ${{ secrets.IMG_REGISTRY_TOKEN }}
149+ provenance : false
158150 - name : Print Image URL
159- run : echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
151+ run : |
152+ echo "Image(s) pushed:"
153+ echo "${{ steps.meta.outputs.tags }}"
160154
161155 build-catalog :
162156 name : Build and push catalog image
@@ -171,18 +165,8 @@ jobs:
171165 with :
172166 go-version-file : go.mod
173167 id : go
174- - name : Add latest tag
175- if : ${{ github.ref_name == env.MAIN_BRANCH_NAME }}
176- id : add-latest-tag
177- run : |
178- echo "IMG_TAGS=latest ${{ env.IMG_TAGS }}" >> $GITHUB_ENV
179- - name : Add release tag
180- if : ${{ github.ref_name != env.MAIN_BRANCH_NAME }}
181- id : add-branch-tag
182- run : |
183- TAG_NAME=${GITHUB_REF_NAME/\//-}
184- echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
185- echo "IMG_TAGS=${TAG_NAME} ${{ env.IMG_TAGS }}" >> $GITHUB_ENV
168+ - name : Set up Docker Buildx
169+ uses : docker/setup-buildx-action@v3
186170 - name : Set Operator version
187171 id : operator-version
188172 run : |
@@ -192,10 +176,15 @@ jobs:
192176 else
193177 echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV
194178 fi
195- - name : Install qemu dependency
196- run : |
197- sudo apt-get update
198- sudo apt-get install -y qemu-user-static
179+ - name : Extract metadata
180+ id : meta
181+ uses : docker/metadata-action@v5
182+ with :
183+ images : ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/${{ env.OPERATOR_NAME }}-catalog
184+ tags : |
185+ type=raw,value=${{ github.sha }}
186+ type=raw,value=latest,enable={{is_default_branch}}
187+ type=ref,event=branch,enable={{is_not_default_branch}}
199188 - name : Run make catalog (main)
200189 if : ${{ github.ref_name == env.MAIN_BRANCH_NAME }}
201190 run : |
@@ -215,25 +204,24 @@ jobs:
215204 CHANNELS=${{ inputs.channels }}
216205 - name : Git diff
217206 run : git diff
218- - name : Build Image
219- id : build-image
220- uses : redhat-actions/buildah-build@v2
221- with :
222- image : ${{ env.OPERATOR_NAME }}-catalog
223- tags : ${{ env.IMG_TAGS }}
224- platforms : linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
225- context : ./catalog
226- dockerfiles : |
227- ./catalog/${{ env.OPERATOR_NAME }}-catalog.Dockerfile
228- - name : Push Image
207+ - name : Login to Container Registry
229208 if : ${{ !env.ACT }}
230- id : push-to-quay
231- uses : redhat-actions/push-to-registry@v2
209+ uses : docker/login-action@v3
232210 with :
233- image : ${{ steps.build-image.outputs.image }}
234- tags : ${{ steps.build-image.outputs.tags }}
235- registry : ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}
211+ registry : ${{ env.IMG_REGISTRY_HOST }}
236212 username : ${{ secrets.IMG_REGISTRY_USERNAME }}
237213 password : ${{ secrets.IMG_REGISTRY_TOKEN }}
214+ - name : Build Image
215+ id : build-image
216+ uses : docker/build-push-action@v5
217+ with :
218+ context : ./catalog
219+ file : ./catalog/${{ env.OPERATOR_NAME }}-catalog.Dockerfile
220+ platforms : linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
221+ push : ${{ !env.ACT }}
222+ tags : ${{ steps.meta.outputs.tags }}
223+ provenance : false
238224 - name : Print Image URL
239- run : echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
225+ run : |
226+ echo "Image(s) pushed:"
227+ echo "${{ steps.meta.outputs.tags }}"
0 commit comments