Skip to content

Commit

Permalink
feat/pipeline: added oracle env variable to pipeline, refs: #6
Browse files Browse the repository at this point in the history
  • Loading branch information
catherine meng authored and catherine meng committed Jul 14, 2022
1 parent ea384c6 commit eff3401
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 98 deletions.
102 changes: 50 additions & 52 deletions .github/openshift/deploy.backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,37 @@ parameters:
- name: PROMOTE
description: Image (namespace/name:tag) to promote/import
value: bcgov/nr-old-growth:prod-backend
# - name: EMAIL_USERNAME
# description: CHES service client
# required: true
# - name: EMAIL_PASSWORD
# description: CHES service client password
# required: true
# - name: EMAIL_TOKEN_URL
# description: CHES authentication url
# required: true
# - name: EMAIL_API_URL
# description: CHES email api url
# required: true
- name: ORACLEDB_USER
description: Oracle database user name
required: true
- name: ORACLEDB_PASSWORD
description: Oracle database password
required: true
- name: ORACLEDB_DATABASE
description: Oracle database database name
required: true
- name: ORACLEDB_HOST
description: Oracle database host
required: true
- name: ORACLEDB_SERVICENAME
description: Oracle database service name
required: true
- name: NODE_ENV
description: environment mode
required: true
objects:
# - apiVersion: v1
# kind: Secret
# metadata:
# name: ${NAME}-${ZONE}-${COMPONENT}
# labels:
# app: ${NAME}-${ZONE}
# stringData:
# email-username: "${EMAIL_USERNAME}"
# email-password: "${EMAIL_PASSWORD}"
- apiVersion: v1
kind: Secret
metadata:
name: ${NAME}-${ZONE}-${COMPONENT}
labels:
app: ${NAME}-${ZONE}
stringData:
oracle-user: "${ORACLEDB_USER}"
oracle-password: "${ORACLEDB_PASSWORD}"
oracle-database: "${ORACLEDB_DATABASE}"
oracle-host: "${ORACLEDB_HOST}"
oracle-service: "${ORACLEDB_SERVICENAME}"
- apiVersion: v1
kind: ImageStream
metadata:
Expand Down Expand Up @@ -112,43 +118,35 @@ objects:
imagePullPolicy: Always
name: ${NAME}
env:
- name: POSTGRESQL_HOST
value: ${NAME}-${ZONE}-database
- name: POSTGRESQL_DATABASE
- name: FRONTEND_URL
value: https://${NAME}-${ZONE}-frontend.${DOMAIN}
- name: BACKEND_URL
value: https://${NAME}-${ZONE}-backend.${DOMAIN}
- name: ORACLEDB_USER
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-database
key: database-name
- name: POSTGRESQL_PASSWORD
name: ${NAME}-${ZONE}-${COMPONENT}
key: oracle-user
- name: ORACLEDB_PASSWORD
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-database
key: database-password
- name: POSTGRESQL_USER
name: ${NAME}-${ZONE}-${COMPONENT}
key: oracle-password
- name: ORACLEDB_DATABASE
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-database
key: database-user
- name: FRONTEND_URL
value: https://${NAME}-${ZONE}-frontend.${DOMAIN}
- name: BACKEND_URL
value: https://${NAME}-${ZONE}-backend.${DOMAIN}
# - name: EMAIL_USERNAME
# valueFrom:
# secretKeyRef:
# name: ${NAME}-${ZONE}-${COMPONENT}
# key: email-username
# - name: EMAIL_PASSWORD
# valueFrom:
# secretKeyRef:
# name: ${NAME}-${ZONE}-${COMPONENT}
# key: email-password
# - name: EMAIL_TOKEN_URL
# value: ${EMAIL_TOKEN_URL}
# - name: EMAIL_API_URL
# value: ${EMAIL_API_URL}
# - name: EMAIL_FROM
# value: "[email protected]"
name: ${NAME}-${ZONE}-${COMPONENT}
key: oracle-database
- name: ORACLEDB_HOST
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: oracle-host
- name: ORACLEDB_SERVICENAME
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: oracle-service
- name: NODE_ENV
value: ${NODE_ENV}

