Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/bcgov/EDUC-GRAD-ADMIN into …
Browse files Browse the repository at this point in the history
…release/v1.27.0
  • Loading branch information
suzalflueck committed Dec 17, 2024
2 parents d5cf7de + 128740b commit 947c315
Show file tree
Hide file tree
Showing 15 changed files with 730 additions and 430 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build-n-deploy-backend-km.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ env:
REPO_NAME: "educ-grad-admin"
BRANCH: "develop/km"
APP_NAME_BACKEND: "educ-grad-admin-backend"
NAMESPACE: bbe4c3
NAMESPACE_TOOLS: bbe4c3-tools
COMMON_NAMESPACE: 75e61b
NAMESPACE: ${{ secrets.UI_NAMESPACE }}
NAMESPACE_TOOLS: ${{ secrets.UI_NAMESPACE }}-tools
COMMON_NAMESPACE: ${{ secrets.COMMON_NAMESPACE }}
TAG: "latest"
TARGET_ENV: "dev"

Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
oc tag ${{ steps.push-image-backend.outputs.registry-path }} ${{ env.REPO_NAME }}-backend:${{ env.TAG }}
# Process and apply deployment template
oc process -f tools/openshift/backend-dc.yaml -p IS_NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} -p REPO_NAME=educ-grad-admin -p HOST_ROUTE=educ-grad-admin-bbe4c3-dev.apps.silver.devops.gov.bc.ca -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} -p MIN_CPU=${{ env.MIN_CPU }} -p MAX_CPU=${{ env.MAX_CPU }} -p MIN_MEM=${{ env.MIN_MEM }} -p MAX_MEM=${{ env.MAX_MEM }} | oc apply -n bbe4c3-dev -f -
oc process -f tools/openshift/backend-dc.yaml -p IS_NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} -p REPO_NAME=educ-grad-admin -p HOST_ROUTE=educ-grad-admin-${{ env.NAMESPACE }}-dev.apps.silver.devops.gov.bc.ca -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} -p MIN_CPU=${{ env.MIN_CPU }} -p MAX_CPU=${{ env.MAX_CPU }} -p MIN_MEM=${{ env.MIN_MEM }} -p MAX_MEM=${{ env.MAX_MEM }} | oc apply -n ${{ env.NAMESPACE }}-dev -f -
# Start rollout (if necessary) and follow it
oc rollout latest dc/${{ env.IMAGE_NAME }}-dc 2> /dev/null \
Expand All @@ -171,4 +171,4 @@ jobs:
- name: ZAP Scan
uses: zaproxy/[email protected]
with:
target: 'https://educ-grad-admin-bbe4c3-dev.apps.silver.devops.gov.bc.ca'
target: 'https://educ-grad-admin-${{ env.NAMESPACE }}-dev.apps.silver.devops.gov.bc.ca'
67 changes: 41 additions & 26 deletions .github/workflows/build-n-deploy-backend-to-ocp-dev-vue3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,14 @@ env:
IMAGE_REGISTRY_USER: ${{ github.actor }}
IMAGE_REGISTRY_PASSWORD: ${{ github.token }}

IMAGE_NAME: educ-grad-admin-backend
DOCKER_ARTIFACTORY_REPO: artifacts.developer.gov.bc.ca/docker-remote
ARTIFACTORY_REPO: artifacts.developer.gov.bc.ca

APP_NAME: "educ-grad-admin"
REPO_NAME: "educ-grad-admin"
BRANCH: "vue3"
APP_NAME_BACKEND: "educ-grad-admin-backend"
NAMESPACE: ${{secrets.GRAD_NAMESPACE_NO_ENV}}
NAMESPACE_TOOLS: ${{secrets.GRAD_NAMESPACE_NO_ENV}}-tools
COMMON_NAMESPACE: ${{secrets.COMMON_NAMESPACE_NO_ENV}}
TAG: "latest"
TARGET_ENV: "dev"
BRANCH: "GRAD2-3119"

MIN_CPU: "50m"
MAX_CPU: "100m"
Expand All @@ -37,7 +32,7 @@ env:
MAX_REPLICAS: "1"

# SITE_URL should have no scheme or port. It will be prepended with https://
HOST_ROUTE: ${{ secrets.SITE_URL }}
HOST_ROUTE: "educ-grad-admin-${{secrets.GRAD_NAMESPACE_NO_ENV}}-dev.apps.silver.devops.gov.bc.ca"

