Skip to content

Commit 943be83

Browse files
reimplement tag updates
Signed-off-by: greg pereira <grpereir@redhat.com>
1 parent fd3ba69 commit 943be83

File tree

5 files changed

+157
-62
lines changed

5 files changed

+157
-62
lines changed

.github/workflows/pr-images.yml

Lines changed: 81 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ env:
1515

1616
jobs:
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:
@@ -28,6 +28,15 @@ jobs:
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:
@@ -82,7 +91,7 @@ jobs:
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

.github/workflows/release-images.yml

Lines changed: 65 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,26 @@ jobs:
6868
if: ${{ steps.get_release_tag.outputs.result }} != ""
6969
run: |
7070
TAGS="${{ steps.ghcr_ui_meta.outputs.tags }}"
71-
RELEASE_TAG="pr-${{ steps.get_release_tag.outputs.RELEASE_TAG }}"
71+
RELEASE_TAG="release-${{ steps.get_release_tag.outputs.RELEASE_TAG }}"
7272
COMBINED_TAGS="${RELEASE_TAG},${TAGS}"
7373
echo "COMBINED_TAGS=$COMBINED_TAGS" >> $GITHUB_ENV
74+
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
7475
7576
- name: Extract metadata (tags, labels) for UI image
7677
id: quay_ui_meta
7778
uses: docker/metadata-action@v5
7879
with:
7980
images: ${{ env.QUAY_REGISTRY }}/${{ env.QUAY_UI_IMAGE_NAME }}
8081

81-
- name: Combine GHCR Tags with PR Tag
82+
- name: Combine Quay Tags with PR Tag
8283
id: combined_quay_ui_tags
8384
if: ${{ steps.get_release_tag.outputs.result }} != ""
8485
run: |
8586
TAGS="${{ steps.quay_ui_meta.outputs.tags }}"
86-
RELEASE_TAG="pr-${{ steps.get_release_tag.outputs.result }}"
87+
RELEASE_TAG="release-${{ steps.get_release_tag.outputs.result }}"
8788
COMBINED_TAGS="${RELEASE_TAG},${TAGS}"
8889
echo "COMBINED_TAGS=$COMBINED_TAGS" >> $GITHUB_ENV
90+
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
8991
9092
- name: Build and push ui image to ghcr.io
9193
id: push-ui-ghcr
@@ -100,7 +102,7 @@ jobs:
100102
cache-to: type=gha,mode=max
101103
file: Containerfile
102104

103-
- name: Generate artifact attestation
105+
- name: Generate Prod UI GHCR artifact attestation
104106
uses: actions/attest-build-provenance@v1
105107
with:
106108
subject-name: ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_UI_IMAGE_NAME}}
@@ -120,6 +122,32 @@ jobs:
120122
cache-to: type=gha,mode=max
121123
file: Containerfile
122124

125+
- name: Generate PROD UI Quay artifact attestation
126+
uses: actions/attest-build-provenance@v1
127+
with:
128+
subject-name: ${{ env.QUAY_REGISTRY }}/${{ env.QUAY_UI_IMAGE_NAME}}
129+
subject-digest: ${{ steps.push-ui-quay.outputs.digest }}
130+
push-to-registry: true
131+
132+
- name: Update Prod Quay PS image
133+
id: update_prod_ui_manifest_image
134+
env:
135+
RELEASE_TAG: ${{ steps.combined_quay_ui_tags.outputs.RELEASE_TAG }}
136+
run: |
137+
sudo wget https://github.com/mikefarah/yq/releases/download/v4.34.1/yq_linux_amd64 -O /usr/local/bin/yq
138+
sudo chmod +x /usr/local/bin/yq
139+
RELEASE_TAG="${RELEASE_TAG}" yq -i '
140+
(.images[] | select(.name == "quay.io/instructlab-ui/ui") | .newTag) = '$RELEASE_TAG'
141+
' deploy/k8s/overlays/openshift/prod/kustomization.yaml
142+
143+
- name: Commit and push bump to Prod UI image manifest
144+
run: |
145+
git config --global user.name "${GITHUB_ACTOR}"
146+
git config --global user.email "${GITHUB_ACTOR}@users.noreply.${INPUT_ORGANIZATION_DOMAIN}"
147+
git add deploy/k8s/overlays/openshift/prod/kustomization.yaml
148+
git commit -m "[CI AUTOMATION]: Bumping Prod UI image to tag: ${{ steps.combined_quay_ui_tags.outputs.RELEASE_TAG }}" -s -S
149+
git push origin main --force
150+
123151
build_and_publish_ps_prod_image:
124152
name: Push UI container image to GHCR and QUAY
125153
runs-on: ubuntu-latest
@@ -176,24 +204,26 @@ jobs:
176204
if: ${{ steps.get_release_tag.outputs.result }} != ""
177205
run: |
178206
TAGS="${{ steps.ghcr_ps_meta.outputs.tags }}"
179-
RELEASE_TAG="pr-${{ steps.get_release_tag.outputs.RELEASE_TAG }}"
207+
RELEASE_TAG="release-${{ steps.get_release_tag.outputs.RELEASE_TAG }}"
180208
COMBINED_TAGS="${RELEASE_TAG},${TAGS}"
181209
echo "COMBINED_TAGS=$COMBINED_TAGS" >> $GITHUB_ENV
210+
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
182211
183212
- name: Extract metadata (tags, labels) for PS image
184213
id: quay_ps_meta
185214
uses: docker/metadata-action@v5
186215
with:
187216
images: ${{ env.QUAY_REGISTRY }}/${{ env.QUAY_PS_IMAGE_NAME }}
188217

189-
- name: Combine GHCR Tags with PR Tag
218+
- name: Combine Quay Tags with PR Tag
190219
id: combined_quay_ps_tags
191220
if: ${{ steps.get_release_tag.outputs.result }} != ""
192221
run: |
193222
TAGS="${{ steps.quay_ps_meta.outputs.tags }}"
194-
RELEASE_TAG="pr-${{ steps.get_release_tag.outputs.result }}"
223+
RELEASE_TAG="release-${{ steps.get_release_tag.outputs.result }}"
195224
COMBINED_TAGS="${RELEASE_TAG},${TAGS}"
196225
echo "COMBINED_TAGS=$COMBINED_TAGS" >> $GITHUB_ENV
226+
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
197227
198228
- name: Build and push ps image to ghcr.io
199229
id: push-ps-ghcr
@@ -208,14 +238,14 @@ jobs:
208238
cache-to: type=gha,mode=max
209239
file: Containerfile
210240

211-
- name: Generate artifact attestation
241+
- name: Generate GHCR PS Image attestation
212242
uses: actions/attest-build-provenance@v1
213243
with:
214244
subject-name: ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_PS_IMAGE_NAME}}
215245
subject-digest: ${{ steps.push-ps-ghcr.outputs.digest }}
216246
push-to-registry: true
217247

218-
- name: Build and push PS image to quay.io
248+
- name: Build and push PS image to Quay.io
219249
id: push-ps-quay
220250
uses: docker/build-push-action@v6
221251
with:
@@ -227,4 +257,29 @@ jobs:
227257
cache-from: type=gha
228258
cache-to: type=gha,mode=max
229259
file: Containerfile
230-
260+
261+
- name: Generate Quay PS Image attestation
262+
uses: actions/attest-build-provenance@v1
263+
with:
264+
subject-name: ${{ env.QUAY_REGISTRY }}/${{ env.QUAY_PS_IMAGE_NAME}}
265+
subject-digest: ${{ steps.push-ps-quay.outputs.digest }}
266+
push-to-registry: true
267+
268+
- name: Update Prod Quay PS image
269+
id: update_prod_ps_manifest_image
270+
env:
271+
RELEASE_TAG: ${{ steps.combined_quay_ps_tags.outputs.RELEASE_TAG }}
272+
run: |
273+
sudo wget https://github.com/mikefarah/yq/releases/download/v4.34.1/yq_linux_amd64 -O /usr/local/bin/yq
274+
sudo chmod +x /usr/local/bin/yq
275+
RELEASE_TAG="${RELEASE_TAG}" yq -i '
276+
(.images[] | select(.name == "quay.io/instructlab-ui/pathservice") | .newTag) = '$RELEASE_TAG'
277+
' deploy/k8s/overlays/openshift/prod/kustomization.yaml
278+
279+
- name: Commit and push bump to Prod PS image manifest
280+
run: |
281+
git config --global user.name "${GITHUB_ACTOR}"
282+
git config --global user.email "${GITHUB_ACTOR}@users.noreply.${INPUT_ORGANIZATION_DOMAIN}"
283+
git add deploy/k8s/overlays/openshift/prod/kustomization.yaml
284+
git commit -m "[CI AUTOMATION]: Bumping Prod PS image to tag: ${{ steps.combined_quay_ps_tags.outputs.RELEASE_TAG }}" -s -S
285+
git push origin main --force

deploy/k8s/overlays/openshift/prod/kustomization.yaml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,15 @@ patches:
2424
path: /spec/tls/0/hosts/0
2525
value: ui.instructlab.ai
2626
27-
# Override the UI image for Openshift production deployment
28-
- target:
29-
kind: Deployment
30-
name: ui
31-
patch: |-
32-
- op: replace
33-
path: /spec/template/spec/containers/0/image
34-
value: quay.io/instructlab-ui/ui:latest
35-
36-
# Override the pathservice image for Openshift production deployment
37-
- target:
38-
kind: Deployment
39-
name: pathservice
40-
patch: |-
41-
- op: replace
42-
path: /spec/template/spec/containers/0/image
43-
value: quay.io/instructlab-ui/pathservice:latest
44-
4527
- target:
4628
kind: Deployment
4729
name: ui
4830
patch: |-
4931
- op: replace
5032
path: /spec/template/spec/containers/0/envFrom/0/secretRef/name
5133
value: prod.env
34+
images:
35+
- name: quay.io/instructlab-ui/ui
36+
newTag: latest
37+
- name: quay.io/instructlab-ui/pathservice
38+
newTag: latest

0 commit comments

Comments
 (0)