Skip to content

Commit

Permalink
feat: added release version injection into pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
cberg-aot committed Nov 25, 2024
1 parent 3d10f41 commit 240ae0d
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 14 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ on:
description: 'PR number, test or prod.'
required: true
type: string

appVersion:
description: 'PR number or Github Release Tag.'
required: true
type: string
repository:
description: 'repository name.'
required: false
Expand Down Expand Up @@ -65,7 +68,10 @@ on:
required: true
type: string
default: "demo"

appVersion:
description: 'PR number or Github Release Tag.'
required: true
type: string
repository:
description: 'repository name.'
required: false
Expand Down Expand Up @@ -107,6 +113,7 @@ on:
type: string

env:
app_version: ${{ inputs.appVersion | quote }}
repo_release: ${{ inputs.repository }}-${{ inputs.release }}
package_tag: ${{ inputs.tag }}

Expand Down Expand Up @@ -179,7 +186,8 @@ jobs:
helm upgrade \
--set global.autoscaling=${{ inputs.autoscaling }} \
--set-string global.repository=${{ github.repository }} \
--set-string global.tag=${{ inputs.tag }} \
--set-string global.tag=${{ env.package_tag }} \
--set-string global.appVersion=${{ env.app_version }} \
--install --wait --atomic ${{ env.repo_release }} \
--timeout 10m --force \
--values ${{ inputs.values }} \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
uses: ./.github/workflows/test.yml
secrets: inherit
with:
appVersion: ${{ needs.vars.outputs.pr }}
tag: ${{ needs.vars.outputs.pr }}

promote-images-test:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-close.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PR Closed
name: PR Close

on:
pull_request:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PR
name: PR Open

on:
pull_request:
Expand Down Expand Up @@ -80,4 +80,5 @@ jobs:
uses: ./.github/workflows/dev.yml
secrets: inherit
with:
appVersion: ${{ needs.vars.outputs.pr }}
tag: ${{ needs.vars.outputs.pr }}
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
uses: ./.github/workflows/uat.yml
secrets: inherit
with:
appVersion: ${{ needs.vars.outputs.release-name }}
tag: ${{ needs.vars.outputs.pr }}

promote-images-uat:
Expand All @@ -82,6 +83,7 @@ jobs:
uses: ./.github/workflows/prod.yml
secrets: inherit
with:
appVersion: ${{ needs.vars.outputs.release-name }}
tag: ${{ needs.vars.outputs.pr }}

promote-images-prod:
Expand Down
28 changes: 19 additions & 9 deletions charts/onroutebc/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
global:
appVersion: "" # The release version of the application
autoscaling: true
license: "c28f0c"
podAnnotations: |
Expand Down Expand Up @@ -34,7 +35,6 @@ frontend:
ACCESS_API_URL: "https://{{.Release.Name}}-vehicles.apps.silver.devops.gov.bc.ca"
POLICY_URL: "https://{{.Release.Name}}-policy.apps.silver.devops.gov.bc.ca"
DEPLOY_ENVIRONMENT: "{{.Values.global.vault.zone}}"
FRONTEND_PR_NUM: "{{.Values.global.pr_num}}"
config.js.template: |-
const envConfig = (() => { return {
"VITE_DEPLOY_ENVIRONMENT":"$DEPLOY_ENVIRONMENT",
Expand Down Expand Up @@ -64,11 +64,13 @@ frontend:
key: POLICY_URL
- name: DEPLOY_ENVIRONMENT
key: DEPLOY_ENVIRONMENT
- name: FRONTEND_PR_NUM
key: FRONTEND_PR_NUM
fromValues:
- name: TIMESTAMP
value: "{{ now | toString }}"
- name: FRONTEND_PR_NUM
value: '{{.Values.global.pr_num}}'
- name: APPLICATION_VERSION
value: "{{.Values.global.appVersion}}"
ports:
- name: http
containerPort: 3000
Expand Down Expand Up @@ -205,6 +207,8 @@ vehicles:
value: "{{ now | toString }}"
- name: VEHICLES_PR_NUM
value: '{{.Values.global.pr_num}}'
- name: APPLICATION_VERSION
value: "{{.Values.global.appVersion}}"
ports:
- name: vehicles-api
containerPort: 5000
Expand Down Expand Up @@ -340,10 +344,12 @@ dops:
- name: ACCESS_API_URL
key: ACCESS_API_URL
fromValues:
- name: DOPS_PR_NUM
value: '{{.Values.global.pr_num}}'
- name: TIMESTAMP
value: "{{ now | toString }}"
- name: DOPS_PR_NUM
value: '{{.Values.global.pr_num}}'
- name: APPLICATION_VERSION
value: "{{.Values.global.appVersion}}"
ports:
- name: dops-api
containerPort: 5001
Expand Down Expand Up @@ -474,10 +480,12 @@ scheduler:
- name: ACCESS_API_URL
key: ACCESS_API_URL
fromValues:
- name: SCHEDULER_PR_NUM
value: '{{.Values.global.pr_num}}'
- name: TIMESTAMP
value: "{{ now | toString }}"
- name: SCHEDULER_PR_NUM
value: '{{.Values.global.pr_num}}'
- name: APPLICATION_VERSION
value: "{{.Values.global.appVersion}}"
ports:
- name: scheduler
containerPort: 5050
Expand Down Expand Up @@ -576,10 +584,12 @@ policy:
tag: "{{tpl .Values.global.tag .}}"
env:
fromValues:
- name: POLICY_PR_NUM
value: '{{.Values.global.pr_num}}'
- name: TIMESTAMP
value: "{{ now | toString }}"
- name: POLICY_PR_NUM
value: '{{.Values.global.pr_num}}'
- name: APPLICATION_VERSION
value: "{{.Values.global.appVersion}}"
ports:
- name: policy-api
containerPort: 5002
Expand Down

0 comments on commit 240ae0d

Please sign in to comment.