Skip to content

Commit

Permalink
Tracking pull request to merge release-1.62.0 to master (#2283)
Browse files Browse the repository at this point in the history
* fix: 2298 - extraneous data on new credit transfer page (#2299)

---------

Co-authored-by: Roger Leung <[email protected]>
Co-authored-by: tim738745 <[email protected]>
  • Loading branch information
3 people authored Oct 11, 2024
1 parent 73c61fa commit d5a2d91
Show file tree
Hide file tree
Showing 13 changed files with 353 additions and 152 deletions.
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.61.0
name: Dev Build 1.62.0

on:
push:
branches: [release-1.61.0]
branches: [release-1.62.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: 2270
VERSION: 1.61.0
PR_NUMBER: 2283
VERSION: 1.62.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 @@ -30,7 +30,7 @@ jobs:
call-unit-test:
uses: ./.github/workflows/unit-test-template.yaml
with:
pr-number: 2270
pr-number: 2283

build:
name: Build ZEVA on Openshift
Expand Down
57 changes: 43 additions & 14 deletions .github/workflows/dev-ci.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
## For each release, the value of workflow name, branches and VERSION need to be adjusted accordingly

name: Zeva new-pipeline-1.61.0 Dev CI
name: Zeva new-pipeline-1.62.0 Dev CI

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

env:
VERSION: 1.61.0
VERSION: 1.62.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 @@ -30,7 +30,8 @@ jobs:

steps:
- id: set-pre-release
run: echo "PRE_RELEASE=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
run: |
echo "PRE_RELEASE=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
build-backend:
name: Build Zeva Backend
Expand All @@ -56,9 +57,15 @@ jobs:
- 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 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 }}
sleep 2s
for build in $(oc -n ${{ env.TOOLS_NAMESPACE }} get builds -l buildconfig=zeva-backend-${{ env.VERSION }}-${{ env.PRE_RELEASE }} -o jsonpath='{.items[?(@.status.phase=="Running")].metadata.name}'); do
echo "canceling $build"
oc -n ${{ env.TOOLS_NAMESPACE }} cancel-build $build
done
sleep 2s
oc -n ${{ env.TOOLS_NAMESPACE }} start-build zeva-backend-${{ env.VERSION }}-${{ env.PRE_RELEASE }} --wait=true
sleep 2s
oc tag ${{ env.TOOLS_NAMESPACE }}/zeva-backend:${{ env.VERSION }}-${{ env.PRE_RELEASE }} ${{ env.DEV_NAMESPACE }}/zeva-backend:${{ env.VERSION }}-${{ env.PRE_RELEASE }}
build-frontend:
Expand All @@ -85,9 +92,15 @@ jobs:
- 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 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 }}
sleep 2s
for build in $(oc -n ${{ env.TOOLS_NAMESPACE }} get builds -l buildconfig=zeva-frontend-${{ env.VERSION }}-${{ env.PRE_RELEASE }} -o jsonpath='{.items[?(@.status.phase=="Running")].metadata.name}'); do
echo "canceling $build"
oc -n ${{ env.TOOLS_NAMESPACE }} cancel-build $build
done
sleep 2s
oc -n ${{ env.TOOLS_NAMESPACE }} start-build zeva-frontend-${{ env.VERSION }}-${{ env.PRE_RELEASE }} --wait=true
sleep 2s
oc tag ${{ env.TOOLS_NAMESPACE }}/zeva-frontend:${{ env.VERSION }}-${{ env.PRE_RELEASE }} ${{ env.DEV_NAMESPACE }}/zeva-frontend:${{ env.VERSION }}-${{ env.PRE_RELEASE }}
deploy:
Expand Down Expand Up @@ -121,3 +134,19 @@ jobs:
git add zeva/values-dev.yaml
git commit -m "Update the image tag to ${{ env.VERSION }}-${{ env.PRE_RELEASE }} on Dev"
git push
- 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 Dev
run: |
helm -n ${{ env.DEV_NAMESPACE }} list
oc tag ${{ env.TOOLS_NAMESPACE }}/zeva-backend:${{ env.VERSION }}-${{ env.PRE_RELEASE }} ${{ env.DEV_NAMESPACE }}/zeva-backend:${{ env.VERSION }}-${{ env.PRE_RELEASE }}
oc tag ${{ env.TOOLS_NAMESPACE }}/zeva-frontend:${{ env.VERSION }}-${{ env.PRE_RELEASE }} ${{ env.DEV_NAMESPACE }}/zeva-frontend:${{ env.VERSION }}-${{ env.PRE_RELEASE }}
cd zeva
helm -n ${{ env.DEV_NAMESPACE }} -f ./values-dev.yaml upgrade --install zeva-dev .
191 changes: 191 additions & 0 deletions .github/workflows/pr-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
name: PR Build on Dev

