Skip to content

Commit d237f95

Browse files
committed
udpating the database upgrade and helmfile apply stuff to use the right images, at the right times
1 parent 60a2347 commit d237f95

File tree

1 file changed

+50
-12
lines changed

1 file changed

+50
-12
lines changed

.github/workflows/dev_branch_deploy_images.yaml

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,59 @@ jobs:
6969
./helmfile/getContext.sh -g
7070
7171
- name: Run Database Upgrade Helmfile Sync
72-
uses: ./.github/actions/db-migration
73-
with:
74-
environment: "dev"
75-
namespace: "notification-canada-ca"
76-
app_label: "notify-database"
77-
timeout: "400s"
72+
id: db_migration
73+
run: |
74+
set -euo pipefail
75+
ENVIRONMENT="dev"
76+
NAMESPACE="notification-canada-ca"
77+
APP_LABEL="notify-database"
78+
DB_ARGS="upgrade"
79+
80+
pushd helmfile
81+
helmfile --environment "$ENVIRONMENT" -l app="$APP_LABEL" --state-values-set DB_ARGS="$DB_ARGS" sync
82+
83+
IMAGE_TAG=$(helm get values "$APP_LABEL" -n "$NAMESPACE" -o json | jq -r '.image.tag')
84+
RELEASE_REVISION=$(helm list -n "$NAMESPACE" -o json | jq -r ".[] | select(.name==\"$APP_LABEL\") | .revision")
85+
86+
echo "image_tag=${IMAGE_TAG}" >> "$GITHUB_OUTPUT"
87+
echo "release_revision=${RELEASE_REVISION}" >> "$GITHUB_OUTPUT"
88+
popd
89+
90+
- name: Wait for Database Migration Job Completion
91+
env:
92+
IMAGE_TAG: ${{ steps.db_migration.outputs.image_tag }}
93+
RELEASE_REVISION: ${{ steps.db_migration.outputs.release_revision }}
94+
run: |
95+
set -euo pipefail
96+
NAMESPACE="notification-canada-ca"
97+
TIMEOUT="400s"
98+
99+
echo "Using image tag: ${IMAGE_TAG}"
100+
echo "Using release revision: ${RELEASE_REVISION}"
78101
79-
- name: Helmfile apply for dev images
102+
kubectl wait --for=condition=complete "job/notify-db-migration-job-${IMAGE_TAG}-${RELEASE_REVISION}" \
103+
-n "$NAMESPACE" \
104+
--timeout="$TIMEOUT"
105+
106+
- name: Helmfile apply for all other releases
80107
run: |
81108
pushd helmfile
82-
helmfile --environment dev -l 'tier=crd' apply -- \
83-
--set image.repository="${REGISTRY}/api" \
84-
--set image.tag="latest"
85-
helmfile --environment dev -l 'app!=notify-database,tier!=crd' apply -- \
86-
--set image.repository="${REGISTRY}/api" \
109+
helmfile --environment dev -l 'tier=crd' apply
110+
helmfile --environment dev -l 'app!=notify-database,app!=notify-api,app!=notify-admin,app!=notify-document-download,tier!=crd' apply
111+
popd
112+
113+
- name: Helmfile apply for dev images (api, admin, document-download)
114+
strategy:
115+
fail-fast: false
116+
matrix:
117+
app:
118+
- api
119+
- admin
120+
- document-download
121+
run: |
122+
pushd helmfile
123+
helmfile --environment dev -l "app=notify-${{ matrix.app }}" apply -- \
124+
--set image.repository="${REGISTRY}/${{ matrix.app }}" \
87125
--set image.tag="latest"
88126
popd
89127

0 commit comments

Comments
 (0)