Build & Deploy Spring Boot EL API to OpenShift #13
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: Build & Deploy Spring Boot EL API to OpenShift | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: 'Environment to deploy to OpenShift' | |
required: true | |
default: 'dev' | |
type: choice | |
options: | |
- dev | |
- prod | |
jobs: | |
build: | |
name: Build Spring Boot Oracle EL Containers | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
package: ['backend-el'] | |
include: | |
- package: 'backend-el' | |
build_file: ./backend-el/Dockerfile | |
build_context: ./backend-el | |
timeout-minutes: 10 | |
steps: | |
- uses: bcgov/[email protected] | |
with: | |
package: ${{ matrix.package }} | |
tag: ${{ github.sha }} | |
build_file: ${{ matrix.build_file }} | |
build_context: ${{ matrix.build_context }} | |
deploy: | |
name: Deploy Helm Chart to OpenShift ${{ github.event.inputs.environment }} | |
needs: build | |
environment: openshift-${{ github.event.inputs.environment }} | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Helm Deploy | |
id: deploy | |
uses: bcgov/[email protected] | |
env: | |
DB_PASSWORD: ${{ secrets.dbPassword }} # handle special characters. | |
with: | |
oc_namespace: ${{ secrets.oc_namespace }} | |
oc_token: ${{ secrets.oc_token }} | |
oc_server: ${{ vars.oc_server }} | |
commands: | | |
# Deploy | |
cd charts/backend-el | |
helm package -u . --app-version="${{ github.sha }}" --version=1.0.0 | |
# Helm upgrade/rollout, the db secrets are related to ORACLE DB, the cert secret can be a random one. | |
helm upgrade \ | |
--set-string image.tag="${{ github.sha }}" \ | |
--set-string secrets.dbHost="${{ secrets.dbHost }}" \ | |
--set-string secrets.certSecret="${{ secrets.certSecret }}" \ | |
--set-string secrets.dbName="${{ secrets.dbName }}" \ | |
--set-string secrets.dbPassword="$DB_PASSWORD" \ | |
--set-string secrets.dbUser="${{ secrets.dbUser }}" \ | |
--install --wait \ | |
--values values.yaml backend-el\ | |
./backend-el-1.0.0.tgz |