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

#1917 - Fix deployment #1994

Merged
merged 17 commits into from
Jun 6, 2023
Merged
9 changes: 5 additions & 4 deletions .github/workflows/env-setup-build-deploy-forms-server.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Env Setup - Build and Deploy Forms Server
run-name: Env Setup - Build and deploy forms server from ${{ inputs.gitRef }}(form.io tag ${{ inputs.formioTag }}) to ${{ inputs.environment }}

on:
workflow_dispatch:
Expand All @@ -21,12 +22,12 @@ jobs:
build_deploy:
name: Build and Deploy Formio Server.
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment }}
environment: ${{ inputs.environment }}
env:
FORMIO_SOURCE_REPO_TAG: ${{ github.event.inputs.formioTag }}
FORMIO_SOURCE_REPO_TAG: ${{ inputs.formioTag }}
FORMS_NAME: forms
NAMESPACE: ${{ secrets.OPENSHIFT_ENV_NAMESPACE }}
BUILD_REF: ${{ github.event.inputs.formioTag }}
BUILD_REF: ${{ inputs.formioTag }}
HOST_PREFIX: ${{ secrets.HOST_PREFIX }}
MONGODB_URI: ${{ secrets.MONGODB_URI }}
BUILD_NAMESPACE: 0c27fb-tools
Expand All @@ -41,7 +42,7 @@ jobs:
- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.gitRef }}
ref: ${{ inputs.gitRef }}
# 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.
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/env-setup-deploy-secrets.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Env Setup - Deploy SIMS Secrets to Openshift
run-name: Env Setup - Deploy SIMS secrets to Openshift from ${{ inputs.gitRef }} to ${{ inputs.environment }}

on:
workflow_dispatch:
Expand All @@ -16,7 +17,7 @@ jobs:
updateSecrets:
name: Deploy secrets to Openshift
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment }}
environment: ${{ inputs.environment }}
env:
NAMESPACE: ${{ secrets.OPENSHIFT_ENV_NAMESPACE }}
SECRET_NAME: ${{ secrets.OPENSHIFT_SIMS_CREDS_NAME }}
Expand Down Expand Up @@ -55,7 +56,7 @@ jobs:
- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.gitRef }}
ref: ${{ inputs.gitRef }}
- name: Log in to OpenShift
run: |
oc login --token=${{ secrets.SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443
Expand Down
23 changes: 12 additions & 11 deletions .github/workflows/release-build-all.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Release - Build All
run-name: Release - Build all from ${{ github.ref_name }}(build ${{ github.run_number }})

on:
pull_request:
Expand All @@ -10,7 +11,7 @@ on:
workflow_dispatch:

env:
BUILD_NAMESPACE: 0c27fb-tools
BUILD_NAMESPACE: ${{ vars.BUILD_NAMESPACE }}

jobs:
# Print variables for logging and debugging purposes.
Expand All @@ -23,8 +24,8 @@ jobs:
run: |
echo Git Base Ref: ${{ github.base_ref }}
echo Git Ref Name: ${{ github.ref_name }}
echo Git Pull Run Number: ${{ github.run_number }}
echo Git Pull Request Ref: ${{ github.event.pull_request.head.sha }}
echo Git Head: ${{ github.event.pull_request.head.sha }}
echo Run Number: ${{ github.run_number }}
echo OC CLI Version: $(oc version)

# Create new tag.
Expand Down Expand Up @@ -73,7 +74,7 @@ jobs:
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
oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One advantage of having those vars is that if the value changes it is only one place to be changed.

- name: Build db-migrations Image
working-directory: "./devops"
run: |
Expand All @@ -97,7 +98,7 @@ jobs:
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
oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }}
- name: Build SIMS-API Image
working-directory: "./devops"
run: |
Expand All @@ -121,7 +122,7 @@ jobs:
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
oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }}
- name: Build Workers Image
working-directory: "./devops"
run: |
Expand All @@ -145,7 +146,7 @@ jobs:
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
oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }}
- name: Build Queue Consumers Image
working-directory: "./devops"
run: |
Expand All @@ -169,7 +170,7 @@ jobs:
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
oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }}
- name: Build Web/Frontend Image
working-directory: "./devops"
run: |
Expand All @@ -178,7 +179,7 @@ jobs:
# Deploy all applications to DEV when there is a pull request on the main branch.
# If DEV is used to deploy a release or hotfix branch the automatic deploy can be stopped using the env variable because there
# is a Potential to main/relase/hotfix branches have differences (for instance the DB) that would not be backward compatible.
deployAll:
deployAlltoDEV:
if: github.event_name == 'pull_request' && vars.ALLOW_AUTOMATIC_MAIN_BRANCH_DEPLOY_TO_DEV == 'true' && github.ref_name == 'main'
name: Deploy All to DEV
needs:
Expand All @@ -194,6 +195,6 @@ jobs:
with:
environment: DEV
gitRef: ${{ needs.createTag.outputs.newTag }}
deployCamundaDefinitions: "true"
deployFormioDefinitions: "true"
deployCamundaDefinitions: true
deployFormioDefinitions: true
secrets: inherit
3 changes: 2 additions & 1 deletion .github/workflows/release-create-branch.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Release - Create Branch
run-name: Release - Create ${{ inputs.releaseType }} branch version ${{ inputs.versionName }}

on:
workflow_dispatch:
Expand Down Expand Up @@ -28,7 +29,7 @@ jobs:
- name: Create branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.gitRef }}
ref: ${{ inputs.gitRef }}
- run: |
git config user.name github-actions
git config user.email [email protected]
Expand Down
66 changes: 36 additions & 30 deletions .github/workflows/release-deploy-all.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Release - Deploy all
name: Release - Deploy All
run-name: Release - Deploy all from ${{ inputs.gitRef }} to ${{ inputs.environment }}

on:
workflow_dispatch:
Expand Down Expand Up @@ -29,10 +30,10 @@ on:
type: string
deployCamundaDefinitions:
required: true
type: string
type: boolean
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

deployFormioDefinitions:
required: true
type: string
type: boolean
secrets:
SA_TOKEN:
required: true
Expand Down Expand Up @@ -67,7 +68,7 @@ on:

env:
NAMESPACE: ${{ secrets.OPENSHIFT_ENV_NAMESPACE }}
BUILD_REF: ${{ github.event.inputs.gitRef }}
BUILD_REF: ${{ inputs.gitRef }}
HOST_PREFIX: ${{ secrets.HOST_PREFIX }}
BUILD_NAMESPACE: 0c27fb-tools
KEYCLOAK_REALM: "aestsims"
Expand All @@ -93,23 +94,24 @@ jobs:
# Run DB migrations.
run-db-migrations:
name: Run db-migrations
environment: ${{ github.event.inputs.environment }}
environment: ${{ inputs.environment }}
runs-on: ubuntu-latest
steps:
- name: Print env
run: |
echo Git Environment: ${{ inputs.environment }}
echo Git Red: ${{ inputs.gitRef }}
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BRANCH: ${{ github.event.inputs.gitRef }}
echo HOST_PREFIX: $HOST_PREFIX

- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.gitRef }}
ref: ${{ inputs.gitRef }}

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

- name: Run db-migrations
working-directory: "./devops/"
Expand All @@ -119,24 +121,25 @@ jobs:
# Deploy SIMS API.
deploy-sims-api:
name: Deploy SIMS-API
environment: ${{ github.event.inputs.environment }}
environment: ${{ inputs.environment }}
runs-on: ubuntu-latest
needs: run-db-migrations
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BRANCH: ${{ github.event.inputs.gitRef }}
echo BUILD ENVIRONMENT: ${{ inputs.environment }}
echo GIT REF: ${{ inputs.gitRef }}
echo HOST_PREFIX: $HOST_PREFIX

- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.gitRef }}
ref: ${{ inputs.gitRef }}

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