on:
workflow_dispatch:
Expand All @@ -49,10 +44,6 @@ jobs:
runs-on: ubuntu-22.04
environment: dev-vue3

outputs:
ROUTE: ${{ steps.deploy-and-expose.outputs.route }}
SELECTOR: ${{ steps.deploy-and-expose.outputs.selector }}

steps:
- name: Check for required secrets
uses: actions/github-script@v4
Expand Down Expand Up @@ -147,28 +138,52 @@ jobs:
oc login --token=${{ env.OPENSHIFT_TOKEN }} --server=${{ env.OPENSHIFT_SERVER }}
oc project ${{ env.OPENSHIFT_NAMESPACE }}
# Cancel any rollouts in progress
oc rollout cancel dc/${{ env.IMAGE_NAME }}-dc 2> /dev/null \
oc rollout cancel deployment/${{ env.APP_NAME_BACKEND }} 2> /dev/null \
|| true && echo "No rollout in progress"
oc project ${{ env.OPENSHIFT_NAMESPACE }}
# Create the image stream if it doesn't exist
oc create imagestream ${{ env.REPO_NAME }}-backend 2> /dev/null || true && echo "Backend image stream in place"
oc tag ${{ steps.push-image-backend.outputs.registry-path }} ${{ env.REPO_NAME }}-backend:${{ env.TAG }}
# Process and apply deployment template
oc process -f tools/openshift/backend-dc.yaml -p IS_NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} -p REPO_NAME=educ-grad-admin -p HOST_ROUTE=educ-grad-admin-${{secrets.GRAD_NAMESPACE_NO_ENV}}-dev.apps.silver.devops.gov.bc.ca -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} -p MIN_CPU=${{ env.MIN_CPU }} -p MAX_CPU=${{ env.MAX_CPU }} -p MIN_MEM=${{ env.MIN_MEM }} -p MAX_MEM=${{ env.MAX_MEM }} | oc apply -n ${{secrets.GRAD_NAMESPACE_NO_ENV}}-dev -f -
oc create imagestream ${{ env.APP_NAME_BACKEND}} 2> /dev/null || true && echo "Backend image stream in place"
oc tag ${{ steps.push-image-backend.outputs.registry-path }} ${{ env.APP_NAME_BACKEND }}:${{ env.TAG }}
# Process template
oc process -f tools/openshift/backend-dc.yaml \
-p IS_NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \
-p APP_NAME=${{ env.APP_NAME }} \
-p HOST_ROUTE=${{ env.HOST_ROUTE }} \
-p MIN_REPLICAS=${{ env.MIN_REPLICAS }} \
-p MAX_REPLICAS=${{ env.MAX_REPLICAS }} \
-p MIN_CPU=${{ env.MIN_CPU }} \
-p MAX_CPU=${{ env.MAX_CPU }} \
-p MIN_MEM=${{ env.MIN_MEM }} \
-p MAX_MEM=${{ env.MAX_MEM }} \
-p BASE_URL=${{ env.TARGET_ENV }}.grad.gov.bc.ca \
-p ENVIRONMENT=${{ env.TARGET_ENV }} \
-p CERTIFICATE="${{ secrets.CERTIFICATE }}" \
-p CA_CERT="${{ secrets.CA_CERT }}" \
-p PRIVATE_KEY="${{ secrets.PRIVATE_KEY }}" \
| oc apply -n ${{ env.OPENSHIFT_NAMESPACE }} -f -
# update configmap
curl -s https://raw.githubusercontent.com/bcgov/${{ env.APP_NAME }}/refs/heads/${{ env.BRANCH }}/tools/openshift/update-configmap-backend.sh | bash /dev/stdin \
${{ env.TARGET_ENV }} \
${{ env.APP_NAME }} \
${{ env.OPENSHIFT_NAMESPACE }} \
${{ env.TARGET_ENV }}.grad.gov.bc.ca \
${{ secrets.SOAM_CLIENT_SECRET }} \
${{ secrets.REDIS_PASSWORD }} \
${{ secrets.SPLUNK_TOKEN }} \
${{ secrets.COMMON_NAMESPACE }} \
${{ secrets.GRAD_NAMESPACE }} \
${{ secrets.GRAD_BUSINESS_NAMESPACE }}
# Start rollout (if necessary) and follow it
oc rollout latest dc/${{ env.IMAGE_NAME }}-dc 2> /dev/null \
|| true && echo "Rollout in progress"
oc rollout restart deployment/${{ env.APP_NAME_BACKEND }}
oc logs -f dc/${{ env.IMAGE_NAME }}-dc
# Get status, returns 0 if rollout is successful
oc rollout status dc/${{ env.IMAGE_NAME }}-dc
oc rollout status deployment/${{ env.APP_NAME_BACKEND }}
- name: ZAP Scan
uses: zaproxy/[email protected]
with:
target: "https://educ-grad-admin-${{secrets.GRAD_NAMESPACE_NO_ENV}}-dev.apps.silver.devops.gov.bc.ca"
target: 'https://educ-grad-admin-${{ env.OPENSHIFT_NAMESPACE }}.apps.silver.devops.gov.bc.ca'
68 changes: 41 additions & 27 deletions .github/workflows/build-n-deploy-backend-to-ocp-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,19 @@ env:
OPENSHIFT_SERVER: ${{ secrets.OPENSHIFT_SERVER }}
OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }}
# 🖊️ EDIT to set the kube context's namespace after login. Leave blank to use your user's default namespace.
OPENSHIFT_NAMESPACE: bbe4c3-dev
OPENSHIFT_NAMESPACE: ${{ secrets.UI_NAMESPACE }}-dev

