Skip to content

Crunchy DB - PROD Crunchy DB in PROD using v1.12.0-3806 #54

Crunchy DB - PROD Crunchy DB in PROD using v1.12.0-3806

Crunchy DB - PROD Crunchy DB in PROD using v1.12.0-3806 #54

Workflow file for this run

name: Crunchy DB - Install/Upgrade
run-name: Crunchy DB - ${{ inputs.environment }} Crunchy DB in ${{ inputs.environment }} using ${{ github.ref_name }}
on:
workflow_dispatch:
inputs:
environment:
description: "Environment"
required: true
type: environment
action:
description: "Action"
required: true
type: choice
options:
- install
- upgrade
restore_enabled:
description: "Enable restore"
required: false
type: boolean
default: false
restore_target:
description: "Restore target date and time in 'YYYY-MM-DD HH:MM:SS' format "
required: false
type: string
default: ""
jobs:
manageCrunchyDB:
name: ${{ inputs.environment }} Crunchy DB in ${{ inputs.environment }}
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
env:
NAMESPACE: ${{ secrets.OPENSHIFT_ENV_NAMESPACE }}
steps:
- name: Checkout Target Branch
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Log in to OpenShift
run: |
oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }}
- name: Validate Date Time Format
if: ${{ inputs.action == 'upgrade' && inputs.restore_enabled}}
run: |
# Define the date-time format regex pattern
DATE_TIME_REGEX='^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$'
if ! echo "${{ inputs.restore_target }}" | grep -Pq "$DATE_TIME_REGEX"; then
echo "Error: RESTORE_TARGET must be in the format 'YYYY-MM-DD HH:MM:SS'."
exit 1
fi
- name: Display Restore Warning
if: ${{ inputs.action == 'upgrade' && inputs.restore_enabled }}
run: |
echo "Warning: Only the helm is updated. The restore is not run until kubectl commands are run as per the restore wiki documentation and approvals."
- name: Manage Crunchy DB
working-directory: "./devops/helm/crunchy-postgres/"
run: |
if [ "${{ inputs.action }}" == "install" ]; then
make install NAMESPACE=${{ secrets.OPENSHIFT_ENV_NAMESPACE }}
elif [ "${{ inputs.action }}" == "upgrade" ]; then
make upgrade NAMESPACE=${{ secrets.OPENSHIFT_ENV_NAMESPACE }} RESTORE_ENABLED=${{ inputs.restore_enabled }} RESTORE_TARGET="${{ inputs.restore_target }}"
fi