Skip to content

port over metabase from architecture repo to here and add helm charts #11

port over metabase from architecture repo to here and add helm charts

port over metabase from architecture repo to here and add helm charts #11

Workflow file for this run

name: Build and Deploy of Job on Pull Request to Main
on:
pull_request:
branches:
- main
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:
extract_version:
name: Extract Version
if: '!github.event.pull_request.head.repo.fork'
runs-on: ubuntu-22.04
outputs:
app_version: ${{ steps.read_yaml.outputs.app_version }}
available: ${{ steps.read_yaml.outputs.available }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract Version
id: read_yaml
shell: bash
run: |
appVersion=$(yq '.appVersion' charts/nr-metabase/Chart.yaml)
echo "app version is $appVersion"
echo "app_version=$appVersion" >> "$GITHUB_OUTPUT"
if [ "$appVersion" != '' ]; then
echo "available=false" >> $GITHUB_OUTPUT;
else
echo "available=true" >> $GITHUB_OUTPUT;
fi
- name: Get App Version
run: echo "${{ steps.read_yaml.outputs.appVersion }}"
builds:
name: Builds
needs: extract_version
if: '!github.event.pull_request.head.repo.fork && ${{ needs.extract_version.outputs.available == true }}'
runs-on: ubuntu-22.04
permissions:
packages: write
steps:
- uses: bcgov-nr/[email protected]
with:
package: nr-metabase
tag: ${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
build_context: .
build_args: |
METABASE_VERSION=${{ needs.extract_version.outputs.app_version }}
- uses: shrink/actions-docker-registry-tag@v3
with:
registry: ghcr.io
repository: ${{ github.repository }}/nr-metabase
target: ${{ github.sha }}
tags: |
pr-${{ github.event.number }}
${{ needs.extract_version.outputs.app_version }}
deploys:
name: Deploys
needs:
- builds
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Deploy to OpenShift
shell: bash
run: |
# Allow pipefail, since we could be catching oc create errors
set +o pipefail
# Login to OpenShift (NOTE: project command is a safeguard)
oc login --token=${{ secrets.oc_token }} --server=${{ vars.oc_server }}
oc project ${{ vars.oc_namespace }}
# Deploy Helm Chart
helm upgrade --install --wait --atomic nr-metabase-${{ github.event.number }} --set-string global.databasePassword=${{ secrets.db_password}} --set global.zone="${{ github.event.number }}" --set metabase.image.tag=${{ github.sha }} --set namespace=${{ vars.oc_namespace }} --timeout 10m charts/nr-metabase --debug