1515
1616jobs :
1717 build_and_publish_ui_qa_image :
18- name : Push UI container image to GHCR and QUAY
18+ name : Push QA UI container image to GHCR and QUAY
1919 runs-on : ubuntu-latest
2020 environment : registry-creds
2121 permissions :
2828 - name : Check out the repo
2929 uses : actions/checkout@v4
3030
31+ - name : Skip if triggered by GitHub Actions bot
32+ id : check-skip
33+ run : |
34+ if [[ "$(git log -1 --pretty=format:'%s')" == *"[CI AUTOMATION]:"* ]]; then
35+ echo "Workflow triggered by previous action commit. Skipping."
36+ exit 1
37+ fi
38+ exit 0
39+
3140 - name : Log in to the GHCR container image registry
3241 uses : docker/login-action@v3
3342 with :
8291 console.log("No merged PR found in the recent closed PRs.");
8392 return '';
8493
85- - name : Extract metadata (tags, labels) for UI image
94+ - name : Extract GHCR metadata (tags, labels) for UI image
8695 id : ghcr_ui_meta
8796 uses : docker/metadata-action@v5
8897 with :
@@ -96,21 +105,23 @@ jobs:
96105 PR_TAG="pr-${{ steps.get_pr_number.outputs.result }}"
97106 COMBINED_TAGS="${PR_TAG},${TAGS}"
98107 echo "COMBINED_TAGS=$COMBINED_TAGS" >> $GITHUB_ENV
108+ echo "PR_TAG=$PR_TAG" >> $GITHUB_ENV
99109
100- - name : Extract metadata (tags, labels) for UI image
110+ - name : Extract Quay metadata (tags, labels) for UI image
101111 id : quay_ui_meta
102112 uses : docker/metadata-action@v5
103113 with :
104114 images : ${{ env.QUAY_REGISTRY }}/${{ env.QUAY_UI_IMAGE_NAME }}
105115
106- - name : Combine GHCR Tags with PR Tag
116+ - name : Combine Quay Tags with PR Tag
107117 id : combined_quay_ui_tags
108118 if : ${{ steps.get_pr_number.outputs.result }} != ""
109119 run : |
110120 TAGS="${{ steps.quay_ui_meta.outputs.tags }}"
111121 PR_TAG="pr-${{ steps.get_pr_number.outputs.result }}"
112122 COMBINED_TAGS="${PR_TAG},${TAGS}"
113123 echo "COMBINED_TAGS=$COMBINED_TAGS" >> $GITHUB_ENV
124+ echo "PR_TAG=$PR_TAG" >> $GITHUB_ENV
114125
115126 - name : Build and push ui image to ghcr.io
116127 id : push-ui-ghcr
@@ -125,7 +136,7 @@ jobs:
125136 cache-to : type=gha,mode=max
126137 file : Containerfile
127138
128- - name : Generate artifact attestation
139+ - name : Generate GHCR artifact attestation
129140 uses : actions/attest-build-provenance@v1
130141 with :
131142 subject-name : ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_UI_IMAGE_NAME}}
@@ -144,9 +155,35 @@ jobs:
144155 cache-from : type=gha
145156 cache-to : type=gha,mode=max
146157 file : Containerfile
158+
159+ - name : Generate QA UI Quay artifact attestation
160+ uses : actions/attest-build-provenance@v1
161+ with :
162+ subject-name : ${{ env.QUAY_REGISTRY }}/${{ env.QUAY_UI_IMAGE_NAME}}
163+ subject-digest : ${{ steps.push-ui-quay.outputs.digest }}
164+ push-to-registry : true
165+
166+ - name : Update QA Quay UI image
167+ id : update_qa_ui_manifest_image
168+ env :
169+ PR_TAG : ${{ steps.combined_quay_ui_tags.outputs.PR_TAG }}
170+ run : |
171+ sudo wget https://github.com/mikefarah/yq/releases/download/v4.34.1/yq_linux_amd64 -O /usr/local/bin/yq
172+ sudo chmod +x /usr/local/bin/yq
173+ PR_TAG="${PR_TAG}" yq -i '
174+ (.images[] | select(.name == "quay.io/instructlab-ui/ui") | .newTag) = '$PR_TAG'
175+ ' deploy/k8s/overlays/openshift/qa/kustomization.yaml
176+
177+ - name : Commit and push bump QA UI Image manifest
178+ run : |
179+ git config --global user.name "${GITHUB_ACTOR}"
180+ git config --global user.email "${GITHUB_ACTOR}@users.noreply.${INPUT_ORGANIZATION_DOMAIN}"
181+ git add deploy/k8s/overlays/openshift/qa/kustomization.yaml
182+ git commit -m "[CI AUTOMATION]: Bumping QA UI image to tag: ${{ steps.combined_quay_ui_tags.outputs.PR_TAG }}" -s -S
183+ git push origin main --force
147184
148185 build_and_publish_ps_qa_image :
149- name : Push pathservice container image to GHCR and QUAY
186+ name : Push QA pathservice container image to GHCR and QUAY
150187 runs-on : ubuntu-latest
151188 environment : registry-creds
152189 permissions :
@@ -159,6 +196,15 @@ jobs:
159196 - name : Check out the repo
160197 uses : actions/checkout@v4
161198
199+ - name : Skip if triggered by GitHub Actions bot
200+ id : check-skip
201+ run : |
202+ if [[ "$(git log -1 --pretty=format:'%s')" == *"[CI AUTOMATION]:"* ]]; then
203+ echo "Workflow triggered by previous action commit. Skipping."
204+ exit 1
205+ fi
206+ exit 0
207+
162208 - name : Log in to the GHCR container image registry
163209 uses : docker/login-action@v3
164210 with :
@@ -227,6 +273,7 @@ jobs:
227273 PR_TAG="pr-${{ steps.get_pr_number.outputs.result }}"
228274 COMBINED_TAGS="${PR_TAG},${TAGS}"
229275 echo "COMBINED_TAGS=$COMBINED_TAGS" >> $GITHUB_ENV
276+ echo "PR_TAG=$PR_TAG" >> $GITHUB_ENV
230277
231278 - name : Extract metadata (tags, labels) for pathservice image
232279 id : quay_ps_meta
@@ -242,8 +289,9 @@ jobs:
242289 PR_TAG="pr-${{ steps.get_pr_number.outputs.result }}"
243290 COMBINED_TAGS="${PR_TAG},${TAGS}"
244291 echo "COMBINED_TAGS=$COMBINED_TAGS" >> $GITHUB_ENV
292+ echo "PR_TAG=$PR_TAG" >> $GITHUB_ENV
245293
246- - name : Build and push pathservice image to ghcr.io
294+ - name : Build and push QA PS image to ghcr.io
247295 id : push-ps-ghcr
248296 uses : docker/build-push-action@v6
249297 with :
@@ -256,29 +304,48 @@ jobs:
256304 cache-to : type=gha,mode=max
257305 file : Containerfile.ps
258306
259- - name : Generate artifact attestation
307+ - name : Generate QA PS GHCR artifact attestation
260308 uses : actions/attest-build-provenance@v1
261309 with :
262310 subject-name : ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_PS_IMAGE_NAME}}
263311 subject-digest : ${{ steps.push-ps-ghcr.outputs.digest }}
264312 push-to-registry : true
265313
266- - name : Build and push ui image to quay.io
267- id : push-ui -quay
314+ - name : Build and push QA PS image to quay.io
315+ id : push-ps -quay
268316 uses : docker/build-push-action@v6
269317 with :
270318 context : .
271319 push : true
272- tags : ${{ steps.combined_ghcr_ps_tags .outputs.COMBINED_TAGS }}
320+ tags : ${{ steps.combined_quay_ps_tags .outputs.COMBINED_TAGS }}
273321 labels : ${{ steps.quay_ps_meta.outputs.labels }}
274322 platforms : linux/amd64,linux/arm64
275323 cache-from : type=gha
276324 cache-to : type=gha,mode=max
277325 file : Containerfile.ps
278326
279- - name : Generate artifact attestation
327+ - name : Generate QA PS Quay artifact attestation
280328 uses : actions/attest-build-provenance@v1
281329 with :
282- subject-name : ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_PS_IMAGE_NAME }}
283- subject-digest : ${{ steps.push-ps-ghcr .outputs.digest }}
330+ subject-name : ${{ env.QUAY_REGISTRY }}/${{ env.QUAY_PS_IMAGE_NAME }}
331+ subject-digest : ${{ steps.push-ps-quay .outputs.digest }}
284332 push-to-registry : true
333+
334+ - name : Update QA PS Quay image
335+ id : update_qa_ps_manifest_image
336+ env :
337+ PR_TAG : ${{ steps.combined_quay_ps_tags.outputs.PR_TAG }}
338+ run : |
339+ sudo wget https://github.com/mikefarah/yq/releases/download/v4.34.1/yq_linux_amd64 -O /usr/local/bin/yq
340+ sudo chmod +x /usr/local/bin/yq
341+ PR_TAG="${PR_TAG}" yq -i '
342+ (.images[] | select(.name == "quay.io/instructlab-ui/pathservice") | .newTag) = '$PR_TAG'
343+ ' deploy/k8s/overlays/openshift/qa/kustomization.yaml
344+
345+ - name : Commit and push bump QA PS Image manifest
346+ run : |
347+ git config --global user.name "${GITHUB_ACTOR}"
348+ git config --global user.email "${GITHUB_ACTOR}@users.noreply.${INPUT_ORGANIZATION_DOMAIN}"
349+ git add deploy/k8s/overlays/openshift/qa/kustomization.yaml
350+ git commit -m "[CI AUTOMATION]: Bumping QA PS image to tag: ${{ steps.combined_quay_ps_tags.outputs.PR_TAG }}" -s -S
351+ git push origin main --force
0 commit comments