Skip to content

Commit

Permalink
Emergency Release 1.64.1 (#2383)
Browse files Browse the repository at this point in the history
bug fix (#2385)

---------

Co-authored-by: Emily <[email protected]>
  • Loading branch information
kuanfandevops and emi-hi authored Dec 18, 2024
1 parent c14cd42 commit 0eb6e89
Show file tree
Hide file tree
Showing 3 changed files with 215 additions and 2 deletions.
213 changes: 213 additions & 0 deletions .github/workflows/emergency-release-build-1.64.1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
## For each release, please update the value of workflow name, branches and PRE_RELEASE
## Also update frontend/package.json version

name: Emergency Release Build 1.64.1

on:
push:
branches: [release-1.64.1]
workflow_dispatch:
workflow_call:

env:
## The pull request number of the Tracking pull request to merge the release branch to main
VERSION: 1.64.1
GIT_URL: https://github.com/bcgov/zeva.git
TOOLS_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-tools
TEST_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-test
PROD_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-prod

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
install-oc:
runs-on: ubuntu-latest
outputs:
cache-hit: ${{ steps.cache.outputs.cache-hit }}
steps:
- name: Set up cache for OpenShift CLI
id: cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc # Path where the `oc` binary will be installed
key: oc-cli-${{ runner.os }}

- name: Install OpenShift CLI (if not cached)
if: steps.cache.outputs.cache-hit != 'true'
run: |
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz
tar -xvf openshift-client-linux.tar.gz
sudo mv oc kubectl /usr/local/bin/
oc version --client
- name: Confirm OpenShift CLI is Available
run: oc version --client

set-pre-release:
name: Calculate pre-release number
runs-on: ubuntu-latest
needs: [install-oc]
outputs:
PRE_RELEASE: ${{ steps.set-pre-release.outputs.PRE_RELEASE }}

steps:
- id: set-pre-release
run: |
echo "PRE_RELEASE=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
build:
name: Build ZEVA on Openshift
runs-on: ubuntu-latest
timeout-minutes: 60
needs: [set-pre-release]

env:
PRE_RELEASE: ${{ needs.set-pre-release.outputs.PRE_RELEASE }}

steps:
- name: Check out repository
uses: actions/[email protected]
with:
ref: release-${{ ENV.VERSION }}

- name: Restore oc command from Cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc
key: oc-cli-${{ runner.os }}

- name: Log in to Openshift
uses: redhat-actions/[email protected]
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
insecure_skip_tls_verify: true
namespace: ${{ env.TOOLS_NAMESPACE }}

- name: Build ZEVA Backend
run: |
cd openshift/templates/backend
oc process -f ./backend-bc-docker.yaml NAME=zeva SUFFIX=-${{ env.VERSION }}-${{ env.PRE_RELEASE }} VERSION=${{ env.VERSION }}-${{ env.PRE_RELEASE }} GIT_URL=${{ env.GIT_URL }} GIT_REF=release-${{ env.VERSION }} | oc apply --wait=true -f - -n ${{ env.TOOLS_NAMESPACE }}
oc start-build --wait=true zeva-backend-${{ env.VERSION }}-${{ env.PRE_RELEASE }}
- name: Build ZEVA Frontend
run: |
cd openshift/templates/frontend
oc process -f ./frontend-bc-docker.yaml NAME=zeva SUFFIX=-${{ env.VERSION }}-${{ env.PRE_RELEASE }} VERSION=${{ env.VERSION }}-${{ env.PRE_RELEASE }} GIT_URL=${{ env.GIT_URL }} GIT_REF=release-${{ env.VERSION }} | oc apply --wait=true -f - -n ${{ env.TOOLS_NAMESPACE }}
oc start-build --wait=true zeva-frontend-${{ env.VERSION }}-${{ env.PRE_RELEASE }}
deploy-on-test:
name: Deploy ZEVA on Test
runs-on: ubuntu-latest
timeout-minutes: 60
needs: [set-pre-release, build]

env:
PRE_RELEASE: ${{ needs.set-pre-release.outputs.PRE_RELEASE }}

steps:
- name: Ask for approval for ZEVA Test deployment
uses: trstringer/[email protected]
with:
secret: ${{ github.TOKEN }}
approvers: emi-hi,tim738745,kuanfandevops,rogerlcleung,JulianForeman
minimum-approvals: 1
issue-title: "ZEVA ${{ env.VERSION }}-${{ env.PRE_RELEASE }} Test Deployment"

- name: Checkout Manifest repository
uses: actions/[email protected]
with:
repository: bcgov-c/tenant-gitops-e52f12
ref: main
ssh-key: ${{ secrets.MANIFEST_REPO_DEPLOY_KEY }}

- name: Update frontend and backend image tags
uses: mikefarah/[email protected]
with:
cmd: |
yq -i '.frontend.image.tag = "${{ env.VERSION }}-${{ env.PRE_RELEASE }}"' zeva/values-test.yaml
yq -i '.backend.image.tag = "${{ env.VERSION }}-${{ env.PRE_RELEASE }}"' zeva/values-test.yaml
- name: Restore oc command from Cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc
key: oc-cli-${{ runner.os }}

- name: Log in to Openshift
uses: redhat-actions/[email protected]
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
insecure_skip_tls_verify: true
namespace: ${{ env.TOOLS_NAMESPACE }}

- name: Tag and deploy to Test
run: |
helm -n ${{ env.TEST_NAMESPACE }} list
oc tag ${{ env.TOOLS_NAMESPACE }}/zeva-backend:${{ env.VERSION }}-${{ env.PRE_RELEASE }} ${{ env.TEST_NAMESPACE }}/zeva-backend:${{ env.VERSION }}-${{ env.PRE_RELEASE }}
oc tag ${{ env.TOOLS_NAMESPACE }}/zeva-frontend:${{ env.VERSION }}-${{ env.PRE_RELEASE }} ${{ env.TEST_NAMESPACE }}/zeva-frontend:${{ env.VERSION }}-${{ env.PRE_RELEASE }}
cd zeva
helm -n ${{ env.TEST_NAMESPACE }} -f ./values-test.yaml upgrade --install zeva-test .
deploy-on-prod:
name: Deploy ZEVA on Prod
runs-on: ubuntu-latest
timeout-minutes: 240
needs: [set-pre-release, deploy-on-test]
env:
PRE_RELEASE: ${{ needs.set-pre-release.outputs.PRE_RELEASE }}

steps:

- name: Ask for approval for ZEVA Prod deployment
uses: trstringer/[email protected]
with:
secret: ${{ github.TOKEN }}
approvers: emi-hi,tim738745,kuanfandevops,rogerlcleung,JulianForeman
minimum-approvals: 1
issue-title: "ZEVA ${{ env.VERSION }}-${{ env.PRE_RELEASE }} Prod Deployment"

- name: Restore oc command from Cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc
key: oc-cli-${{ runner.os }}

- name: Log in to Openshift
uses: redhat-actions/[email protected]
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
insecure_skip_tls_verify: true
namespace: ${{ env.TOOLS_NAMESPACE }}

- name: Tag and Deploy to Prod
run: |
oc tag ${{ env.TOOLS_NAMESPACE }}/zeva-backend:${{ env.VERSION }}-${{ env.PRE_RELEASE }} ${{ env.PROD_NAMESPACE }}/zeva-backend:${{ env.VERSION }}-${{ env.PRE_RELEASE }}
oc tag ${{ env.TOOLS_NAMESPACE }}/zeva-frontend:${{ env.VERSION }}-${{ env.PRE_RELEASE }} ${{ env.PROD_NAMESPACE }}/zeva-frontend:${{ env.VERSION }}-${{ env.PRE_RELEASE }}
- name: Checkout Manifest repository
uses: actions/[email protected]
with:
repository: bcgov-c/tenant-gitops-e52f12
ref: main
ssh-key: ${{ secrets.MANIFEST_REPO_DEPLOY_KEY }}

- name: Update frontend and backend image tags
uses: mikefarah/[email protected]
with:
cmd: |
yq -i '.frontend.image.tag = "${{ env.VERSION }}-${{ env.PRE_RELEASE }}"' zeva/values-prod.yaml
yq -i '.backend.image.tag = "${{ env.VERSION }}-${{ env.PRE_RELEASE }}"' zeva/values-prod.yaml
- name: GitHub Commit & Push
shell: bash {0}
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git add zeva/values-prod.yaml
git commit -m "Update the image tag to ${{ env.VERSION }}-${{ env.PRE_RELEASE }} on Zeva Prod Environment"
git push
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zeva-frontend",
"version": "1.64.0",
"version": "1.64.1",
"private": true,
"dependencies": {
"@babel/eslint-parser": "^7.19.1",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/compliance/components/ConsumerLDVSales.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const ConsumerLDVSales = (props) => {
</div>
<div className="row mb-3">
<div className="col-5 text-blue">
{modelYear} {reportYear < 2024 ? "Model Year LDV Sales" : "Vehicles Supplied"}:
{modelYear} {modelYear < 2024 ? "Model Year LDV Sales" : "Vehicles Supplied"}:
</div>
<div className="col-3 text-right">{currentSales}</div>
<div className="col-3 text-right">
Expand Down

0 comments on commit 0eb6e89

Please sign in to comment.