# 🖊️ EDIT to change the image registry settings.
# Registries such as GHCR, Quay.io, and Docker Hub are supported.
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
IMAGE_REGISTRY_USER: ${{ github.actor }}
IMAGE_REGISTRY_PASSWORD: ${{ github.token }}

IMAGE_NAME: educ-grad-admin-backend
DOCKER_ARTIFACTORY_REPO: artifacts.developer.gov.bc.ca/docker-remote
ARTIFACTORY_REPO: artifacts.developer.gov.bc.ca

APP_NAME: 'educ-grad-admin'
REPO_NAME: "educ-grad-admin"
BRANCH: "main"
APP_NAME: "educ-grad-admin"
APP_NAME_BACKEND: "educ-grad-admin-backend"
NAMESPACE: bbe4c3
NAMESPACE_TOOLS: bbe4c3-tools
COMMON_NAMESPACE: 75e61b
TAG: "latest"
TARGET_ENV: "dev"

Expand All @@ -37,7 +31,7 @@ env:
MAX_REPLICAS: "2"

# SITE_URL should have no scheme or port. It will be prepended with https://
HOST_ROUTE: ${{ secrets.SITE_URL }}
HOST_ROUTE: "educ-grad-admin-${{ env.OPENSHIFT_NAMESPACE }}.apps.silver.devops.gov.bc.ca"

on:
workflow_dispatch:
Expand All @@ -49,10 +43,6 @@ jobs:
runs-on: ubuntu-22.04
environment: dev

outputs:
ROUTE: ${{ steps.deploy-and-expose.outputs.route }}
SELECTOR: ${{ steps.deploy-and-expose.outputs.selector }}

