Skip to content

feat: oracle legacy database #36

feat: oracle legacy database

feat: oracle legacy database #36

Workflow file for this run

name: Pull Request Legacy
on:
pull_request:
workflow_dispatch:
concurrency:
# PR open and close use the same group, allowing only one at a time
group: ${{ github.event.number }}
cancel-in-progress: true
jobs:
vars:
name: Variables
runs-on: ubuntu-latest
outputs:
semver: ${{ steps.semver.outputs.tag }}
url: ${{ steps.calculate.outputs.url }}
steps:
# steps.semver.outputs.tag => needs.vars.outputs.semver
- uses: actions/checkout@v4
with:
ref: refs/heads/${{ github.event.repository.default_branch }}
- name: Conventional Changelog Update
uses: TriPSs/[email protected]
id: semver
with:
git-branch: refs/heads/${{ github.head_ref }}
git-push: 'false'
skip-commit: 'true'
skip-on-empty: 'false'
skip-version-file: 'true'
# steps.calculate.outputs.url => needs.vars.outputs.url
- name: Calculate the deployment number
id: calculate
run: |
echo "url=${{ github.event.repository.name }}-$((${{ github.event.number }} % 50))-frontend.apps.silver.devops.gov.bc.ca" >> $GITHUB_OUTPUT
- run: |
echo "semver=${{ steps.semver.outputs.tag }}"
echo "url=${{ steps.calculate.outputs.url }}"
builds:
name: Builds
runs-on: ubuntu-22.04
needs: [vars]
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- uses: bcgov-nr/[email protected]
name: Build (Legacy db)
with:
package: legacydb
tag: latest
tag_fallback: test
triggers: ('legacydb/')
build_args: |
APP_VERSION=${{ needs.vars.outputs.semver }}-${{ github.event.number }}
deploy:
name: Deploy Application
needs: [builds, vars]
environment: tools
env:
DOMAIN: apps.silver.devops.gov.bc.ca
PREFIX: ${{ needs.vars.outputs.url }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Initializing Deployment
uses: bcgov-nr/[email protected]
with:
file: legacydb/openshift.deploy.yml
oc_namespace: ${{ secrets.OC_NAMESPACE }}
oc_server: ${{ secrets.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
overwrite: false
parameters:
-p ZONE=tools
-p ORACLEDB_USER_W=${{ secrets.ORACLEDB_USERNAME_W }}
-p ORACLEDB_PASSWORD_W=${{ secrets.ORACLEDB_PASSWORD_W }}
-p PROMOTE=${{ github.repository }}/legacydb:latest
- name: Create the PR database
continue-on-error: true
run: |
oc login --token=${{ secrets.OC_TOKEN }} --server=${{ secrets.OC_SERVER }}
oc project ${{ secrets.OC_NAMESPACE }} # Safeguard!
# This creates a new pluggable database for the PR
oc exec $(oc get pods -l app=nr-forest-client-${{ secrets.OC_NAMESPACE }} -o jsonpath='{.items[0].metadata.name}') -- /opt/oracle/createDatabase PR_${{ github.event.number }}