Skip to content

Commit

Permalink
Merge branch 'main' into feat/fe/change-app-name
Browse files Browse the repository at this point in the history
  • Loading branch information
mamartinezmejia authored Mar 13, 2024
2 parents 50bcf52 + 171c138 commit 006727d
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 76 deletions.
39 changes: 17 additions & 22 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ jobs:
needs: [images-test]
env:
ZONE: test
DOMAIN: apps.silver.devops.gov.bc.ca
# URL: forestclient-tst.nrs.gov.bc.ca
URL: nr-forest-client-test-frontend.apps.silver.devops.gov.bc.ca
BROKER_URL: https://nr-broker.apps.silver.devops.gov.bc.ca
VAULT_ADDR: https://vault-iit.apps.silver.devops.gov.bc.ca
PREFIX: ${{ github.event.repository.name }}-test
environment: test
runs-on: ubuntu-22.04
steps:
Expand Down Expand Up @@ -82,8 +82,7 @@ jobs:
-p COGNITO_USER_POOL=${{ secrets.COGNITO_USER_POOL }}
-p COGNITO_DOMAIN=${{ secrets.COGNITO_DOMAIN }}
-p COGNITO_ENVIRONMENT=TEST
-p COGNITO_REDIRECT_URI=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}/dashboard
-p COGNITO_LOGOUT_URI='https://logontest7.gov.bc.ca/clp-cgi/logoff.cgi?retnow=1&returl=https://test.loginproxy.gov.bc.ca/auth/realms/standard/protocol/openid-connect/logout?redirect_uri=${{ secrets.COGNITO_LOGOUT_URI }}'
-p COGNITO_REDIRECT_URI=https://${{ env.URL }}/dashboard
-p CHES_MAIL_COPY=${{ secrets.CHES_MAIL_COPY }}

- name: Conventional Changelog Update
Expand Down Expand Up @@ -113,8 +112,9 @@ jobs:
name: TEST Deployment
needs: [test-init]
env:
# URL: forestclient-tst.nrs.gov.bc.ca
URL: nr-forest-client-test-frontend.apps.silver.devops.gov.bc.ca
ZONE: test
DOMAIN: apps.silver.devops.gov.bc.ca
environment: test
runs-on: ubuntu-22.04
steps:
Expand Down Expand Up @@ -169,7 +169,7 @@ jobs:
-p BCREGISTRY_URI='https://bcregistry-prod.apigee.net'
-p COGNITO_REGION=ca-central-1
-p COGNITO_COOKIE_DOMAIN=gov.bc.ca
-p URL_ZONE=${{ env.ZONE }}
-p FRONTEND_URL=${{ env.URL }}

- name: Dev data replacement
uses: bcgov-nr/[email protected]
Expand All @@ -193,7 +193,6 @@ jobs:
parameters:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/legacy:${{ env.ZONE }}
-p URL_ZONE=${{ env.ZONE }}

- name: Deploy Frontend
uses: bcgov-nr/[email protected]
Expand All @@ -208,13 +207,12 @@ jobs:
-p PROMOTE=${{ github.repository }}/frontend:${{ env.ZONE }}
-p GREEN_DOMAIN=${{ secrets.GREEN_DOMAIN }}
-p VITE_NODE_ENV=openshift-${{ env.ZONE }}
-p URL_ZONE=${{ env.ZONE }}
-p URL=${{ env.URL }}
-p COGNITO_REGION=${{ secrets.COGNITO_REGION }}
-p COGNITO_CLIENT_ID=${{ secrets.COGNITO_CLIENT_ID }}
-p COGNITO_USER_POOL=${{ secrets.COGNITO_USER_POOL }}
-p COGNITO_DOMAIN=${{ secrets.COGNITO_DOMAIN }}
-p COGNITO_ENVIRONMENT=TEST
-p COGNITO_REDIRECT_URI=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}/dashboard
-p COGNITO_LOGOUT_URI='https://logontest7.gov.bc.ca/clp-cgi/logoff.cgi?retnow=1&returl=https://test.loginproxy.gov.bc.ca/auth/realms/standard/protocol/openid-connect/logout?redirect_uri=${{ secrets.COGNITO_LOGOUT_URI }}'

