Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1717 - Segregate db migrations deployment - Part 1 #1932

Merged
merged 103 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
b874dec
updated
guru-aot May 8, 2023
23e35ba
updated
guru-aot May 8, 2023
5658849
updated
guru-aot May 9, 2023
36c498b
updated
guru-aot May 9, 2023
0cd7530
updated
guru-aot May 9, 2023
6db5524
updated
guru-aot May 9, 2023
c8478d8
updated
guru-aot May 9, 2023
fe84312
updated
guru-aot May 9, 2023
85e844e
updated
guru-aot May 9, 2023
6160a9c
updated
guru-aot May 9, 2023
35eba8b
updated
guru-aot May 9, 2023
64c4026
updated
guru-aot May 9, 2023
85e220c
updated
guru-aot May 9, 2023
a549724
updated
guru-aot May 9, 2023
636511e
updated
guru-aot May 9, 2023
5f013dd
updated
guru-aot May 9, 2023
b80878c
updated
guru-aot May 9, 2023
f576146
updated
guru-aot May 9, 2023
1aee750
updated
guru-aot May 9, 2023
663d4ea
updated
guru-aot May 9, 2023
6059a3d
updated
guru-aot May 9, 2023
ae42e0a
updated
guru-aot May 9, 2023
6ccb2a5
updated
guru-aot May 9, 2023
0e4fed0
updated
guru-aot May 9, 2023
08ce3ef
updated
guru-aot May 9, 2023
c804953
updated
guru-aot May 9, 2023
c119a53
updated
guru-aot May 9, 2023
84cc2fd
updated
guru-aot May 9, 2023
11cd2d8
updated
guru-aot May 9, 2023
07a30d7
updated
guru-aot May 9, 2023
139239a
updated
guru-aot May 9, 2023
48a2338
updated
guru-aot May 9, 2023
be5f93e
updated
guru-aot May 9, 2023
6d0386d
updated
guru-aot May 9, 2023
19c3c87
updated
guru-aot May 9, 2023
d80e056
updated
guru-aot May 9, 2023
5c7aa3c
updated
guru-aot May 9, 2023
a63eea5
updated
guru-aot May 11, 2023
9fa036a
updated
guru-aot May 11, 2023
91bb8d0
updated
guru-aot May 11, 2023
ab5f628
updated
guru-aot May 11, 2023
8f148bf
updated
guru-aot May 11, 2023
69f490f
updated
guru-aot May 11, 2023
f0127c5
updated
guru-aot May 11, 2023
69c1b3a
updated
guru-aot May 11, 2023
dbb9b58
updated
guru-aot May 11, 2023
c485bad
updated
guru-aot May 12, 2023
8024f49
updated
guru-aot May 12, 2023
5df71e3
updated
guru-aot May 12, 2023
82540e0
updated
guru-aot May 12, 2023
749762f
updated
guru-aot May 12, 2023
1e5cc43
updated
guru-aot May 12, 2023
eba989b
updated
guru-aot May 12, 2023
4906fd0
updated
guru-aot May 12, 2023
e9d9d49
updated
guru-aot May 12, 2023
b55c372
updated
guru-aot May 12, 2023
d50b8d9
updated
guru-aot May 12, 2023
2e74da8
updated
guru-aot May 12, 2023
6533b98
updated
guru-aot May 12, 2023
e46946f
updated
guru-aot May 12, 2023
79d3774
updated
guru-aot May 12, 2023
7bf7207
updated
guru-aot May 12, 2023
448d152
Merge branch 'main' into Segregate_DB_Migrations_Deployment
guru-aot May 12, 2023
cfe9d0b
updated
guru-aot May 12, 2023
20e30f4
updated
guru-aot May 12, 2023
769a609
updated
guru-aot May 12, 2023
c937bbf
updated
guru-aot May 12, 2023
a82f967
updated
guru-aot May 12, 2023
d3f2b3b
updated
guru-aot May 12, 2023
7e508ae
updated
guru-aot May 12, 2023
28423ce
updated
guru-aot May 12, 2023
ab90674
updated
guru-aot May 12, 2023
777660f
updated
guru-aot May 15, 2023
e96b907
updated
guru-aot May 15, 2023
a29d664
uodated
guru-aot May 15, 2023
33eaedb
updated
guru-aot May 15, 2023
e527545
updated
guru-aot May 15, 2023
3fe4d26
updated
guru-aot May 15, 2023
69a1ff2
updated
guru-aot May 15, 2023
a254889
updated
guru-aot May 15, 2023
b283186
updated
guru-aot May 15, 2023
ca9f5ae
updated
guru-aot May 15, 2023
a062e62
updated
guru-aot May 15, 2023
ecfb7b4
updated
guru-aot May 15, 2023
9b46136
updated
guru-aot May 15, 2023
f0c8cec
updated
guru-aot May 15, 2023
ef1473d
updated
guru-aot May 15, 2023
823eaf0
updated
guru-aot May 15, 2023
8caa352
updated
guru-aot May 15, 2023
933122f
updated
guru-aot May 15, 2023
8fccecf
updated
guru-aot May 15, 2023
1e3fe58
updated
guru-aot May 16, 2023
7b74466
Merge branch 'main' into Segregate_DB_Migrations_Deployment
guru-aot May 16, 2023
14bef24
updated
guru-aot May 16, 2023
837651d
updated
guru-aot May 16, 2023
88273d0
updated
guru-aot May 16, 2023
acb3b3c
updated
guru-aot May 16, 2023
6472a69
updated
guru-aot May 16, 2023
79173cc
updated
guru-aot May 16, 2023
b0c03ed
updated
guru-aot May 16, 2023
0771332
updated
guru-aot May 16, 2023
531b4d9
updated
guru-aot May 16, 2023
4df3b12
updated
guru-aot May 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
301 changes: 240 additions & 61 deletions .github/workflows/build-deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,36 @@ on:
type: choice
required: false
options:
-
- noRelease
- draft
- publish
env:
NAMESPACE: ${{ secrets.OPENSHIFT_ENV_NAMESPACE }}
HOST_PREFIX: ${{ secrets.HOST_PREFIX }}
BUILD_NAMESPACE: 0c27fb-tools
KEYCLOAK_REALM: "aestsims"
KEYCLOAK_AUTH_URL: ${{ secrets.KEYCLOAK_AUTH_URL }}
BCeID_WEB_SERVICE_WSDL: ${{ secrets.BCeID_WEB_SERVICE_WSDL }}
SITE_MINDER_LOGOUT_URL: ${{ secrets.SITE_MINDER_LOGOUT_URL }}
ATBC_LOGIN_ENDPOINT: ${{ secrets.ATBC_LOGIN_ENDPOINT }}
ATBC_ENDPOINT: ${{ secrets.ATBC_ENDPOINT }}
SWAGGER_ENABLED: true
APPLICATION_ARCHIVE_DAYS: 43
BYPASS_APPLICATION_SUBMIT_VALIDATIONS: ${{ secrets.BYPASS_APPLICATION_SUBMIT_VALIDATIONS }}
BYPASS_CRA_INCOME_VERIFICATION: ${{ secrets.BYPASS_CRA_INCOME_VERIFICATION }}
API_SECRET_NAME: ${{ secrets.OPENSHIFT_SIMS_CREDS_NAME }}
WORKERS_SECRET_NAME: ${{ secrets.OPENSHIFT_SIMS_CREDS_NAME }}
QUEUE_CONSUMERS_SECRET_NAME: ${{ secrets.OPENSHIFT_SIMS_CREDS_NAME }}
FORMS_SECRET_NAME: ${{ secrets.FORMS_SECRET_NAME }}
QUEUE_PREFIX: ${{ secrets.QUEUE_PREFIX }}
API_PORT: ${{ secrets.API_PORT }}
WEB_PORT: ${{ secrets.WEB_PORT }}
API: ${{ format('{0}api-sims', secrets.HOST_PREFIX) }}
WEB: ${{ format('{0}web-sims', secrets.HOST_PREFIX) }}
WORKERS: ${{ format('{0}workers-sims', secrets.HOST_PREFIX) }}
QUEUE_CONSUMERS: ${{ format('{0}queue-consumers-sims', secrets.HOST_PREFIX) }}
SWAGGER_NAME: ${{ format('{0}swagger', secrets.HOST_PREFIX) }}
DATABASE_NAME_KEY: ${{ secrets.DATABASE_NAME_KEY }}

jobs:
# Print variables for logging and debugging purposes
Expand All @@ -48,6 +75,7 @@ jobs:
name: "Create tag"
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
needs: checkEnv
steps:
- name: Get bumb value
uses: haya14busa/action-cond@v1
Expand Down Expand Up @@ -98,122 +126,273 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: echo "created release ${{ needs.createTag.outputs.newTag }} ${{ steps.createNewRelease.outputs.html_url }}!"

# Building all packages
build:
name: Building all packages
environment: DEV
# Build DB migrations.
build-db-migrations:
name: Build db-migrations
runs-on: ubuntu-latest
needs: createTag
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
env:
BUILD_NAMESPACE: 0c27fb-tools
BUILD_REF: ${{ needs.createTag.outputs.newTag }}
HOST_PREFIX: ${{ secrets.HOST_PREFIX }}
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
steps:
# Checkout the PR branch
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BRANCH: $BUILD_REF
echo BRANCH: ${{ needs.createTag.outputs.newTag }}
echo HOST_PREFIX: $HOST_PREFIX

- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ needs.createTag.outputs.newTag }}
# Log in to OpenShift.
# Note: The secrets needed to log in are NOT available if the PR comes from a FORK.
# PR's must originate from a branch off the original repo or else all openshift `oc` commands will fail.

- name: Log in to OpenShift
run: |
oc login --token=${{ secrets.SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443
# Build the images

- name: Build db-migrations Image
working-directory: "./devops"
run: |
make oc-build-db-migrations

# Build SIMS-API
build-sims-api:
name: Build SIMS-API
runs-on: ubuntu-latest
needs: createTag
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BRANCH: ${{ needs.createTag.outputs.newTag }}
echo HOST_PREFIX: $HOST_PREFIX

- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ needs.createTag.outputs.newTag }}

- name: Log in to OpenShift
run: |
oc login --token=${{ secrets.SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443

- name: Build SIMS-API Image
working-directory: "./devops"
run: |
make oc-build-api

# Build Workers
build-workers:
name: Build Workers
runs-on: ubuntu-latest
needs: createTag
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BRANCH: ${{ needs.createTag.outputs.newTag }}
echo HOST_PREFIX: $HOST_PREFIX

- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ needs.createTag.outputs.newTag }}

- name: Log in to OpenShift
run: |
oc login --token=${{ secrets.SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443

- name: Build Workers Image
working-directory: "./devops"
run: |
make oc-build-workers

# Build Queue Consumers
build-queue-consumers:
name: Build Queue Consumers
runs-on: ubuntu-latest
needs: createTag
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BRANCH: ${{ needs.createTag.outputs.newTag }}
echo HOST_PREFIX: $HOST_PREFIX

- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ needs.createTag.outputs.newTag }}

- name: Log in to OpenShift
run: |
oc login --token=${{ secrets.SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443

- name: Build Queue Consumers Image
working-directory: "./devops"
run: |
make oc-build-queue-consumers

# Build Web/Frontend
build-web-frontend:
name: Build Web/Frontend
runs-on: ubuntu-latest
needs: createTag
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BRANCH: ${{ needs.createTag.outputs.newTag }}
echo HOST_PREFIX: $HOST_PREFIX

- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ needs.createTag.outputs.newTag }}

- name: Log in to OpenShift
run: |
oc login --token=${{ secrets.SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443

- name: Build Web/Frontend Image
working-directory: "./devops"
run: |
make oc-build-web

# Run DB migrations.
run-db-migrations:
name: Run db-migrations
runs-on: ubuntu-latest
needs: [build-db-migrations, build-sims-api, build-workers, build-queue-consumers, build-web-frontend]
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BRANCH: ${{ needs.createTag.outputs.newTag }}
echo HOST_PREFIX: $HOST_PREFIX

- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ needs.createTag.outputs.newTag }}

# Deploying all packages
deployDev:
name: Deploying all packages
- name: Log in to OpenShift
run: |
oc login --token=${{ secrets.SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443

- name: Run db-migrations
working-directory: "./devops/"
run: |
make oc-run-db-migrations

# Deploy SIMS API.
deploy-sims-api:
name: Deploy SIMS-API
runs-on: ubuntu-latest
environment: DEV
needs:
- build
- createTag
env:
NAMESPACE: ${{ secrets.OPENSHIFT_ENV_NAMESPACE }}
BUILD_REF: ${{ needs.createTag.outputs.newTag }}
HOST_PREFIX: ${{ secrets.HOST_PREFIX }}
BUILD_NAMESPACE: 0c27fb-tools
KEYCLOAK_REALM: "aestsims"
KEYCLOAK_AUTH_URL: ${{ secrets.KEYCLOAK_AUTH_URL }}
BCeID_WEB_SERVICE_WSDL: ${{ secrets.BCeID_WEB_SERVICE_WSDL }}
SITE_MINDER_LOGOUT_URL: ${{ secrets.SITE_MINDER_LOGOUT_URL }}
ATBC_LOGIN_ENDPOINT: ${{ secrets.ATBC_LOGIN_ENDPOINT }}
ATBC_ENDPOINT: ${{ secrets.ATBC_ENDPOINT }}
SWAGGER_ENABLED: true
APPLICATION_ARCHIVE_DAYS: 43
BYPASS_APPLICATION_SUBMIT_VALIDATIONS: ${{ secrets.BYPASS_APPLICATION_SUBMIT_VALIDATIONS }}
BYPASS_CRA_INCOME_VERIFICATION: ${{ secrets.BYPASS_CRA_INCOME_VERIFICATION }}
API_SECRET_NAME: ${{ secrets.OPENSHIFT_SIMS_CREDS_NAME }}
WORKERS_SECRET_NAME: ${{ secrets.OPENSHIFT_SIMS_CREDS_NAME }}
QUEUE_CONSUMERS_SECRET_NAME: ${{ secrets.OPENSHIFT_SIMS_CREDS_NAME }}
FORMS_SECRET_NAME: ${{ secrets.FORMS_SECRET_NAME }}
QUEUE_PREFIX: ${{ secrets.QUEUE_PREFIX }}
API_PORT: ${{ secrets.API_PORT }}
WEB_PORT: ${{ secrets.WEB_PORT }}
API: ${{ format('{0}api-sims', secrets.HOST_PREFIX) }}
WEB: ${{ format('{0}web-sims', secrets.HOST_PREFIX) }}
WORKERS: ${{ format('{0}workers-sims', secrets.HOST_PREFIX) }}
QUEUE_CONSUMERS: ${{ format('{0}queue-consumers-sims', secrets.HOST_PREFIX) }}
SWAGGER_NAME: ${{ format('{0}swagger', secrets.HOST_PREFIX) }}
DATABASE_NAME_KEY: ${{ secrets.DATABASE_NAME_KEY }}
needs: run-db-migrations
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo NAMESPACE: $NAMESPACE
echo BRANCH: $BUILD_REF
echo BRANCH: ${{ needs.createTag.outputs.newTag }}
echo HOST_PREFIX: $HOST_PREFIX
# Checkout the PR branch
- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ needs.createTag.outputs.newTag }}
# Log in to OpenShift.
# Note: The secrets needed to log in are NOT available if the PR comes from a FORK.
# PR's must originate from a branch off the original repo or else all openshift `oc` commands will fail.

- name: Log in to OpenShift
run: |
oc login --token=${{ secrets.SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443
# Deploy SIMS-Api

- name: Deploy SIMS-API
working-directory: "./devops/"
run: |
make oc-deploy-api
# Deploy Workers

# Deploy workers.
deploy-workers:
name: Deploy Workers
runs-on: ubuntu-latest
needs: run-db-migrations
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BRANCH: ${{ needs.createTag.outputs.newTag }}
echo HOST_PREFIX: $HOST_PREFIX

- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ needs.createTag.outputs.newTag }}

- name: Log in to OpenShift
run: |
oc login --token=${{ secrets.SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443

- name: Deploy Workers
working-directory: "./devops/"
run: |
make oc-deploy-workers
# Deploy Queue Consumers

# Deploy queue consumers.
deploy-queue-consumers:
name: Deploy Queue Consumers
runs-on: ubuntu-latest
needs: run-db-migrations
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BRANCH: ${{ needs.createTag.outputs.newTag }}
echo HOST_PREFIX: $HOST_PREFIX

- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ needs.createTag.outputs.newTag }}

- name: Log in to OpenShift
run: |
oc login --token=${{ secrets.SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443

- name: Deploy Queue Consumers
working-directory: "./devops/"
run: |
make oc-deploy-queue-consumers
# Deploy Deploy Web/Frontend

# Deploy Web/Frontend.
deploy-web-frontend:
name: Deploy Web/Frontend
runs-on: ubuntu-latest
needs: run-db-migrations
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BRANCH: ${{ needs.createTag.outputs.newTag }}
echo HOST_PREFIX: $HOST_PREFIX

- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ needs.createTag.outputs.newTag }}

- name: Log in to OpenShift
run: |
oc login --token=${{ secrets.SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443

- name: Deploy Web/Frontend
working-directory: "./devops/"
run: |
make oc-deploy-web

Loading