Skip to content

Commit

Permalink
updated github workflows for test and prod
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunlumbcgov committed Nov 1, 2024
1 parent 61e6228 commit c0e5bc9
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 49 deletions.
61 changes: 30 additions & 31 deletions .github/workflows/create_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,50 +20,49 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Version Number'
description: "Version Number"
required: true

jobs:
tag_image:
name: Tag Image
# ubuntu-latest can also be used.
runs-on: ubuntu-20.04
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 out repository
uses: actions/checkout@v2
- name: Check out repository
uses: actions/checkout@v2

- name: Create tag
uses: actions/github-script@v6
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ github.event.inputs.version }}',
force: true,
sha: context.sha
})
- name: Create tag
uses: actions/github-script@v6
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ github.event.inputs.version }}',
force: true,
sha: context.sha
})
- name: Install oc
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: 4
- name: Install oc
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: 4

# https://github.com/redhat-actions/oc-login#readme
- uses: actions/checkout@v2
- name: Tag in OpenShift
run: |
set -eux
# Login to OpenShift and select project
oc login --token=${{ env.OPENSHIFT_TOKEN }} --server=${{ env.OPENSHIFT_SERVER }}
oc project ${{ env.OPENSHIFT_NAMESPACE }}
oc tag ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-frontend:latest ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-frontend:${{ github.event.inputs.version }}
oc tag ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-backend:latest ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-backend:${{ github.event.inputs.version }}
# https://github.com/redhat-actions/oc-login#readme
- uses: actions/checkout@v2
- name: Tag in OpenShift
run: |
set -eux
# Login to OpenShift and select project
oc login --token=${{ env.OPENSHIFT_TOKEN }} --server=${{ env.OPENSHIFT_SERVER }}
oc project ${{ env.OPENSHIFT_NAMESPACE }}
oc tag ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-frontend:latest ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-frontend:${{ github.event.inputs.version }}
oc tag ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-backend:latest ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-backend:${{ github.event.inputs.version }}
4 changes: 2 additions & 2 deletions .github/workflows/deploy-backend-to-ocp-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
DOCKER_ARTIFACTORY_REPO: artifacts.developer.gov.bc.ca/docker-remote
ARTIFACTORY_REPO: artifacts.developer.gov.bc.ca

APP_NAME: 'educ-grad-admin'
APP_NAME: "educ-grad-admin"
REPO_NAME: "educ-grad-admin"
BRANCH: "main"
APP_NAME_BACKEND: "educ-grad-admin-backend"
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
openshift-ci-cd:
name: Deploy Backend to PROD
# ubuntu-latest can also be used.
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
environment: prod

outputs:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/deploy-backend-to-ocp-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
DOCKER_ARTIFACTORY_REPO: artifacts.developer.gov.bc.ca/docker-remote
ARTIFACTORY_REPO: artifacts.developer.gov.bc.ca

APP_NAME: 'educ-grad-admin'
APP_NAME: "educ-grad-admin"
REPO_NAME: "educ-grad-admin"
BRANCH: "main"
APP_NAME_BACKEND: "educ-grad-admin-backend"
Expand All @@ -38,7 +38,7 @@ env:
MIN_MEM: "200Mi"
MAX_MEM: "250Mi"
MIN_REPLICAS: "3"
MAX_REPLICAS: "3"
MAX_REPLICAS: "5"

on:
workflow_dispatch:
Expand All @@ -47,7 +47,7 @@ jobs:
openshift-ci-cd:
name: Deploy Backend to TEST
# ubuntu-latest can also be used.
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
environment: test