- name: Deploy Processor
Expand All @@ -229,7 +227,6 @@ jobs:
parameters:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/processor:${{ env.ZONE }}
-p URL_ZONE=${{ env.ZONE }}
-p BCREGISTRY_URI='https://bcregistry-prod.apigee.net'

images-prod:
Expand All @@ -251,9 +248,9 @@ jobs:
name: PROD Init
needs: [images-prod]
env:
# URL: forestclient.nrs.gov.bc.ca
URL: nr-forest-client-prod-frontend.apps.silver.devops.gov.bc.ca
ZONE: prod
DOMAIN: apps.silver.devops.gov.bc.ca
PREFIX: ${{ github.event.repository.name }}-prod
environment: prod
runs-on: ubuntu-22.04
steps:
Expand Down Expand Up @@ -287,8 +284,7 @@ jobs:
-p COGNITO_USER_POOL=${{ secrets.COGNITO_USER_POOL }}
-p COGNITO_DOMAIN=${{ secrets.COGNITO_DOMAIN }}
-p COGNITO_ENVIRONMENT=PROD
-p COGNITO_REDIRECT_URI=https://forestclient.nrs.gov.bc.ca/dashboard
-p COGNITO_LOGOUT_URI='https://logon7.gov.bc.ca/clp-cgi/logoff.cgi?retnow=1&returl=https://loginproxy.gov.bc.ca/auth/realms/standard/protocol/openid-connect/logout?redirect_uri=${{ secrets.COGNITO_LOGOUT_URI }}'
-p COGNITO_REDIRECT_URI=https://${{ env.URL }}/dashboard
-p CHES_MAIL_COPY=${{ secrets.CHES_MAIL_COPY }}

prod-deploy:
Expand All @@ -297,8 +293,9 @@ jobs:
env:
PREV: test
ZONE: prod
DOMAIN: apps.silver.devops.gov.bc.ca
environment: prod
# URL: forestclient.nrs.gov.bc.ca
URL: nr-forest-client-prod-frontend.apps.silver.devops.gov.bc.ca
environment: prod
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand All @@ -319,7 +316,8 @@ jobs:
continue-on-error: true
run: |
oc login --token=${{ secrets.OC_TOKEN }} --server=${{ secrets.OC_SERVER }}
oc project ${{ secrets.OC_NAMESPACE }}
oc project ${{ secrets.OC_NAMESPACE }} # Safeguard!
# Run a backup before deploying a new version
oc create job --from=cronjob/${{ github.event.repository.name }}-${{ env.ZONE }}-database-backup ${{ github.event.repository.name }}-${{ env.ZONE }}-database-backup-$(date +%Y%m%d%H%M%S)
Expand Down Expand Up @@ -352,7 +350,7 @@ jobs:
-p BCREGISTRY_URI='https://bcregistry-prod.apigee.net'
-p COGNITO_REGION=ca-central-1
-p COGNITO_COOKIE_DOMAIN=gov.bc.ca
-p URL_ZONE=${{ env.ZONE }}
-p FRONTEND_URL=${{ env.URL }}

- name: Deploy Legacy
uses: bcgov-nr/[email protected]
Expand All @@ -366,7 +364,6 @@ jobs:
parameters:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/legacy:${{ env.PREV }}
-p URL_ZONE=${{ env.ZONE }}

