Skip to content

openshift deploy

openshift deploy #38

name: openshift deploy
on:
workflow_dispatch:
inputs:
MICROSERVICE_NAME:
required: true
type: choice
options:
- cirras-underwriting-api
- cirras-underwriting-ui
- cirras-underwriting-jasper
- cirras-underwriting-liquibase
ENVIRONMENT_NAME:
required: true
type: choice
options:
- dev
- qa
- int
- dlvr
- test
- prod
NAMESPACE:
required: true
type: choice
options:
- a12541-dev
- a12541-test
- a12541-prod
TAG:
required: false
type: string
default: latest
workflow_call:
inputs:
MICROSERVICE_NAME:
required: true
type: string
ENVIRONMENT_NAME:
required: true
type: string
NAMESPACE:
required: true
type: string
TAG:
required: false
type: string
default: latest
jobs:
build:
runs-on: ubuntu-latest
environment:
name: ${{ inputs.ENVIRONMENT_NAME }}
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Copy openshift yaml files
run: mkdir staging && cp openshift/${{ inputs.MICROSERVICE_NAME }}*.yaml staging/
- name: Fill yaml files
uses: cschleiden/[email protected]
with:
files: staging/**.yaml
env:
#Common variables
ENV: ${{ inputs.ENVIRONMENT_NAME }}
NAMESPACE: ${{ inputs.NAMESPACE }}
TAG: ${{ inputs.TAG }}
WEBADE_CHECK_TOKEN_URL: ${{ vars.WEBADE_CHECK_TOKEN_URL }}
WEBADE_GET_TOKEN_URL: ${{ vars.WEBADE_GET_TOKEN_URL }}
POSTGRES_USERNAME: ${{ vars.POSTGRES_PROXY_USER_USERNAME}}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
#API variables
POSTGRES_RESOURCE_NAME: ${{ vars.POSTGRES_RESOURCE_NAME }}
MAX_THREADS: ${{ vars.MAX_THREADS }}
TARGET_PORT: ${{ vars.TARGET_PORT }}
TIME_ZONE: ${{ vars.TIME_ZONE }}
CIRRAS_POLICIES_API_URL: ${{ vars.CIRRAS_POLICIES_API_URL}}
CIRRAS_UNDERWRITING_REST_CLIENT_ID: ${{ vars.CIRRAS_UNDERWRITING_REST_CLIENT_ID }}
CIRRAS_UNDERWRITING_REST_SECRET: ${{ secrets.CIRRAS_UNDERWRITING_REST_SECRET }}
JASPER_URL: cirras-underwriting-jasper-${{ vars.LICENSE_PLATE }}-${{inputs.ENVIRONMENT_NAME}}.apps.silver.devops.gov.bc.ca
JASPER_USERNAME: ${{ vars.JASPER_USERNAME }}
JASPER_PASSWORD: ${{ secrets.JASPER_PASSWORD }}
WEBADE_USERNAME: ${{ vars.WEBADE_USERNAME }}
WEBADE_PASSWORD: ${{ secrets.WEBADE_PASSWORD }}
WEBADE_MAXACTIVE: ${{ vars.WEBADE_MAXACTIVE }}
#DB/Liquibase variables:
POSTGRES_READ_ONLY_PASSWORD: ${{ secrets.POSTGRES_READONLY_PASSWORD }}
POSTGRES_PROXY_USER_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_ADMIN_USERNAME: ${{ secrets.POSTGRES_ADMIN_USERNAME }}
POSTGRES_ADMIN_PASSWORD: ${{ secrets.POSTGRES_ADMIN_PASSWORD }}
POSTGRES_MAXACTIVE: '10'
CHANGELOG_FILE: changelog.json
#Frontend variables
BASE_URL: https://cirras-underwriting-ui-route-${{ inputs.ENVIRONMENT_NAME }}-${{inputs.NAMESPACE}}.apps.silver.devops.gov.bc.ca/pub/cirras-underwriting/
CIRRAS_UNDERWRITING_REST_URI: https://cirras-underwriting-api-${{ inputs.ENVIRONMENT_NAME }}-${{inputs.NAMESPACE}}.apps.silver.devops.gov.bc.ca/cirras-underwriting-api/v1
WEBADE_CIRRAS_UNDERWRITING_UI_SECRET: ${{secrets.WEBADE_CIRRAS_UNDERWRITING_UI_SECRET}}
ACTIVE_PORT: ${{ vars.TARGET_PORT }}
LOCAL_CHECKTOKEN_ENDPOINT: ${{ vars.LOCAL_CHECKTOKEN_ENDPOINT }}
WEBADE_OAUTH2_ENABLE_CHECKTOKEN: 'true'
WEBADE_OAUTH2_AUTHORIZE_URL: ${{ vars.WEBADE_OAUTH2_AUTHORIZE_URL }}
WEBADE_OAUTH2_SITEMINDER_URL: ${{ vars.WEBADE_OAUTH2_SITEMINDER_URL }}
WEBADE_OAUTH2_SCOPES: ${{ vars.WEBADE_OAUTH2_SCOPES }}
WEB_PATH: ${{ vars.WEB_PATH }}
- name: Authenticate and set context
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{secrets.OPENSHIFT_SERVER_URL}}
openshift_token: ${{secrets.OPENSHIFT_TOKEN}}
namespace: ${{ inputs.NAMESPACE }}
- name: Apply .yaml files to openshift
run: |
for file in staging/*
do
oc apply -f "$file"
done