generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d76492a
commit 5b9f621
Showing
3 changed files
with
106 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: .Deploys | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
### Required | ||
# Nothing! Only `secrets: inherit` is required | ||
|
||
### Typical / recommended | ||
environment: | ||
description: GitHub/OpenShift environment; usually PR number, test or prod | ||
type: string | ||
tag: | ||
description: Container tag; usually PR number | ||
default: ${{ github.event.number }} | ||
type: string | ||
target: | ||
description: Deployment target; usually PR number, test or prod | ||
default: ${{ github.event.number }} | ||
type: string | ||
triggers: | ||
description: Paths to check for changes | ||
type: string | ||
url: | ||
description: URL for deployment, does not include path | ||
type: string | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
init: | ||
name: Init | ||
environment: ${{ inputs.environment }} | ||
outputs: | ||
url: ${{ steps.url.outputs.url }} | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Create URL | ||
id: url | ||
run: | | ||
if [ -z "${{ inputs.url }}" ]; then | ||
echo "Creating URL" | ||
echo "url=fom-$(( ${{ inputs.target }} % 50 )).apps.silver.devops.gov.bc.ca" >> $GITHUB_OUTPUT | ||
else | ||
echo "Using URL parameter" | ||
echo "url=${{ inputs.url }}" >> $GITHUB_OUTPUT | ||
fi | ||
- name: OpenShift Init | ||
uses: bcgov-nr/[email protected] | ||
with: | ||
oc_namespace: ${{ vars.OC_NAMESPACE }} | ||
oc_server: ${{ vars.OC_SERVER }} | ||
oc_token: ${{ secrets.OC_TOKEN }} | ||
file: libs/openshift.init.yml | ||
overwrite: false | ||
parameters: -p ZONE=${{ inputs.target }} | ||
triggers: ${{ inputs.triggers }} | ||
|
||
deploy: | ||
name: Deploy | ||
needs: [init] | ||
runs-on: ubuntu-24.04 | ||
timeout-minutes: 10 | ||
strategy: | ||
matrix: | ||
name: [api, admin, db, public] | ||
include: | ||
- name: api | ||
overwrite: true | ||
parameters: | ||
-p [email protected] | ||
-p DB_TESTDATA=true | ||
-p AWS_USER_POOLS_WEB_CLIENT_ID="7hpo4qa7j0hs0rkfl2pm0sto5k" | ||
-p LOGOUT_CHAIN_URL="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=" | ||
- name: admin | ||
overwrite: true | ||
- name: db | ||
overwrite: false | ||
- name: public | ||
overwrite: true | ||
steps: | ||
- uses: bcgov-nr/[email protected] | ||
with: | ||
file: ${{ matrix.name }}/openshift.deploy.yml | ||
oc_namespace: ${{ vars.OC_NAMESPACE }} | ||
oc_server: ${{ vars.OC_SERVER }} | ||
oc_token: ${{ secrets.OC_TOKEN }} | ||
overwrite: ${{ matrix.overwrite }} | ||
parameters: | ||
-p ZONE=${{ inputs.target }} -p TAG=${{ inputs.tag }} | ||
-p URL=${{ needs.init.outputs.url }} -p REPLICA_COUNT=1 | ||
${{ matrix.parameters }} | ||
triggers: ${{ inputs.triggers }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,32 +10,8 @@ concurrency: | |
permissions: {} | ||
|
||
jobs: | ||
init: | ||
name: Init | ||
permissions: | ||
pull-requests: write | ||
runs-on: ubuntu-24.04 | ||
outputs: | ||
route_number: ${{ steps.calculate.outputs.route_number }} | ||
steps: | ||
- name: Calculate the deployment number | ||
id: calculate | ||
run: | | ||
echo "route_number=$((${{ github.event.number }} % 50))" >> $GITHUB_OUTPUT | ||
- name: OpenShift Init | ||
uses: bcgov-nr/[email protected] | ||
with: | ||
oc_namespace: ${{ vars.OC_NAMESPACE }} | ||
oc_server: ${{ vars.OC_SERVER }} | ||
oc_token: ${{ secrets.OC_TOKEN }} | ||
file: libs/openshift.init.yml | ||
overwrite: false | ||
parameters: -p ZONE=${{ github.event.number }} | ||
triggers: ('db/' 'libs/' 'api/' 'admin/' 'public/') | ||
|
||
builds: | ||
name: Builds | ||
build: | ||
name: Build | ||
runs-on: ubuntu-24.04 | ||
permissions: | ||
packages: write | ||
|
@@ -70,53 +46,17 @@ jobs: | |
token: ${{ secrets.GITHUB_TOKEN }} | ||
triggers: ${{ matrix.triggers }} | ||
|
||
deploys: | ||
name: Deploys | ||
needs: [builds, init] | ||
runs-on: ubuntu-24.04 | ||
timeout-minutes: 10 | ||
strategy: | ||
matrix: | ||
name: [api, admin, db, public] | ||
include: | ||
- name: api | ||
file: api/openshift.deploy.yml | ||
overwrite: true | ||
parameters: | ||
-p REPLICA_COUNT=1 | ||
-p [email protected] | ||
-p DB_TESTDATA=true | ||
-p AWS_USER_POOLS_WEB_CLIENT_ID="7hpo4qa7j0hs0rkfl2pm0sto5k" | ||
-p LOGOUT_CHAIN_URL="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=" | ||
- name: admin | ||
file: admin/openshift.deploy.yml | ||
overwrite: true | ||
parameters: -p REPLICA_COUNT=1 | ||
- name: db | ||
file: db/openshift.deploy.yml | ||
overwrite: false | ||
- name: public | ||
file: public/openshift.deploy.yml | ||
overwrite: true | ||
parameters: -p REPLICA_COUNT=1 | ||
steps: | ||
- uses: bcgov-nr/[email protected] | ||
with: | ||
file: ${{ matrix.file }} | ||
oc_namespace: ${{ vars.OC_NAMESPACE }} | ||
oc_server: ${{ vars.OC_SERVER }} | ||
oc_token: ${{ secrets.OC_TOKEN }} | ||
overwrite: ${{ matrix.overwrite }} | ||
penetration_test: false | ||
parameters: | ||
-p URL=fom-${{ needs.init.outputs.route_number }}.apps.silver.devops.gov.bc.ca | ||
-p ZONE=${{ github.event.number }} -p TAG=${{ github.event.number }} | ||
${{ matrix.parameters }} | ||
triggers: ('db/' 'libs/' 'api/' 'admin/' 'public/') | ||
deploy: | ||
name: Deploy (${{ github.event.number }}) | ||
needs: [build] | ||
secrets: inherit | ||
uses: ./.github/workflows/.deploy.yml | ||
with: | ||
triggers: ('db/' 'libs/' 'api/' 'admin/' 'public/') | ||
|
||
results: | ||
name: PR Results | ||
needs: [builds, deploys] | ||
needs: [build, deploy] | ||
if: always() | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters