From 4ab656eaf1860e9e6eb444d9849b2d0765e34870 Mon Sep 17 00:00:00 2001 From: Chris Berg Date: Fri, 25 Oct 2024 15:22:56 -0700 Subject: [PATCH 1/2] feat: integrating frontend loadtests w/ token into pipeline --- .github/workflows/loadtest.yml | 7 +------ loadtests/{ => dops}/orbc_load_test_plan_dops.jmx | 0 .../orbc_load_test_plan_frontend.jmx | 14 +++++++------- .../orbc_load_test_plan_vehicles.jmx | 0 4 files changed, 8 insertions(+), 13 deletions(-) rename loadtests/{ => dops}/orbc_load_test_plan_dops.jmx (100%) rename loadtests/{ => frontend}/orbc_load_test_plan_frontend.jmx (99%) rename loadtests/{ => vehicles}/orbc_load_test_plan_vehicles.jmx (100%) diff --git a/.github/workflows/loadtest.yml b/.github/workflows/loadtest.yml index e94078bf2..d5f83a2ce 100644 --- a/.github/workflows/loadtest.yml +++ b/.github/workflows/loadtest.yml @@ -20,10 +20,6 @@ on: default: onroutebc-test-vehicles.apps.silver.devops.gov.bc.ca required: true type: string - bearer_token: - description: "The bearer token pertaining to the user running the tests" - required: true - type: string jobs: loadtests: @@ -37,12 +33,11 @@ jobs: - name: Run All JMeter Tests In tests Folder uses: rbhadti94/apache-jmeter-action@v0.5.0 with: - testFilePath: loadtests + testFilePath: loadtests/frontend/orbc_load_test_plan_frontend.jmx outputReportsFolder: loadtests/results args: | --loglevel INFO --jmeterlogconf=log.conf - -JBEARER_TOKEN=${{inputs.bearer_token}} -JDOPS_API_URL=${{inputs.dops_api_url}} -JFRONTEND_API_URL=${{inputs.frontend_api_url}} -JVEHICLES_API_URL=${{inputs.vehicles_api_url}} diff --git a/loadtests/orbc_load_test_plan_dops.jmx b/loadtests/dops/orbc_load_test_plan_dops.jmx similarity index 100% rename from loadtests/orbc_load_test_plan_dops.jmx rename to loadtests/dops/orbc_load_test_plan_dops.jmx diff --git a/loadtests/orbc_load_test_plan_frontend.jmx b/loadtests/frontend/orbc_load_test_plan_frontend.jmx similarity index 99% rename from loadtests/orbc_load_test_plan_frontend.jmx rename to loadtests/frontend/orbc_load_test_plan_frontend.jmx index 1e93abd1d..787706c63 100644 --- a/loadtests/orbc_load_test_plan_frontend.jmx +++ b/loadtests/frontend/orbc_load_test_plan_frontend.jmx @@ -82,17 +82,17 @@ FRONTEND_API_URL - onroutebc-test-frontend.apps.silver.devops.gov.bc.ca/ + ${FRONTEND_API_URL} = VEHICLES_API_URL - onroutebc-test-vehicles.apps.silver.devops.gov.bc.ca/ + ${VEHICLES_API_URL} = DOPS_API_URL - onroutebc-test-dops.apps.silver.devops.gov.bc.ca/ + ${DOPS_API_URL} = @@ -2753,7 +2753,7 @@ - + continue false @@ -5422,7 +5422,7 @@ - + continue false @@ -7706,7 +7706,7 @@ - + continue false @@ -10055,7 +10055,7 @@ - + continue false diff --git a/loadtests/orbc_load_test_plan_vehicles.jmx b/loadtests/vehicles/orbc_load_test_plan_vehicles.jmx similarity index 100% rename from loadtests/orbc_load_test_plan_vehicles.jmx rename to loadtests/vehicles/orbc_load_test_plan_vehicles.jmx From 240ae0d96beb60e7b0f107506284f3c2c833139b Mon Sep 17 00:00:00 2001 From: Chris Berg Date: Mon, 25 Nov 2024 10:59:23 -0800 Subject: [PATCH 2/2] feat: added release version injection into pipeline --- .github/workflows/deploy.yml | 14 +++++++++++--- .github/workflows/merge.yml | 1 + .github/workflows/pr-close.yml | 2 +- .github/workflows/pr-open.yml | 3 ++- .github/workflows/release.yml | 2 ++ charts/onroutebc/values.yaml | 28 +++++++++++++++++++--------- 6 files changed, 36 insertions(+), 14 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8258f496b..5e824e37f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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 @@ -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 @@ -107,6 +113,7 @@ on: type: string env: + app_version: ${{ inputs.appVersion | quote }} repo_release: ${{ inputs.repository }}-${{ inputs.release }} package_tag: ${{ inputs.tag }} @@ -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 }} \ diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 97ce93ebb..3e51ae0da 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -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: diff --git a/.github/workflows/pr-close.yml b/.github/workflows/pr-close.yml index 5b66b040a..e8a6de3bd 100644 --- a/.github/workflows/pr-close.yml +++ b/.github/workflows/pr-close.yml @@ -1,4 +1,4 @@ -name: PR Closed +name: PR Close on: pull_request: diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index ea34523c5..428a44dfd 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -1,4 +1,4 @@ -name: PR +name: PR Open on: pull_request: @@ -80,4 +80,5 @@ jobs: uses: ./.github/workflows/dev.yml secrets: inherit with: + appVersion: ${{ needs.vars.outputs.pr }} tag: ${{ needs.vars.outputs.pr }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fbf2a8dae..fea212537 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: @@ -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: diff --git a/charts/onroutebc/values.yaml b/charts/onroutebc/values.yaml index a425a7b45..8a6f92d74 100644 --- a/charts/onroutebc/values.yaml +++ b/charts/onroutebc/values.yaml @@ -1,5 +1,6 @@ --- global: + appVersion: "" # The release version of the application autoscaling: true license: "c28f0c" podAnnotations: | @@ -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", @@ -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 @@ -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 @@ -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 @@ -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 @@ -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