Skip to content

StandbyCheck - Build and Deploy Standbycheck to the Selected Environment #10

StandbyCheck - Build and Deploy Standbycheck to the Selected Environment

StandbyCheck - Build and Deploy Standbycheck to the Selected Environment #10

Workflow file for this run

# This workflow is to update the GSLB Monitoring Pods using Github actions.
name: StandbyCheck - Build and Deploy Standbycheck to the Selected Environment
on:
workflow_dispatch:
inputs:
environment:
type: environment
env:
REGISTRY: ghcr.io
STANDBY_IMAGE_NAME: ${{ github.repository }}-standbycheck
jobs:
build-and-push-standbycheck:
runs-on: ubuntu-latest
name: Build & Push standbycheck Image
environment: dev
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Log in to the Container registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.STANDBY_IMAGE_NAME }}
tags: |
type=raw,value=latest
type=sha,format=long
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v7
with:
context: ./compose/standbycheck/
file: ./compose/standbycheck/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args:
DEBUG_BUILD=false
update-openshift-gold:
needs: build-and-push-standbycheck
runs-on: ubuntu-latest
name: Deploy Latest Helm Chart to ${{ github.event.inputs.environment }} in Gold
environment:
name: ${{ github.event.inputs.environment }}
url: https://${{ github.event.inputs.environment }}-drivebc.apps.gold.devops.gov.bc.ca/lbhealth/
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install CLI tools from OpenShift Mirror
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: "4"
- name: Authenticate and set context for Gold
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ vars.OPENSHIFT_GOLD_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_GOLD_TOKEN }}
namespace: ${{ vars.OPENSHIFT_NAMESPACE }}
insecure_skip_tls_verify: true
- name: Helm upgrade on OpenShift ${{ github.event.inputs.environment }} Environment
run: |
helm upgrade ${{ github.event.inputs.environment }}-drivebc-standbycheck -f ./infrastructure/standbycheck/values-${{ github.event.inputs.environment }}.yaml ./infrastructure/standbycheck --set image.tag="sha-${{ github.sha }}"
update-openshift-golddr:
needs: build-and-push-standbycheck
runs-on: ubuntu-latest
name: Deploy Latest Helm Chart to ${{ github.event.inputs.environment }} in GoldDR
environment:
name: ${{ github.event.inputs.environment }}
url: https://${{ github.event.inputs.environment }}-drivebc.apps.golddr.devops.gov.bc.ca/lbhealth/
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install CLI tools from OpenShift Mirror
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: "4"
- name: Authenticate and set context for GoldDR
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ vars.OPENSHIFT_GOLDDR_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_GOLDDR_TOKEN }}
namespace: ${{ vars.OPENSHIFT_NAMESPACE }}
insecure_skip_tls_verify: true
- name: Helm upgrade on OpenShift ${{ github.event.inputs.environment }} Environment
run: |
helm upgrade ${{ github.event.inputs.environment }}-drivebc-standbycheck -f ./infrastructure/standbycheck/values-${{ github.event.inputs.environment }}.yaml -f ./infrastructure/standbycheck/values-${{ github.event.inputs.environment }}-dr.yaml ./infrastructure/standbycheck --set image.tag="sha-${{ github.sha }}"