- name: Deploy Frontend
uses: bcgov-nr/[email protected]
Expand All @@ -381,13 +378,12 @@ jobs:
-p PROMOTE=${{ github.repository }}/frontend:${{ env.PREV }}
-p GREEN_DOMAIN=${{ secrets.GREEN_DOMAIN }}
-p VITE_NODE_ENV=openshift-${{ env.ZONE }}
-p URL_ZONE=${{ env.ZONE }}
-p URL=${{ env.URL }}
-p COGNITO_REGION=${{ secrets.COGNITO_REGION }}
-p COGNITO_CLIENT_ID=${{ secrets.COGNITO_CLIENT_ID }}
-p COGNITO_USER_POOL=${{ secrets.COGNITO_USER_POOL }}
-p COGNITO_DOMAIN=${{ secrets.COGNITO_DOMAIN }}
-p COGNITO_ENVIRONMENT=PROD
-p COGNITO_REDIRECT_URI=https://forestclient.nrs.gov.bc.ca/dashboard
-p COGNITO_LOGOUT_URI='https://logon7.gov.bc.ca/clp-cgi/logoff.cgi?retnow=1&returl=https://loginproxy.gov.bc.ca/auth/realms/standard/protocol/openid-connect/logout?redirect_uri=${{ secrets.COGNITO_LOGOUT_URI }}'

- name: Deploy Processor
Expand All @@ -402,5 +398,4 @@ jobs:
parameters:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/processor:${{ env.PREV }}
-p URL_ZONE=${{ env.ZONE }}
-p BCREGISTRY_URI='https://bcregistry-prod.apigee.net'
35 changes: 14 additions & 21 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ jobs:
runs-on: ubuntu-latest
outputs:
semver: ${{ steps.semver.outputs.tag }}
url_zone: ${{ steps.calculate.outputs.url_zone }}
url: ${{ steps.calculate.outputs.url }}
steps:
# steps.semver.outputs.tag => needs.vars.outputs.semver
- uses: actions/checkout@v4
with:
ref: refs/heads/${{ github.event.repository.default_branch }}

# steps.semver.outputs.tag => needs.vars.outputs.semver
- name: Conventional Changelog Update
uses: TriPSs/[email protected]
id: semver
Expand All @@ -32,16 +31,15 @@ jobs:
skip-on-empty: 'false'
skip-version-file: 'true'

- uses: actions/checkout@v4

# steps.calculate.outputs.url => needs.vars.outputs.url
- name: Calculate the deployment number
id: calculate
run: |
echo "url_zone=$((${{ github.event.number }} % 50))" >> $GITHUB_OUTPUT
echo "url=${{ github.event.repository.name }}-$((${{ github.event.number }} % 50))-frontend.apps.silver.devops.gov.bc.ca" >> $GITHUB_OUTPUT
- run: |
echo "semver=${{ steps.semver.outputs.tag}}"
echo "url_zone=${{ steps.calculate.outputs.url_zone}}"
echo "semver=${{ steps.semver.outputs.tag }}"
echo "url=${{ steps.calculate.outputs.url }}"
builds:
name: Builds
Expand Down Expand Up @@ -71,7 +69,7 @@ jobs:
environment: dev
env:
DOMAIN: apps.silver.devops.gov.bc.ca
PREFIX: ${{ github.event.repository.name }}-${{ needs.vars.outputs.url_zone }}
PREFIX: ${{ needs.vars.outputs.url }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -105,8 +103,7 @@ jobs:
-p COGNITO_USER_POOL=${{ secrets.COGNITO_USER_POOL }}
-p COGNITO_DOMAIN=${{ secrets.COGNITO_DOMAIN }}
-p COGNITO_ENVIRONMENT=DEV
-p COGNITO_REDIRECT_URI=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}/dashboard
-p COGNITO_LOGOUT_URI='https://logontest7.gov.bc.ca/clp-cgi/logoff.cgi?retnow=1&returl=https://dev.loginproxy.gov.bc.ca/auth/realms/standard/protocol/openid-connect/logout?redirect_uri=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}'
-p COGNITO_REDIRECT_URI=https://${{ github.event.repository.name }}-${{ github.event.number }}-frontend.apps.silver.devops.gov.bc.ca/dashboard
-p CHES_MAIL_COPY=${{ secrets.CHES_MAIL_COPY }}