Expand Down
17 changes: 6 additions & 11 deletions .github/workflows/merge-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,23 +165,18 @@ jobs:
--from-literal=config.js="const config = (() => { return { VITE_BACKEND_URL: 'https://${{ env.NAME }}-${{ env.ZONE }}-backend.apps.silver.devops.gov.bc.ca'}; })();"
# Process and apply deployment templates
oc process -f .github/openshift/deploy.database.yml -p ZONE=${{ env.ZONE }} | oc apply -f -
oc process -f .github/openshift/deploy.backend.yml -p ZONE=${{ env.ZONE }} \
-p PROMOTE=${{ github.repository }}:${{ env.ZONE }}-backend \
-p NODE_ENV='development' | oc apply -f -
# -p EMAIL_USERNAME=${{ secrets.CHES_SERVICE_CLIENT }} \
# -p EMAIL_PASSWORD=${{ secrets.CHES_CLIENT_PASSWORD }} \
# -p EMAIL_TOKEN_URL='https://oidc.gov.bc.ca/auth/realms/jbd6rnxw/protocol/openid-connect/token' \
# -p EMAIL_API_URL='https://ches-dev.apps.silver.devops.gov.bc.ca/api/v1' | oc apply -f -
-p NODE_ENV='development' \
-p ORACLEDB_USER=${{ secrets.ORACLEDB_USER }} \
-p ORACLEDB_PASSWORD=${{ secrets.ORACLEDB_PASSWORD }} \
-p ORACLEDB_DATABASE=${{ secrets.ORACLEDB_DATABASE }} \
-p ORACLEDB_HOST=${{ secrets.ORACLEDB_HOST }} \
-p ORACLEDB_SERVICENAME=${{ secrets.ORACLEDB_SERVICENAME }} | oc apply -f -
oc process -f .github/openshift/deploy.frontend.yml -p ZONE=${{ env.ZONE }} \
-p PROMOTE=${{ github.repository }}:${{ env.ZONE }}-frontend | oc apply -f -
# Follow any active rollouts (see deploymentconfigs)
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-database -w
# Run database migration
oc exec dc/${{ env.NAME }}-${{ env.ZONE }}-database -- psql -d ${{ env.NAME }} -U ${{ env.NAME }} -c "$(cat backend/src/databasescripts/fsa.sql)"
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-backend -w
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-frontend -w
Expand Down
30 changes: 12 additions & 18 deletions .github/workflows/merge-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,23 +221,18 @@ jobs:
--from-literal=config.js="const config = (() => { return { VITE_BACKEND_URL: 'https://${{ env.NAME }}-${{ env.ZONE }}-backend.apps.silver.devops.gov.bc.ca'}; })();"
# Process and apply deployment templates
oc process -f .github/openshift/deploy.database.yml -p ZONE=${{ env.ZONE }} | oc apply -f -
oc process -f .github/openshift/deploy.backend.yml -p ZONE=${{ env.ZONE }} \
-p PROMOTE=${{ github.repository }}:${{ env.ZONE }}-backend \
-p NODE_ENV='development' | oc apply -f -
# -p EMAIL_USERNAME=${{ secrets.CHES_SERVICE_CLIENT }} \
# -p EMAIL_PASSWORD=${{ secrets.CHES_CLIENT_PASSWORD }} \
# -p EMAIL_TOKEN_URL='https://oidc.gov.bc.ca/auth/realms/jbd6rnxw/protocol/openid-connect/token' \
# -p EMAIL_API_URL='https://ches-dev.apps.silver.devops.gov.bc.ca/api/v1' | oc apply -f -
-p NODE_ENV='development' \
-p ORACLEDB_USER=${{ secrets.ORACLEDB_USER }} \
-p ORACLEDB_PASSWORD=${{ secrets.ORACLEDB_PASSWORD }} \
-p ORACLEDB_DATABASE=${{ secrets.ORACLEDB_DATABASE }} \
-p ORACLEDB_HOST=${{ secrets.ORACLEDB_HOST }} \
-p ORACLEDB_SERVICENAME=${{ secrets.ORACLEDB_SERVICENAME }} | oc apply -f -
oc process -f .github/openshift/deploy.frontend.yml -p ZONE=${{ env.ZONE }} \
-p PROMOTE=${{ github.repository }}:${{ env.ZONE }}-frontend | oc apply -f -
# Follow any active rollouts (see deploymentconfigs)
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-database -w
# Run database migration
oc exec dc/${{ env.NAME }}-${{ env.ZONE }}-database -- psql -d ${{ env.NAME }} -U ${{ env.NAME }} -c "$(cat backend/src/databasescripts/fsa.sql)"
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-backend -w
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-frontend -w
Expand Down Expand Up @@ -318,19 +313,18 @@ jobs:
# --from-literal=config.js="const config = (() => { return { VITE_BACKEND_URL: 'https://${{ env.NAME }}-${{ env.ZONE }}-backend.apps.silver.devops.gov.bc.ca'}; })();"