- name: Deploy SIMS-API
working-directory: "./devops/"
Expand All @@ -146,24 +149,25 @@ jobs:
# Deploy workers.
deploy-workers:
name: Deploy Workers
environment: ${{ github.event.inputs.environment }}
environment: ${{ inputs.environment }}
runs-on: ubuntu-latest
needs: run-db-migrations
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BRANCH: ${{ github.event.inputs.gitRef }}
echo BUILD ENVIRONMENT: ${{ inputs.environment }}
echo GIT REF: ${{ inputs.gitRef }}
echo HOST_PREFIX: $HOST_PREFIX

- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.gitRef }}
ref: ${{ inputs.gitRef }}

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

- name: Deploy Workers
working-directory: "./devops/"
Expand All @@ -173,24 +177,25 @@ jobs:
# Deploy queue consumers.
deploy-queue-consumers:
name: Deploy Queue Consumers
environment: ${{ github.event.inputs.environment }}
environment: ${{ inputs.environment }}
runs-on: ubuntu-latest
needs: run-db-migrations
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BRANCH: ${{ github.event.inputs.gitRef }}
echo BUILD ENVIRONMENT: ${{ inputs.environment }}
echo GIT REF: ${{ inputs.gitRef }}
echo HOST_PREFIX: $HOST_PREFIX

- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.gitRef }}
ref: ${{ inputs.gitRef }}

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

- name: Deploy Queue Consumers
working-directory: "./devops/"
Expand All @@ -200,24 +205,25 @@ jobs:
# Deploy Web/Frontend.
deploy-web-frontend:
name: Deploy Web/Frontend
environment: ${{ github.event.inputs.environment }}
environment: ${{ inputs.environment }}
runs-on: ubuntu-latest
needs: run-db-migrations
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BRANCH: ${{ github.event.inputs.gitRef }}
echo BUILD ENVIRONMENT: ${{ inputs.environment }}
echo GIT REF: ${{ inputs.gitRef }}
echo HOST_PREFIX: $HOST_PREFIX

- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.gitRef }}
ref: ${{ inputs.gitRef }}

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

- name: Deploy Web/Frontend
working-directory: "./devops/"
Expand All @@ -226,22 +232,22 @@ jobs:

# Deploy Camunda Definitions
deployCamundaDefinitions:
if: ${{ github.event.inputs.deployCamundaDefinitions == 'true' }}
if: ${{ inputs.deployCamundaDefinitions }}
name: Deploy BPMNs and DMNs to Camunda
needs: deploy-sims-api
uses: ./.github/workflows/release-deploy-camunda-definitions.yml
with:
environment: ${{ github.event.inputs.environment }}
gitRef: ${{ github.event.inputs.gitRef }}
environment: ${{ inputs.environment }}
gitRef: ${{ inputs.gitRef }}
secrets: inherit

# Deploy Formio Definitions
deployFormioDefinitions:
if: ${{ github.event.inputs.deployFormioDefinitions == 'true' }}
if: ${{ inputs.deployFormioDefinitions }}
name: Deploy Form.io definitions
needs: deploy-sims-api
uses: ./.github/workflows/release-deploy-formio-definitions.yml
with:
environment: ${{ github.event.inputs.environment }}
gitRef: ${{ github.event.inputs.gitRef }}
environment: ${{ inputs.environment }}
gitRef: ${{ inputs.gitRef }}
secrets: inherit
5 changes: 3 additions & 2 deletions .github/workflows/release-deploy-camunda-definitions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Release - Deploy Camunda Resources
run-name: Release - Deploy Camunda resources from ${{ inputs.gitRef }} to ${{ inputs.environment }}

on:
workflow_dispatch:
Expand Down Expand Up @@ -33,7 +34,7 @@ jobs:
deploy:
name: Deploy Camunda resources
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment }}
environment: ${{ inputs.environment }}
env:
ZEEBE_ADDRESS: ${{ secrets.ZEEBE_ADDRESS }}
ZEEBE_AUTHORIZATION_SERVER_URL: ${{ secrets.ZEEBE_AUTHORIZATION_SERVER_URL }}
Expand All @@ -47,7 +48,7 @@ jobs:
- name: Checkout Target Branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.gitRef }}
ref: ${{ inputs.gitRef }}
- name: Setup Nodejs
uses: actions/setup-node@v3
with:
Expand Down
Loading