on:
pull_request:
types: [labeled, synchronize]
paths:
- frontend/**
- backend/**

env:
GIT_URL: https://github.com/bcgov/zeva.git
TOOLS_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-tools
DEV_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-dev
PR_NUMBER: ${{ github.event.pull_request.number }}
GIT_REF: ${{ github.event.pull_request.head.ref }}

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

jobs:
get-version:
if: >
(github.event.action == 'labeled' && github.event.label.name == 'build' && github.event.pull_request.base.ref == github.event.repository.default_branch) ||
(github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'build') && github.event.pull_request.base.ref == github.event.repository.default_branch)
name: Retrieve version
runs-on: ubuntu-latest

outputs:
output1: ${{ steps.get-version.outputs.VERSION }}

steps:
- 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 }}

- id: get-version
run: |
pr_deployed=$(helm -n ${{ env.DEV_NAMESPACE }} list | grep zeva-frontend-dev- | wc -l | tr -d '[:space:]')
if [ "$pr_deployed" -gt 1 ]; then
echo "There are at least 2 pull requests have been deployed on dev. Please uninstalled one of them in order to to have space to deploy this pull request. Exiting with code 99"
exit 99
else
echo "There are $pr_deployed pull request builds on dev. Will deploy a new one."
version=$(echo "${{ github.event.repository.default_branch }}" | sed -E 's/release-(.*)/\1/')
echo "VERSION=$version" >> $GITHUB_OUTPUT
fi
build-backend:
if: >
(github.event.action == 'labeled' && github.event.label.name == 'build' && github.event.pull_request.base.ref == github.event.repository.default_branch) ||
(github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'build') && github.event.pull_request.base.ref == github.event.repository.default_branch)
name: Build ZEVA Backend
runs-on: ubuntu-latest
needs: [get-version]
timeout-minutes: 60

env:
VERSION: ${{ needs.get-version.outputs.output1 }}

steps:
- name: Check out repository
uses: actions/[email protected]
with:
ref: ${{ github.event.pull_request.head.ref }}

- 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.PR_NUMBER }} VERSION=${{ env.VERSION }}-${{ env.PR_NUMBER }} GIT_URL=${{ env.GIT_URL }} GIT_REF=${{ env.GIT_REF }} | oc apply --wait=true -f - -n ${{ env.TOOLS_NAMESPACE }}
sleep 2s
for build in $(oc -n ${{ env.TOOLS_NAMESPACE }} get builds -l buildconfig=zeva-backend-${{ env.VERSION }}-${{ env.PR_NUMBER }} -o jsonpath='{.items[?(@.status.phase=="Running")].metadata.name}'); do
echo "canceling $build"
oc -n ${{ env.TOOLS_NAMESPACE }} cancel-build $build
done
sleep 2s
oc -n ${{ env.TOOLS_NAMESPACE }} start-build zeva-backend-${{ env.VERSION }}-${{ env.PR_NUMBER }} --wait=true
sleep 2s
oc tag ${{ env.TOOLS_NAMESPACE }}/zeva-backend:${{ env.VERSION }}-${{ env.PR_NUMBER }} ${{ env.DEV_NAMESPACE }}/zeva-backend:${{ env.VERSION }}-${{ env.PR_NUMBER }}
build-frontend:
if: >
(github.event.action == 'labeled' && github.event.label.name == 'build' && github.event.pull_request.base.ref == github.event.repository.default_branch) ||
(github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'build') && github.event.pull_request.base.ref == github.event.repository.default_branch)
name: Build ZEVA Frontend
runs-on: ubuntu-latest
needs: [get-version]
timeout-minutes: 60

env:
VERSION: ${{ needs.get-version.outputs.output1 }}

steps:
- name: Check out repository
uses: actions/[email protected]
with:
ref: ${{ github.event.pull_request.head.ref }}

- 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 Frontend
run: |
cd openshift/templates/frontend
oc process -f ./frontend-bc-docker.yaml NAME=zeva SUFFIX=-${{ env.VERSION }}-${{ env.PR_NUMBER }} VERSION=${{ env.VERSION }}-${{ env.PR_NUMBER }} GIT_URL=${{ env.GIT_URL }} GIT_REF=${{ env.GIT_REF }} | oc apply --wait=true -f - -n ${{ env.TOOLS_NAMESPACE }}
sleep 2s
for build in $(oc -n ${{ env.TOOLS_NAMESPACE }} get builds -l buildconfig=zeva-frontend-${{ env.VERSION }}-${{ env.PR_NUMBER }} -o jsonpath='{.items[?(@.status.phase=="Running")].metadata.name}'); do
echo "canceling $build"
oc -n ${{ env.TOOLS_NAMESPACE }} cancel-build $build
done
sleep 2s
oc -n ${{ env.TOOLS_NAMESPACE }} start-build zeva-frontend-${{ env.VERSION }}-${{ env.PR_NUMBER }} --wait=true
sleep 2s
oc tag ${{ env.TOOLS_NAMESPACE }}/zeva-frontend:${{ env.VERSION }}-${{ env.PR_NUMBER }} ${{ env.DEV_NAMESPACE }}/zeva-frontend:${{ env.VERSION }}-${{ env.PR_NUMBER }}
deploy:
if: >
(github.event.action == 'labeled' && github.event.label.name == 'build' && github.event.pull_request.base.ref == github.event.repository.default_branch) ||
(github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'build') && github.event.pull_request.base.ref == github.event.repository.default_branch)
name: Deploy ZEVA
runs-on: ubuntu-latest
timeout-minutes: 60
needs: [get-version, build-backend, build-frontend]

env:
VERSION: ${{ needs.get-version.outputs.output1 }}

steps:
- 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: Replace VERSION in values-dev-pr.yaml
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "VERSION"
replace: "${{ env.VERSION }}"
include: "zeva/values-dev-pr.yaml"
regex: false

- name: Replace PRNUMBER in values-dev-pr.yaml
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "PRNUMBER"
replace: "${{ env.PR_NUMBER }}"
include: "zeva/values-dev-pr.yaml"
regex: false

- 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: Helm Deployment
shell: bash {0}
run: |
pwd
ls -l
cat zeva/values-dev-pr.yaml
- name: Helm Deployment
shell: bash {0}
run: |
cd postgres-pr
helm -n ${{ env.DEV_NAMESPACE }} -f ./values-dev-pr.yaml upgrade --install zeva-dev-${{ env.PR_NUMBER }}-postgresql oci://registry-1.docker.io/bitnamicharts/postgresql --version 15.5.17
sleep 60s
cd ../zeva
helm -n ${{ env.DEV_NAMESPACE }} -f ./values-dev-pr.yaml upgrade --install zeva-dev-${{ env.PR_NUMBER }} .
22 changes: 0 additions & 22 deletions .github/workflows/pr-label.yaml

This file was deleted.

35 changes: 19 additions & 16 deletions .github/workflows/pr-teardown.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
name: Teardown PR on Dev
name: PR Teardown on Dev

on:
pull_request:
types: closed
types: [unlabeled, closed]

env:
TOOLS_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-tools
DEV_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-dev
PR_NUMBER: ${{ github.event.pull_request.number }}

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

teardown-on-dev:
if: endsWith( github.event.pull_request.title, 'build-on-dev' )
name: Tear ZEVA down on Dev
jobs:
teardown:
if: >
(github.event.action == 'unlabeled' && github.event.label.name == 'build') ||
(github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'build') )
name: PR Teardown
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
timeout-minutes: 60

steps:
- 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 }}
namespace: ${{ env.DEV_NAMESPACE }}

- name: Undeploy on Dev
shell: bash {0}
- name: Teardown the pull request
run: |
helm -n ${{ env.DEV_NAMESPACE }} uninstall zeva-backend-dev-${{ github.event.pull_request.number }} || true
helm -n ${{ env.DEV_NAMESPACE }} uninstall zeva-frontend-dev-${{ github.event.pull_request.number }} || true
helm -n ${{ env.DEV_NAMESPACE }} uninstall zeva-spilo-dev-${{ github.event.pull_request.number }} || true
helm -n ${{ env.DEV_NAMESPACE }} uninstall zeva-dev-${{ env.PR_NUMBER }}
helm -n ${{ env.DEV_NAMESPACE }} uninstall zeva-dev-${{ env.PR_NUMBER }}-postgresql
oc -n ${{ env.DEV_NAMESPACE }} delete pvc -l app.kubernetes.io/instance=zeva-dev-${{ env.PR_NUMBER }}-postgresql
Loading

0 comments on commit d5a2d91

Please sign in to comment.