ci: pr-validate job #1442
Workflow file for this run
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
name: PR | |
on: | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
concurrency: | |
# PR open and close use the same group, allowing only one at a time | |
group: pr-${{ github.workflow }}-${{ github.event.number }} | |
cancel-in-progress: true | |
jobs: | |
init: | |
name: Initialize | |
if: "!github.event.pull_request.head.repo.fork" | |
outputs: | |
route: ${{ steps.route.outputs.route }} | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Get FAM Route | |
id: route | |
run: | | |
echo "route=$(( ${{ 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: common/openshift.init.yml | |
overwrite: true | |
parameters: | |
-p ZONE=${{ github.event.number }} | |
-p AWS_KINESIS_STREAM='${{ secrets.AWS_KINESIS_STREAM }}' | |
-p AWS_KINESIS_ROLE_ARN='${{ secrets.AWS_KINESIS_ROLE_ARN }}' | |
-p AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} | |
-p AWS_ACCESS_KEY_SECRET='${{ secrets.AWS_ACCESS_KEY_SECRET }}' | |
-p ORACLE_DB_USER=${{ secrets.DB_USER }} | |
-p ORACLE_DB_PASSWORD='${{ secrets.ORACLE_DB_PASSWORD }}' | |
-p ORACLE_DB_HOST='${{ secrets.ORACLE_DB_HOST }}' | |
-p ORACLE_DB_SERVICE='${{ secrets.ORACLE_DB_SERVICE }}' | |
-p POSTGRES_DB_PASSWORD='${{ secrets.POSTGRES_DB_PASSWORD }}' | |
-p FORESTCLIENTAPI_KEY='${{ secrets.FORESTCLIENTAPI_KEY }}' | |
-p VITE_USER_POOLS_WEB_CLIENT_ID=${{ vars.VITE_USER_POOLS_WEB_CLIENT_ID }} | |
-p VITE_USER_POOLS_ID=${{ vars.VITE_USER_POOLS_ID }} | |
triggers: ('common/' 'backend/' 'frontend/') | |
builds: | |
name: Builds | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
strategy: | |
matrix: | |
name: [database, backend, frontend] | |
include: | |
- package: database | |
triggers: ('database/') | |
- name: backend | |
triggers: ('backend/') | |
- name: frontend | |
triggers: ('frontend/') | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: bcgov-nr/[email protected] | |
with: | |
package: ${{ matrix.name }} | |
tag: ${{ github.event.number }} | |
tag_fallback: test | |
token: ${{ secrets.GITHUB_TOKEN }} | |
triggers: ${{ matrix.triggers }} | |
deploys: | |
name: Deploys | |
needs: [builds, init] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
name: [database, backend, frontend, fluentbit] | |
include: | |
- name: database | |
file: database/openshift.deploy.yml | |
parameters: | |
-p DB_PVC_SIZE=128Mi | |
- name: backend | |
file: backend/openshift.deploy.yml | |
timeout: 15m | |
verification_path: /actuator/health | |
parameters: | |
-p MAX_REPLICAS=1 | |
-p MIN_REPLICAS=1 | |
-p DB_POOL_MAX_SIZE=1 | |
-p AWS_COGNITO_ISSUER_URI=https://cognito-idp.${{ vars.AWS_REGION }}.amazonaws.com/${{ vars.VITE_USER_POOLS_ID }} | |
-p DASHBOARD_JOB_IDIR_USERS=${{ vars.DASHBOARD_JOB_IDIR_USERS }} | |
-p WMS_LAYERS_WHITELIST_USERS=${{ vars.WMS_LAYERS_WHITELIST_USERS }} | |
-p ALLOWED_ORIGINS=https://${{ github.event.repository.name }}-${{ needs.init.outputs.route }}-frontend.apps.silver.devops.gov.bc.ca | |
- name: frontend | |
file: frontend/openshift.deploy.yml | |
parameters: | |
-p MIN_REPLICAS=1 | |
-p MAX_REPLICAS=1 | |
-p FAM_ROUTE="$(( ${{ github.event.number }} % 50 ))" | |
- name: fluentbit | |
file: common/openshift.fluentbit.yml | |
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: true | |
parameters: | |
-p ZONE=${{ github.event.number }} -p TAG=${{ github.event.number }} | |
${{ matrix.parameters }} | |
timeout: ${{ matrix.timeout }} | |
triggers: ('common/' 'backend/' 'frontend/') | |
verification_path: ${{ matrix.verification_path }} | |
verification_retry_attempts: 5 | |
verification_retry_seconds: 15 |