- name: Deploy Database Backup
Expand Down Expand Up @@ -160,7 +157,7 @@ jobs:
-p BCREGISTRY_URI='https://bcregistry-prod.apigee.net'
-p COGNITO_REGION=ca-central-1
-p COGNITO_COOKIE_DOMAIN=gov.bc.ca
-p URL_ZONE=${{ needs.vars.outputs.url_zone }}
-p FRONTEND_URL=${{ needs.vars.outputs.url }}

- name: Dev data replacement
uses: bcgov-nr/[email protected]
Expand All @@ -184,7 +181,6 @@ jobs:
parameters:
-p ZONE=${{ github.event.number }}
-p PROMOTE=${{ github.repository }}/legacy:${{ github.event.number }}
-p URL_ZONE=${{ needs.vars.outputs.url_zone }}

- name: Deploy Frontend
uses: bcgov-nr/[email protected]
Expand All @@ -198,15 +194,14 @@ jobs:
-p ZONE=${{ github.event.number }}
-p PROMOTE=${{ github.repository }}/frontend:${{ github.event.number }}
-p VITE_NODE_ENV=openshift-dev
-p URL_ZONE=${{ needs.vars.outputs.url_zone }}
-p URL=${{ needs.vars.outputs.url }}
-p GREEN_DOMAIN=${{ secrets.GREEN_DOMAIN }}
-p COGNITO_REGION=${{ secrets.COGNITO_REGION }}
-p COGNITO_CLIENT_ID=${{ secrets.COGNITO_CLIENT_ID }}
-p COGNITO_USER_POOL=${{ secrets.COGNITO_USER_POOL }}
-p COGNITO_DOMAIN=${{ secrets.COGNITO_DOMAIN }}
-p COGNITO_ENVIRONMENT=DEV
-p COGNITO_REDIRECT_URI=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}/dashboard
-p COGNITO_LOGOUT_URI='https://logontest7.gov.bc.ca/clp-cgi/logoff.cgi?retnow=1&returl=https://dev.loginproxy.gov.bc.ca/auth/realms/standard/protocol/openid-connect/logout?redirect_uri=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}'
-p COGNITO_LOGOUT_URI='https://logontest7.gov.bc.ca/clp-cgi/logoff.cgi?retnow=1&returl=https://dev.loginproxy.gov.bc.ca/auth/realms/standard/protocol/openid-connect/logout?redirect_uri=https://${{ github.event.repository.name }}-${{ github.event.number }}-frontend.apps.silver.devops.gov.bc.ca'

- name: Deploy Processor
uses: bcgov-nr/[email protected]
Expand All @@ -220,7 +215,6 @@ jobs:
parameters:
-p ZONE=${{ github.event.number }}
-p PROMOTE=${{ github.repository }}/processor:${{ github.event.number }}
-p URL_ZONE=${{ needs.vars.outputs.url_zone }}
-p BCREGISTRY_URI='https://bcregistry-prod.apigee.net'

cypress-run:
Expand All @@ -229,8 +223,7 @@ jobs:
needs: [deploy, vars]
environment: dev
env:
DOMAIN: apps.silver.devops.gov.bc.ca
PREFIX: ${{ github.event.repository.name }}-${{ needs.vars.outputs.url_zone }}
URL: ${{ needs.vars.outputs.url }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -245,7 +238,7 @@ jobs:
with:
working-directory: cypress
env:
CYPRESS_baseUrl: https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}
CYPRESS_baseUrl: https://${{ env.URL }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Cypress Results
Expand Down Expand Up @@ -273,4 +266,4 @@ jobs:
with:
name: cypress-videos
path: cypress/cypress/videos
retention-days: 7
retention-days: 7
6 changes: 3 additions & 3 deletions .github/workflows/pr-validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ jobs:
name: Variables
runs-on: ubuntu-22.04
outputs:
url_zone: ${{ steps.calculate.outputs.url_zone }}
url: ${{ steps.calculate.outputs.url }}
steps:
- name: Calculate the deployment number
id: calculate
run: echo "url_zone=$((${{ github.event.number }} % 50))" >> $GITHUB_OUTPUT
run: echo "url=$((${{ github.event.number }} % 50))" >> $GITHUB_OUTPUT

