Skip to content

Commit 119a484

Browse files
fix(ci): deploy PR environments by commit SHA so every push rolls out (#337)
1 parent d705c60 commit 119a484

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

.github/workflows/pr-open.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ jobs:
3838
- uses: bcgov/action-builder-ghcr@cb2629351c87dd1c2130073e4ebb7233a9653a63 # v4.4.1
3939
with:
4040
package: ${{ matrix.package }}
41-
tags: ${{ github.event.number }}
41+
# The PR tag is mutable (reused every push) and is what merge.yml
42+
# deploys/promotes; the head SHA tag is immutable and is what PR
43+
# deploys use, so each push changes the pod spec and forces a rollout.
44+
tags: |
45+
${{ github.event.number }}
46+
${{ github.event.pull_request.head.sha }}
4247
tag_fallback: latest
4348
triggers: ('${{ matrix.package }}/', 'common/', '.github/workflows/')
4449
build_args: |
@@ -51,6 +56,7 @@ jobs:
5156
secrets: inherit
5257
with:
5358
target: ${{ needs.init.outputs.zone }}
59+
tag: ${{ github.event.pull_request.head.sha }}
5460
triggers: ('backend/', 'frontend/', 'common/', '.github/workflows/')
5561

5662
tests:

backend/openshift.deploy.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ parameters:
1313
- name: IMAGE_TAG
1414
description: Image tag to use
1515
required: true
16+
# PR deploys pass the immutable head SHA as IMAGE_TAG, so every push changes
17+
# the pod spec and forces a rollout (the mutable PR-number tag would leave
18+
# `oc apply` seeing an unchanged Deployment and keep serving the stale image
19+
# despite imagePullPolicy: Always). Test deploys (merge.yml) use the
20+
# PR-number tag, which is unique per merge, so the spec changes there too.
1621
- name: REGISTRY
1722
description: Container registry to import from
1823
value: ghcr.io
@@ -31,7 +36,7 @@ parameters:
3136
- name: CPU_REQUEST
3237
value: "30m"
3338
- name: MEMORY_REQUEST
34-
value: "384Mi"
39+
value: "256Mi"
3540
- name: MEMORY_LIMIT
3641
description: Container memory limit; the JVM heap sizes itself from this cgroup limit via MaxRAMPercentage (see backend/Dockerfile). Raised for the embedded JasperReports 7 engine (Batik/OpenPDF/fonts add classpath + metaspace + native AWT footprint) per AD-16 "size the reporting path's pod CPU/Mem".
3742
value: "1Gi"

frontend/openshift.deploy.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ parameters:
1313
- name: IMAGE_TAG
1414
description: Image tag to use
1515
required: true
16+
# PR deploys pass the immutable head SHA as IMAGE_TAG, so every push changes
17+
# the pod spec and forces a rollout (the mutable PR-number tag would leave
18+
# `oc apply` seeing an unchanged Deployment and keep serving the stale image
19+
# despite imagePullPolicy: Always). Test deploys (merge.yml) use the
20+
# PR-number tag, which is unique per merge, so the spec changes there too.
1621
- name: REGISTRY
1722
description: Container registry to import from
1823
value: ghcr.io

0 commit comments

Comments
 (0)