Skip to content

chore: upgrade metabase #182

chore: upgrade metabase

chore: upgrade metabase #182

Workflow file for this run

name: Pull Request Closed
on:
workflow_dispatch:
pull_request:
branches:
- main
types:
- closed
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
permissions:
contents: read
jobs:
# Clean up OpenShift when PR closed, no conditions
cleanup-openshift:
name: Cleanup OpenShift
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: Remove OpenShift artifacts
uses: bcgov/action-oc-runner@111868d1fc50db0a40417ba321d865ef5c931bbd # v1.7.0
with:
oc_namespace: ${{ vars.OC_NAMESPACE }}
oc_token: ${{ secrets.OC_TOKEN }}
oc_server: ${{ vars.OC_SERVER }}
commands: |
# Retry function with exponential backoff (up to 10 attempts)
retry_with_backoff() {
local max_attempts=10
local timeout=300 # 5 minutes per attempt
local attempt=1
local exit_code=0
while [ $attempt -le $max_attempts ]; do
echo "Cleanup attempt $attempt/$max_attempts"
# Remove old build runs, build pods and deployment pods
timeout $timeout helm uninstall nr-metabase-${{ github.event.number }}
exit_code=$?
if [ $exit_code -eq 0 ]; then
echo "Cleanup succeeded on attempt $attempt"
return 0
fi
# Check if error is "not found" (exit code 1, release not found)
# In that case, treat as success since cleanup is complete
if [ $exit_code -eq 1 ]; then
echo "Release not found (already cleaned up). Treating as success."
return 0
fi
if [ $attempt -lt $max_attempts ]; then
# Exponential backoff: 2^(attempt-1) seconds, max 60 seconds
local backoff=$((2 ** (attempt - 1)))
if [ $backoff -gt 60 ]; then
backoff=60
fi
echo "Cleanup failed (exit code: $exit_code). Retrying in ${backoff}s..."
sleep $backoff
else
echo "Cleanup failed after $max_attempts attempts"
return $exit_code
fi
((attempt++))
done
}
retry_with_backoff