outputs:
Expand Down Expand Up @@ -93,6 +93,6 @@ jobs:
oc rollout status dc/${{ env.IMAGE_NAME }}-dc
- name: ZAP Scan
uses: zaproxy/action-full-scan@v0.3.0
uses: zaproxy/action-full-scan@v0.10.0
with:
target: 'https://educ-grad-admin-bbe4c3-test.apps.silver.devops.gov.bc.ca'
target: "https://educ-grad-admin-bbe4c3-test.apps.silver.devops.gov.bc.ca"
6 changes: 3 additions & 3 deletions .github/workflows/deploy-frontend-to-ocp-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
DOCKER_ARTIFACTORY_REPO: artifacts.developer.gov.bc.ca/docker-remote
ARTIFACTORY_REPO: artifacts.developer.gov.bc.ca

APP_NAME: 'educ-grad-admin'
APP_NAME: "educ-grad-admin"
REPO_NAME: "educ-grad-admin"
BRANCH: "main"
APP_NAME_FRONTEND: "educ-grad-admin-frontend"
Expand All @@ -46,7 +46,7 @@ jobs:
openshift-ci-cd:
name: Deploy Frontend to PROD
# ubuntu-latest can also be used.
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
environment: prod

outputs:
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
oc process -f tools/openshift/frontend-dc.yaml -p REPO_NAME=educ-grad-admin \
-p HOST_ROUTE=grad.gov.bc.ca -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \
-p APP_NAME=educ-grad-admin -p TAG=${{ steps.get-latest-tag.outputs.tag }} -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 -f -
# Start rollout (if necessary) and follow it
oc rollout latest dc/${{ env.IMAGE_NAME }}-dc 2> /dev/null \
|| true && echo "Rollout in progress"
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/deploy-frontend-to-ocp-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
DOCKER_ARTIFACTORY_REPO: artifacts.developer.gov.bc.ca/docker-remote
ARTIFACTORY_REPO: artifacts.developer.gov.bc.ca

APP_NAME: 'educ-grad-admin'
APP_NAME: "educ-grad-admin"
REPO_NAME: "educ-grad-admin"
BRANCH: "main"
APP_NAME_FRONTEND: "educ-grad-admin-frontend"
Expand All @@ -34,7 +34,7 @@ env:
MIN_MEM: "200Mi"
MAX_MEM: "250Mi"
MIN_REPLICAS: "3"
MAX_REPLICAS: "3"
MAX_REPLICAS: "5"

# SITE_URL should have no scheme or port. It will be prepended with https://
HOST_ROUTE: ${{ secrets.SITE_URL }}
Expand All @@ -46,7 +46,7 @@ jobs:
openshift-ci-cd:
name: Deploy Frontend to TEST
# ubuntu-latest can also be used.
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
environment: test

outputs:
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
oc process -f tools/openshift/frontend-dc.yaml -p REPO_NAME=educ-grad-admin \
-p HOST_ROUTE=educ-grad-admin-bbe4c3-test.apps.silver.devops.gov.bc.ca -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \
-p APP_NAME=educ-grad-admin -p TAG=${{ steps.get-latest-tag.outputs.tag }} -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-test -f -
# Start rollout (if necessary) and follow it
oc rollout latest dc/${{ env.IMAGE_NAME }}-dc 2> /dev/null \
|| true && echo "Rollout in progress"
Expand All @@ -94,6 +94,6 @@ jobs:
oc rollout status dc/${{ env.IMAGE_NAME }}-dc
- name: ZAP Scan
uses: zaproxy/action-full-scan@v0.3.0
uses: zaproxy/action-full-scan@v0.10.0
with:
target: 'https://educ-grad-admin-bbe4c3-test.apps.silver.devops.gov.bc.ca'
target: "https://educ-grad-admin-bbe4c3-test.apps.silver.devops.gov.bc.ca"
4 changes: 2 additions & 2 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
<v-card-text>
<p v-if="tokenExpired">Your session has expired. Please Login.</p>
<p v-else>
Your session is about to expire in {{ timerValue }} seconds. Do
you want to extend your session?
Your session is about to expire in {{ timeRemaining }} seconds.
Do you want to extend your session?
</p>
</v-card-text>

Expand Down

0 comments on commit c0e5bc9

Please sign in to comment.