steps:
- name: Check for required secrets
uses: actions/github-script@v4
Expand Down Expand Up @@ -147,28 +137,52 @@ jobs:
oc login --token=${{ env.OPENSHIFT_TOKEN }} --server=${{ env.OPENSHIFT_SERVER }}
oc project ${{ env.OPENSHIFT_NAMESPACE }}
# Cancel any rollouts in progress
oc rollout cancel dc/${{ env.IMAGE_NAME }}-dc 2> /dev/null \
oc rollout cancel deployment/${{ env.APP_NAME_BACKEND }} 2> /dev/null \
|| true && echo "No rollout in progress"
oc project ${{ env.OPENSHIFT_NAMESPACE }}
# Create the image stream if it doesn't exist
oc create imagestream ${{ env.REPO_NAME }}-backend 2> /dev/null || true && echo "Backend image stream in place"
oc tag ${{ steps.push-image-backend.outputs.registry-path }} ${{ env.REPO_NAME }}-backend:${{ env.TAG }}
oc create imagestream ${{ env.APP_NAME_BACKEND}} 2> /dev/null || true && echo "Backend image stream in place"
oc tag ${{ steps.push-image-backend.outputs.registry-path }} ${{ env.APP_NAME_BACKEND }}:${{ env.TAG }}
# Process template
oc process -f tools/openshift/backend-dc.yaml \
-p IS_NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \
-p APP_NAME=${{ env.APP_NAME }} \
-p HOST_ROUTE=${{ env.HOST_ROUTE }} \
-p MIN_REPLICAS=${{ env.MIN_REPLICAS }} \
-p MAX_REPLICAS=${{ env.MAX_REPLICAS }} \
-p MIN_CPU=${{ env.MIN_CPU }} \
-p MAX_CPU=${{ env.MAX_CPU }} \
-p MIN_MEM=${{ env.MIN_MEM }} \
-p MAX_MEM=${{ env.MAX_MEM }} \
-p BASE_URL=${{ env.TARGET_ENV }}.grad.gov.bc.ca \
-p ENVIRONMENT=${{ env.TARGET_ENV }} \
-p CERTIFICATE="${{ secrets.CERTIFICATE }}" \
-p CA_CERT="${{ secrets.CA_CERT }}" \
-p PRIVATE_KEY="${{ secrets.PRIVATE_KEY }}" \
| oc apply -n ${{ env.OPENSHIFT_NAMESPACE }} -f -
# update configmap
curl -s https://raw.githubusercontent.com/bcgov/${{ env.APP_NAME }}/refs/heads/main/tools/openshift/update-configmap-backend.sh | bash /dev/stdin \
${{ env.TARGET_ENV }} \
${{ env.APP_NAME }} \
${{ env.OPENSHIFT_NAMESPACE }} \
${{ env.TARGET_ENV }}.grad.gov.bc.ca \
${{ secrets.SOAM_CLIENT_SECRET }} \
${{ secrets.REDIS_PASSWORD }} \
${{ secrets.SPLUNK_TOKEN }} \
${{ secrets.COMMON_NAMESPACE }} \
${{ secrets.GRAD_NAMESPACE }} \
${{ secrets.GRAD_BUSINESS_NAMESPACE }}
# Process and apply deployment template
oc process -f tools/openshift/backend-dc.yaml -p IS_NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} -p REPO_NAME=educ-grad-admin -p HOST_ROUTE=educ-grad-admin-bbe4c3-dev.apps.silver.devops.gov.bc.ca -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} -p MIN_CPU=${{ env.MIN_CPU }} -p MAX_CPU=${{ env.MAX_CPU }} -p MIN_MEM=${{ env.MIN_MEM }} -p MAX_MEM=${{ env.MAX_MEM }} | oc apply -n bbe4c3-dev -f -
# Start rollout (if necessary) and follow it
oc rollout latest dc/${{ env.IMAGE_NAME }}-dc 2> /dev/null \
|| true && echo "Rollout in progress"
oc rollout restart deployment/${{ env.APP_NAME_BACKEND }}
oc logs -f dc/${{ env.IMAGE_NAME }}-dc
# Get status, returns 0 if rollout is successful
oc rollout status dc/${{ env.IMAGE_NAME }}-dc
oc rollout status deployment/${{ env.APP_NAME_BACKEND }}
- name: ZAP Scan
uses: zaproxy/[email protected]
with:
target: 'https://educ-grad-admin-bbe4c3-dev.apps.silver.devops.gov.bc.ca'
target: 'https://educ-grad-admin-${{ env.OPENSHIFT_NAMESPACE }}.apps.silver.devops.gov.bc.ca'
10 changes: 5 additions & 5 deletions .github/workflows/build-n-deploy-backend-to-ocp-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ env:
REPO_NAME: "educ-grad-admin"
BRANCH: "feature/caddy2"
APP_NAME_BACKEND: "educ-grad-admin-backend"
NAMESPACE: bbe4c3
NAMESPACE_TOOLS: bbe4c3-tools
COMMON_NAMESPACE: 75e61b
NAMESPACE: ${{ secrets.UI_NAMESPACE }}
NAMESPACE_TOOLS: ${{ secrets.UI_NAMESPACE }}-tools
COMMON_NAMESPACE: ${{ secrets.COMMON_NAMESPACE }}
TAG: "tools"
TARGET_ENV: "tools"

Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
oc project ${{ env.OPENSHIFT_NAMESPACE }}
# Process and apply deployment template
oc process -f tools/openshift/backend-dc.yaml -p REPO_NAME=educ-grad-admin -p HOST_ROUTE=educ-grad-admin-bbe4c3-tools.apps.silver.devops.gov.bc.ca -p MIN_REPLICAS=${{ env.MIN_REPLICAS_DEV }} -p MAX_REPLICAS=${{ env.MAX_REPLICAS_DEV }} -p MIN_CPU=${{ env.MIN_CPU }} -p MAX_CPU=${{ env.MAX_CPU }} -p MIN_MEM=${{ env.MIN_MEM }} -p MAX_MEM=${{ env.MAX_MEM }} | oc apply -n bbe4c3-tools -f -
oc process -f tools/openshift/backend-dc.yaml -p REPO_NAME=educ-grad-admin -p HOST_ROUTE=educ-grad-admin-${{ env.NAMESPACE_TOOLS }}.apps.silver.devops.gov.bc.ca -p MIN_REPLICAS=${{ env.MIN_REPLICAS_DEV }} -p MAX_REPLICAS=${{ env.MAX_REPLICAS_DEV }} -p MIN_CPU=${{ env.MIN_CPU }} -p MAX_CPU=${{ env.MAX_CPU }} -p MIN_MEM=${{ env.MIN_MEM }} -p MAX_MEM=${{ env.MAX_MEM }} | oc apply -n ${{ env.NAMESPACE_TOOLS }} -f -
# Start rollout (if necessary) and follow it
oc rollout latest dc/${{ env.IMAGE_NAME }}-dc 2> /dev/null \
Expand All @@ -175,4 +175,4 @@ jobs:
- name: ZAP Scan
uses: zaproxy/[email protected]
with:
target: 'https://educ-grad-admin-bbe4c3-tools.apps.silver.devops.gov.bc.ca'
target: 'https://educ-grad-admin-${{ env.NAMESPACE_TOOLS }}.apps.silver.devops.gov.bc.ca'
14 changes: 7 additions & 7 deletions .github/workflows/build-n-deploy-frontend-km.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:
OPENSHIFT_SERVER: ${{ secrets.OPENSHIFT_SERVER }}
OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }}
# 🖊️ EDIT to set the kube context's namespace after login. Leave blank to use your user's default namespace.
OPENSHIFT_NAMESPACE: bbe4c3-dev
OPENSHIFT_NAMESPACE: ${{ secrets.UI_NAMESPACE }}-dev