validate:
name: Validate PR
needs: [vars]
uses: bcgov/quickstart-openshift-helpers/.github/workflows/[email protected]
with:
markdown_links: |
Any successful deployments (not always required) will be available [here](https://${{ github.event.repository.name }}-${{ needs.vars.outputs.url_zone }}-frontend.apps.silver.devops.gov.bc.ca/)
Any successful deployments (not always required) will be available [here](https://${{ github.event.repository.name }}-${{ needs.vars.outputs.url }}-frontend.apps.silver.devops.gov.bc.ca/)
changelog:
name: Pull Request Validation
Expand Down
12 changes: 6 additions & 6 deletions backend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ parameters:
description: Cognito cookie domain to be used
required: true
default: gov.bc.ca
- name: URL_ZONE
description: Zone to use for URL
- name: FRONTEND_URL
description: Frontend URL
required: true
objects:
- kind: ImageStream
Expand Down Expand Up @@ -106,11 +106,11 @@ objects:
name: ${NAME}
env:
- name: FRONTEND_URL
value: https://${NAME}-${URL_ZONE}-frontend.${DOMAIN}
value: https://${FRONTEND_URL}
- name: LEGACY_URL
value: http://${NAME}-${ZONE}-legacy/api
- name: SELF_URI
value: https://${NAME}-${URL_ZONE}-${COMPONENT}.${DOMAIN}
value: https://${NAME}-${ZONE}-${COMPONENT}.${DOMAIN}
- name: CHES_CLIENT_ID
valueFrom:
secretKeyRef:
Expand Down Expand Up @@ -238,7 +238,7 @@ objects:
app: ${NAME}-${ZONE}
name: ${NAME}-${ZONE}-${COMPONENT}
spec:
host: ${NAME}-${URL_ZONE}-${COMPONENT}.${DOMAIN}
host: ${NAME}-${ZONE}-${COMPONENT}.${DOMAIN}
port:
targetPort: 8080-tcp
to:
Expand All @@ -247,4 +247,4 @@ objects:
weight: 100
tls:
termination: edge
insecureEdgeTerminationPolicy: Redirect
insecureEdgeTerminationPolicy: Redirect
9 changes: 1 addition & 8 deletions common/openshift.init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ parameters:
- name: NAME
description: Product name
value: nr-forest-client
- name: PG_DATABASE
description: Postgres database name
value: database
- name: ZONE
description: Deployment zone, e.g. pr-### or prod
required: true
Expand Down Expand Up @@ -83,9 +80,6 @@ parameters:
- name: COGNITO_REDIRECT_URI
description: Cognito redirect url once logged in
required: true
- name: COGNITO_LOGOUT_URI
description: Cognito redirect url once logged out
required: true
- name: CHES_MAIL_COPY
description: Email address to copy all CHES emails to
required: true
Expand Down Expand Up @@ -123,7 +117,6 @@ objects:
cognito-domain: ${COGNITO_DOMAIN}
cognito-environment: ${COGNITO_ENVIRONMENT}
cognito-redirect-uri: ${COGNITO_REDIRECT_URI}
cognito-logout-uri: ${COGNITO_LOGOUT_URI}
ches-mail-copy: ${CHES_MAIL_COPY}
processor-service-account-secret: ${PROCESSOR_SERVICE_ACCOUNT_SECRET}
processor-service-account-name: processor-service-account
Expand Down Expand Up @@ -180,4 +173,4 @@ objects:
resources:
requests:
storage: ${IDX_BKP_PVC_SIZE}
storageClassName: netapp-file-standard
storageClassName: netapp-file-standard
Loading

0 comments on commit 006727d

Please sign in to comment.