Skip to content

Commit

Permalink
Tracking pull request to merge release-1.60.0 to master (#2190)
Browse files Browse the repository at this point in the history
* initial 1.60.0

* update pr number

* Update user-story-.md (#2198)

* Task: Reassessment Credit Modifications #2195 (#2214)

* Allowing all credit fields to me modified in reassessments

* Cleanup

* More cleanup

* feat: removes idir names from sales submission and vehicle comments (#2217)

* fix: 2215 - credit balances and recent reassessments (#2230)

* for emily to look at - suggested solution for rounding issues (#2234)

Co-authored-by: tim738745 <tim.chen@gov.bc.ca>

* chore: updates login instructions (removes references to creation_request table) (#2238)

* remove test data load for pr build

* update pr build

* increase resource for pr build

* only setup db for pr build

* update pr build

* New pipeline (#2229)

* add test ci (#2242)

* fix: removes unecessary data from transfer -- build-on-dev  (#2241)

* fix: removes unecessary data from transfer

* fix: new user serializer passes only basic user info to frontend
-get history modified so that approved and disapproved statuses created by government are  excluded so that communications/status changes within government are not shown in network tab

* removes id from user basic serializer

* emergency release 1.59.1

* update for emergency release 1.59.1

* emergency release stuff (#2260)

Co-authored-by: Kuan Fan <31664961+kuanfandevops@users.noreply.github.com>

* change version number to 1.59.1 (#2261)

* change package json number to 1.60.0 (#2262)

* Emergency Release 1.59.1 (#2258) (#2263)

* add emergency release-1.59.1

* add pull_request events

* Update package.json

* Transfer fix (#2244)

* fix: removes unecessary data from transfer

* fix: new user serializer passes only basic user info to frontend
-get history modified so that approved and disapproved statuses created by government are  excluded so that communications/status changes within government are not shown in network tab

* removes id from user basic serializer

* more fixes

* small change + tests

* Update version to be 1.59.1 in package.json

---------




* Update emergency-release-build-1.59.1.yaml

---------

Co-authored-by: Kuan Fan <31664961+kuanfandevops@users.noreply.github.com>
Co-authored-by: emi-hi <emily.hillier@gmail.com>

* revert post emergency release commits (#2264)

* update approval list

---------

Co-authored-by: Samuel Chukwuma Arawu <75506215+ArawuSamuel1@users.noreply.github.com>
Co-authored-by: JulianForeman <71847719+JulianForeman@users.noreply.github.com>
Co-authored-by: Emily <44536222+emi-hi@users.noreply.github.com>
Co-authored-by: tim738745 <98717409+tim738745@users.noreply.github.com>
Co-authored-by: tim738745 <tim.chen@gov.bc.ca>
Co-authored-by: emi-hi <emily.hillier@gmail.com>
  • Loading branch information
7 people authored Sep 24, 2024
1 parent 3543d4a commit c46d85a
Show file tree
Hide file tree
Showing 30 changed files with 708 additions and 197 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/user-story-.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ assignees: ''
**Title:**

**Description:**
- [ ] "As a [type of user]", "I want [an action or feature]", "So that [benefit or value]"

**Wireframe:** <link>

Expand Down
70 changes: 35 additions & 35 deletions .github/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

## Register the redirect url on SSO Console

* Open a brower to https://bcgov.github.io/sso-requests
* My Dashboard -> My Projects: edit project "Zeva on Gold"
* Add a new redirect url for Development environment, https://zeva-dev-<pr number>.apps.silver.devops.gov.bc.ca/*
* Submit the change
- Open a brower to https://bcgov.github.io/sso-requests
- My Dashboard -> My Projects: edit project "Zeva on Gold"
- Add a new redirect url for Development environment, https://zeva-dev-<pr number>.apps.silver.devops.gov.bc.ca/\*
- Submit the change

Notes: the change may take about 20 minutes to be promoted to Zeva development environment on Openshift

Expand All @@ -17,53 +17,53 @@ The "Build PR on Dev" pipeline will be triggered when it identified pull request

## Pre-production release

* Update the description of the tracking pull request
* Verify the changes made during the previous post production release
- Update the description of the tracking pull request
- Verify the changes made during the previous post production release

## Production release

* Manually trigger the pipeline release-build.yaml (Release Build 1.49.0)
- Manually trigger the pipeline release-build.yaml (Release Build 1.49.0)

## Post production release

### Merge the tracking pull request and create the new release branch

* Squash merge the tracking pull request to master
* Create the release on GitHub from master branch
* Create the new release branch from master branch (this is done automatically by pipeline create-release.yaml)
* Change the new release branch as the default branch in the repo and update the branch protection rules https://github.com/bcgov/zeva/settings/branches
- Squash merge the tracking pull request to master
- Create the release on GitHub from master branch
- Create the new release branch from master branch (this is done automatically by pipeline create-release.yaml)
- Change the new release branch as the default branch in the repo and update the branch protection rules https://github.com/bcgov/zeva/settings/branches

### Updates for the new release branch

* dev-build.yaml
* on -> push -> branches
* env -> PR_NUMBER
* env -> VERSION
* jobs -> call-unit-test -> with -> pr-number
* Update frontend/package.json version and create the new tracking pull request
* Update release-build.yaml
* name
* env -> PR_NUMBER
* env -> VERSION
* jobs -> call-unit-test -> with -> pr-numb
* Create the trackings pull request to merge the new release branch to master. Update the abour PR_NUMBER after the trackings pull request is created.
- dev-build.yaml
- on -> push -> branches
- env -> PR_NUMBER
- env -> VERSION
- jobs -> call-unit-test -> with -> pr-number
- Update frontend/package.json version and create the new tracking pull request
- Update release-build.yaml
- name
- env -> PR_NUMBER
- env -> VERSION
- jobs -> call-unit-test -> with -> pr-numb
- Create the trackings pull request to merge the new release branch to master. Update the abour PR_NUMBER after the trackings pull request is created.

# Pipelines

## Primary Pipelines

* build-on-dev.yaml (Build PR on Dev): Build pull request if the string build-on-dev is appended at the end of pull request title
* dev-build.yaml (Dev Build 1.49.0): Every commit on the current release branch is automatically released to Dev.
* release-build.yaml (Release Build 1.49.0): This is a manually managed pipeline. It needs to be triggered manually to build the current release branch and deploy on Test and further on Prod.
* create-release.yaml (Create Release after merging to master): Automatically tag and create the release after merging release branch to master. The description of the tracking pull request becomes release notes.
- build-on-dev.yaml (Build PR on Dev): Build pull request if the string build-on-dev is appended at the end of pull request title
- dev-build.yaml (Dev Build 1.49.0): Every commit on the current release branch is automatically released to Dev.
- release-build.yaml (Release Build 1.49.0): This is a manually managed pipeline. It needs to be triggered manually to build the current release branch and deploy on Test and further on Prod.
- create-release.yaml (Create Release after merging to master): Automatically tag and create the release after merging release branch to master. The description of the tracking pull request becomes release notes.

## Other Pipelines

* cleanup-cron-workflow-runs.yaml (Scheduled cleanup old workflow runs): a cron job running periodically to cleanup old workflow runs
* cleanup-workflow-runs.yaml (Cleanup old workflow runs): manually cleanup the workflow runs
* emergency-release-build.yaml (Emergency Release Build 1.47.1): the pipeline built for emergency release 1.47.1
* pr-build-template.yaml (PR Build Template): a pipeline template for pull request build
* pr-lable.yaml (Label PR): ignore this one for now, it is automatically triggered after the pull request is merged or closed
* pr-teardown.yaml (Teardown PR on Dev): remove the deployed pull request on Dev
* release-build.yaml (Release Build 1.49.0): a pipeline to build release branch
* unit-test-template.yaml (Unit Test Template): a pipeline template for unit test
- cleanup-cron-workflow-runs.yaml (Scheduled cleanup old workflow runs): a cron job running periodically to cleanup old workflow runs
- cleanup-workflow-runs.yaml (Cleanup old workflow runs): manually cleanup the workflow runs
- emergency-release-build.yaml (Emergency Release Build 1.47.1): the pipeline built for emergency release 1.47.1
- pr-build-template.yaml (PR Build Template): a pipeline template for pull request build
- pr-lable.yaml (Label PR): ignore this one for now, it is automatically triggered after the pull request is merged or closed
- pr-teardown.yaml (Teardown PR on Dev): remove the deployed pull request on Dev
- release-build.yaml (Release Build 1.49.0): a pipeline to build release branch
- unit-test-template.yaml (Unit Test Template): a pipeline template for unit test
10 changes: 5 additions & 5 deletions .github/workflows/build-on-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ on:
- 'release-*'
jobs:

call-unit-test:
uses: ./.github/workflows/unit-test-template.yaml
with:
pr-number: ${{ github.event.pull_request.number }}
# call-unit-test:
# uses: ./.github/workflows/unit-test-template.yaml
# with:
# pr-number: ${{ github.event.pull_request.number }}

call-pr-build:
if: endsWith( github.event.pull_request.title, 'build-on-dev' )
needs: call-unit-test
# needs: call-unit-test
uses: ./.github/workflows/pr-build-template.yaml
with:
pr-number: ${{ github.event.pull_request.number }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/dev-build.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
## For each release, please update the value of workflow name, branches and PR_NUMBER
## Also update frontend/package.json version

name: Dev Build 1.59.0
name: Dev Build 1.60.0

on:
push:
branches: [ release-1.59.0 ]
branches: [ release-1.60.0 ]
paths:
- frontend/**
- backend/**
Expand All @@ -14,8 +14,8 @@ on:

env:
## The pull request number of the Tracking pull request to merge the release branch to main
PR_NUMBER: 2153
VERSION: 1.59.0
PR_NUMBER: 2190
VERSION: 1.60.0
GIT_URL: https://github.com/bcgov/zeva.git
TOOLS_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-tools
DEV_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-dev
Expand All @@ -32,7 +32,7 @@ jobs:
call-unit-test:
uses: ./.github/workflows/unit-test-template.yaml
with:
pr-number: 2153
pr-number: 2190

build:

Expand Down
123 changes: 123 additions & 0 deletions .github/workflows/dev-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
## For each release, the value of workflow name, branches and VERSION need to be adjusted accordingly

name: Zeva new-pipeline-1.60.0 Dev CI

on:
# push:
# branches: [ new-pipeline-1.60.0 ]
# paths:
# - frontend/**
# - backend/**
workflow_dispatch:

env:
VERSION: 1.60.0
GIT_URL: https://github.com/bcgov/zeva.git
TOOLS_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-tools
DEV_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-dev

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

jobs:
set-pre-release:
name: Calculate pre-release number
runs-on: ubuntu-latest

outputs:
output1: ${{ 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-backend:
name: Build Zeva Backend
runs-on: ubuntu-latest
needs: set-pre-release
timeout-minutes: 60

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

steps:
- name: Check out repository
uses: actions/checkout@v4.1.1

- name: Log in to Openshift
uses: redhat-actions/oc-login@v1.3
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=new-pipeline-${{ env.VERSION }} | oc apply --wait=true -f - -n ${{ env.TOOLS_NAMESPACE }}
sleep 5s
oc -n ${{ env.TOOLS_NAMESPACE }} wait --for=condition=Complete --timeout=900s build/zeva-backend-${{ env.VERSION }}-${{ env.PRE_RELEASE }}-1
oc tag ${{ env.TOOLS_NAMESPACE }}/zeva-backend:${{ env.VERSION }}-${{ env.PRE_RELEASE }} ${{ env.DEV_NAMESPACE }}/zeva-backend:${{ env.VERSION }}-${{ env.PRE_RELEASE }}
build-frontend:
name: Build Zeva Frontend
runs-on: ubuntu-latest
needs: set-pre-release
timeout-minutes: 60

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

steps:
- name: Check out repository
uses: actions/checkout@v4.1.1

- name: Log in to Openshift
uses: redhat-actions/oc-login@v1.3
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
insecure_skip_tls_verify: true
namespace: ${{ env.TOOLS_NAMESPACE }}

- 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=new-pipeline-${{ env.VERSION }} | oc apply --wait=true -f - -n ${{ env.TOOLS_NAMESPACE }}
sleep 5s
oc -n ${{ env.TOOLS_NAMESPACE }} wait --for=condition=Complete --timeout=900s build/zeva-frontend-${{ env.VERSION }}-${{ env.PRE_RELEASE }}-1
oc tag ${{ env.TOOLS_NAMESPACE }}/zeva-frontend:${{ env.VERSION }}-${{ env.PRE_RELEASE }} ${{ env.DEV_NAMESPACE }}/zeva-frontend:${{ env.VERSION }}-${{ env.PRE_RELEASE }}
deploy:
name: Deploy Zeva on Dev
runs-on: ubuntu-latest
timeout-minutes: 60
needs: [set-pre-release, build-backend, build-frontend]

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

steps:
- name: Checkout Manifest repository
uses: actions/checkout@v4.1.1
with:
repository: bcgov-c/tenant-gitops-e52f12
ref: main
ssh-key: ${{ secrets.MANIFEST_REPO_DEPLOY_KEY }}

- name: Update tags
uses: mikefarah/yq@v4.40.5
with:
cmd: |
yq -i '.frontend.image.tag = "${{ env.VERSION }}-${{ env.PRE_RELEASE }}"' zeva/values-dev.yaml
yq -i '.backend.image.tag = "${{ env.VERSION }}-${{ env.PRE_RELEASE }}"' zeva/values-dev.yaml
- name: GitHub Commit & Push
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
git add zeva/values-dev.yaml
git commit -m "Update the image tag to ${{ env.VERSION }}-${{ env.PRE_RELEASE }} on Dev"
git push
47 changes: 35 additions & 12 deletions .github/workflows/pr-build-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
steps:

- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4.1.1
with:
ref: refs/pull/${{ inputs.pr-number }}/head

Expand All @@ -52,6 +52,36 @@ jobs:
insecure_skip_tls_verify: true
namespace: ${{ secrets.tools-namespace }}

# This stpe will load the test data on PVC pr-dev-build-data into database
# - name: Setup Database
# shell: bash {0}
# run: |
# cd charts/zeva-spilo
# helm status -n ${{ secrets.dev-namespace }} zeva-spilo-dev-${{ inputs.pr-number }}
# if [ $? -eq 0 ]; then
# echo "zeva-spilo-dev-${{ inputs.pr-number }} exists already"
# else
# echo "==> Installing zeva-spilo-dev-${{ inputs.pr-number }}, will load the test data into database as well, it may take few minutes .."
# helm install -n ${{ secrets.dev-namespace }} -f ./values-dev-pr.yaml --wait zeva-spilo-dev-${{ inputs.pr-number }} .
# oc -n ${{ secrets.dev-namespace }} wait --for=condition=Ready pod/zeva-spilo-dev-${{ inputs.pr-number }}-0
# echo "==> Spilo is up and running"
# echo "==> Mounting dataload PVC"
# oc -n ${{ secrets.dev-namespace }} set volume statefulset/zeva-spilo-dev-${{ inputs.pr-number }} --add --name=dataload -t pvc --claim-name=pr-dev-build-data --overwrite --mount-path=/dataload || true
# sleep 120
# oc -n ${{ secrets.dev-namespace }} wait --for=condition=Ready pod/zeva-spilo-dev-${{ inputs.pr-number }}-0
# echo "==> Spilo is up and running again"
# echo "==> Creating user and database and loading test data"
# oc -n ${{ secrets.dev-namespace }} exec zeva-spilo-dev-${{ inputs.pr-number }}-0 -- psql -c "create user ${{ secrets.zeva-dev-username }} WITH PASSWORD '${{ secrets.zeva-dev-password }}'" || true
# oc -n ${{ secrets.dev-namespace }} exec zeva-spilo-dev-${{ inputs.pr-number }}-0 -- psql -c "create database zeva owner ${{ secrets.zeva-dev-username }} ENCODING 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8'" || true
# oc -n ${{ secrets.dev-namespace }} exec zeva-spilo-dev-${{ inputs.pr-number }}-0 -- psql -c "ALTER SYSTEM SET log_filename='postgresql-%H.log'" || true
# oc -n ${{ secrets.dev-namespace }} exec zeva-spilo-dev-${{ inputs.pr-number }}-0 -- psql -c "ALTER SYSTEM SET log_connections='off'" || true
# oc -n ${{ secrets.dev-namespace }} exec zeva-spilo-dev-${{ inputs.pr-number }}-0 -- psql -c "ALTER SYSTEM SET log_disconnections='off'" || true
# oc -n ${{ secrets.dev-namespace }} exec zeva-spilo-dev-${{ inputs.pr-number }}-0 -- psql -c "ALTER SYSTEM SET log_checkpoints='off'" || true
# oc -n ${{ secrets.dev-namespace }} exec zeva-spilo-dev-${{ inputs.pr-number }}-0 -- psql -c "select pg_reload_conf()" || true
# oc -n ${{ secrets.dev-namespace }} exec zeva-spilo-dev-${{ inputs.pr-number }}-0 -- bash -c "psql zeva < /dataload/LatestBuild.sql >> /tmp/zeva-spilo-dev-${{ inputs.pr-number }}-$(date +"%Y%m%d-%I%M%S%p").log 2>&1"
# echo "==> Spilo is ready for use"
# fi

- name: Setup Database
shell: bash {0}
run: |
Expand All @@ -60,15 +90,9 @@ jobs:
if [ $? -eq 0 ]; then
echo "zeva-spilo-dev-${{ inputs.pr-number }} exists already"
else
echo "==> Installing zeva-spilo-dev-${{ inputs.pr-number }}, will load the test data into database as well, it may take few minutes .."
helm install -n ${{ secrets.dev-namespace }} -f ./values-dev-pr.yaml --wait zeva-spilo-dev-${{ inputs.pr-number }} .
helm upgrade --install -n ${{ secrets.dev-namespace }} -f ./values-dev-pr.yaml --wait zeva-spilo-dev-${{ inputs.pr-number }} .
oc -n ${{ secrets.dev-namespace }} wait --for=condition=Ready pod/zeva-spilo-dev-${{ inputs.pr-number }}-0
echo "==> Spilo is up and running"
echo "==> Mounting dataload PVC"
oc -n ${{ secrets.dev-namespace }} set volume statefulset/zeva-spilo-dev-${{ inputs.pr-number }} --add --name=dataload -t pvc --claim-name=pr-dev-build-data --overwrite --mount-path=/dataload || true
sleep 120
oc -n ${{ secrets.dev-namespace }} wait --for=condition=Ready pod/zeva-spilo-dev-${{ inputs.pr-number }}-0
echo "==> Spilo is up and running again"
echo "==> Creating user and database and loading test data"
oc -n ${{ secrets.dev-namespace }} exec zeva-spilo-dev-${{ inputs.pr-number }}-0 -- psql -c "create user ${{ secrets.zeva-dev-username }} WITH PASSWORD '${{ secrets.zeva-dev-password }}'" || true
oc -n ${{ secrets.dev-namespace }} exec zeva-spilo-dev-${{ inputs.pr-number }}-0 -- psql -c "create database zeva owner ${{ secrets.zeva-dev-username }} ENCODING 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8'" || true
Expand All @@ -77,7 +101,6 @@ jobs:
oc -n ${{ secrets.dev-namespace }} exec zeva-spilo-dev-${{ inputs.pr-number }}-0 -- psql -c "ALTER SYSTEM SET log_disconnections='off'" || true
oc -n ${{ secrets.dev-namespace }} exec zeva-spilo-dev-${{ inputs.pr-number }}-0 -- psql -c "ALTER SYSTEM SET log_checkpoints='off'" || true
oc -n ${{ secrets.dev-namespace }} exec zeva-spilo-dev-${{ inputs.pr-number }}-0 -- psql -c "select pg_reload_conf()" || true
oc -n ${{ secrets.dev-namespace }} exec zeva-spilo-dev-${{ inputs.pr-number }}-0 -- bash -c "psql zeva < /dataload/LatestBuild.sql >> /tmp/zeva-spilo-dev-${{ inputs.pr-number }}-$(date +"%Y%m%d-%I%M%S%p").log 2>&1"
echo "==> Spilo is ready for use"
fi
Expand All @@ -91,7 +114,7 @@ jobs:
steps:

- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4.1.1
with:
ref: refs/pull/${{ inputs.pr-number }}/head

Expand Down Expand Up @@ -119,7 +142,7 @@ jobs:
steps:

- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4.1.1
with:
ref: refs/pull/${{ inputs.pr-number }}/head

Expand Down Expand Up @@ -147,7 +170,7 @@ jobs:
steps:

- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4.1.1
with:
ref: refs/pull/${{ inputs.pr-number }}/head

Expand Down
Loading

0 comments on commit c46d85a

Please sign in to comment.