# # Process and apply deployment templates
# oc process -f .github/openshift/deploy.database.yml -p ZONE=${{ env.ZONE }} | oc apply -f -
# oc process -f .github/openshift/deploy.backend.yml -p ZONE=${{ env.ZONE }} \
# -p PROMOTE=${{ github.repository }}:${{ env.PREV }}-backend \
# -p NODE_ENV='production' | oc apply -f -
# # -p EMAIL_USERNAME=${{ secrets.CHES_SERVICE_CLIENT }} \
# # -p EMAIL_PASSWORD=${{ secrets.CHES_CLIENT_PASSWORD }} \
# # -p EMAIL_TOKEN_URL='https://oidc.gov.bc.ca/auth/realms/jbd6rnxw/protocol/openid-connect/token' \
# # -p EMAIL_API_URL='https://ches.apps.silver.devops.gov.bc.ca/api/v1' | oc apply -f -
# -p NODE_ENV='production' \
# -p ORACLEDB_USER=${{ secrets.ORACLEDB_USER }} \
# -p ORACLEDB_PASSWORD=${{ secrets.ORACLEDB_PASSWORD }} \
# -p ORACLEDB_DATABASE=${{ secrets.ORACLEDB_DATABASE }} \
# -p ORACLEDB_HOST=${{ secrets.ORACLEDB_HOST }} \
# -p ORACLEDB_SERVICENAME=${{ secrets.ORACLEDB_SERVICENAME }} | oc apply -f -
# oc process -f .github/openshift/deploy.frontend.yml -p ZONE=${{ env.ZONE }} \
# -p PROMOTE=${{ github.repository }}:${{ env.PREV }}-frontend | oc apply -f -

# # Follow any active rollouts (see deploymentconfigs)
# oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-database -w
# oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-backend -w
# oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-frontend -w

Expand Down
20 changes: 6 additions & 14 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,6 @@ jobs:
oc create configmap ${{ env.NAME }}-${{ env.ZONE }}-frontend \
--from-literal=config.js="const config = (() => { return { VITE_BACKEND_URL: 'https://${{ env.NAME }}-${{ env.ZONE }}-backend.apps.silver.devops.gov.bc.ca'}; })();"
# Database uses a default build
oc process -f .github/openshift/deploy.database.yml -p ZONE=${{ env.ZONE }} | oc apply -f -
# Clean previous image, if rebuilding
if [ ${{ needs.build-backend.outputs.build == 'true' }} ]
then
Expand All @@ -358,12 +355,12 @@ jobs:
# Process and apply template
oc process -f .github/openshift/deploy.backend.yml -p ZONE=${{ env.ZONE }} \
-p PROMOTE=${{ github.repository }}:${{ env.ZONE }}-backend \
-p NODE_ENV='development' | oc apply -f -
# -p EMAIL_USERNAME=${{ secrets.CHES_SERVICE_CLIENT }} \
# -p EMAIL_PASSWORD=${{ secrets.CHES_CLIENT_PASSWORD }} \
# -p EMAIL_TOKEN_URL='https://dev.oidc.gov.bc.ca/auth/realms/jbd6rnxw/protocol/openid-connect/token' \
# -p EMAIL_API_URL='https://ches-dev.apps.silver.devops.gov.bc.ca/api/v1' | oc apply -f -
-p NODE_ENV='development' \
-p ORACLEDB_USER=${{ secrets.ORACLEDB_USER }} \
-p ORACLEDB_PASSWORD=${{ secrets.ORACLEDB_PASSWORD }} \
-p ORACLEDB_DATABASE=${{ secrets.ORACLEDB_DATABASE }} \
-p ORACLEDB_HOST=${{ secrets.ORACLEDB_HOST }} \
-p ORACLEDB_SERVICENAME=${{ secrets.ORACLEDB_SERVICENAME }} | oc apply -f -
# Clean previous image, if rebuilding
if [ ${{ needs.build-backend.outputs.build == 'true' }} ]
Expand All @@ -378,11 +375,6 @@ jobs:
-p PROMOTE=${{ github.repository }}:${{ env.ZONE }}-frontend | oc apply -f -
# Follow any active rollouts (see deploymentconfigs)
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-database -w
# Run database migration
oc exec dc/${{ env.NAME }}-${{ env.ZONE }}-database -- psql -d ${{ env.NAME }} -U ${{ env.NAME }} -c "$(cat backend/src/databasescripts/fsa.sql)"
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-backend -w
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-frontend -w
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<template>
<div>
<MainHeader />
<b-container>
Hello World !
</b-container>
<b-container> Hello World </b-container>
</div>
</template>

Expand Down

0 comments on commit eff3401

Please sign in to comment.