# 🖊️ EDIT to change the image registry settings.
# Registries such as GHCR, Quay.io, and Docker Hub are supported.
Expand All @@ -23,9 +23,9 @@ env:
REPO_NAME: "educ-grad-admin"
BRANCH: "develop/km"
APP_NAME_FRONTEND: "educ-grad-admin-frontend"
NAMESPACE: bbe4c3
NAMESPACE_TOOLS: bbe4c3-tools
COMMON_NAMESPACE: 75e61b
NAMESPACE: ${{ secrets.UI_NAMESPACE }}
NAMESPACE_TOOLS: ${{ secrets.UI_NAMESPACE }}-tools
COMMON_NAMESPACE: ${{ secrets.COMMON_NAMESPACE }}
TAG: "latest"
TARGET_ENV: "dev"

Expand Down Expand Up @@ -160,9 +160,9 @@ jobs:
# Process and apply deployment template
oc process -f tools/openshift/frontend-dc.yaml -p REPO_NAME=educ-grad-admin \
-p HOST_ROUTE=educ-grad-admin-bbe4c3-dev.apps.silver.devops.gov.bc.ca -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \
-p HOST_ROUTE=educ-grad-admin-${{ env.OPENSHIFT_NAMESPACE }}.apps.silver.devops.gov.bc.ca -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \
-p APP_NAME=educ-grad-admin -p TAG=latest -p MIN_REPLICAS=2 -p MAX_REPLICAS=3 -p MIN_CPU=50m -p MAX_CPU=100m \
-p MIN_MEM=200Mi -p MAX_MEM=250Mi | oc apply -n bbe4c3-dev -f -
-p MIN_MEM=200Mi -p MAX_MEM=250Mi | oc apply -n ${{ env.OPENSHIFT_NAMESPACE }} -f -
# Start rollout (if necessary) and follow it
oc rollout latest dc/${{ env.IMAGE_NAME }}-dc 2> /dev/null \
Expand All @@ -173,4 +173,4 @@ jobs:
- name: ZAP Scan
uses: zaproxy/[email protected]
with:
target: 'https://educ-grad-admin-bbe4c3-dev.apps.silver.devops.gov.bc.ca'
target: 'https://educ-grad-admin-${{ env.OPENSHIFT_NAMESPACE }}.apps.silver.devops.gov.bc.ca'
Loading

0 comments on commit 947c315

Please sign in to comment.