Skip to content

Update Git sparse-checkout configuration #13

Update Git sparse-checkout configuration

Update Git sparse-checkout configuration #13

Workflow file for this run

name: 🔨 Deploy DB backups
concurrency:
group: ${{ github.workflow }}-github.ref }}
cancel-in-progress: false
on:
push:
branches:
- dev
#- test
#- prod
pull_request:
branches:
- dev
#- test
#- prod
jobs:
deploy:
name: '🔨 Deploy DB backups'
runs-on: ubuntu-latest
env:
OPENSHIFT_DEPLOY_PROJECT: e66ac2-dev
# Proxy settings for local development / testing
# https_proxy: http://198.161.14.25:8080
# no_proxy: ${{ env.OPENSHIFT_SERVER }}
steps:
- name: Install oc
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: 4.11.0
- name: 📤 Checkout Target Branch
uses: actions/checkout@v4
with:
sparse-checkout: |
config/backup
example.env
example.versions.env
- name: Setup Env Vars
id: dotenv
uses: falti/dotenv-action@v1
with:
path: example.env
export-variables: true
keys-case: upper
- name: Setup Versions Env Vars
id: dotenv_versions
uses: falti/dotenv-action@v1
with:
path: example.versions.env
export-variables: true
keys-case: upper
# Log in to OpenShift.
# Note: The secrets needed to log in are NOT available if the PR comes from a FORK.
# PR's must originate from a branch off the original repo or else all openshift `oc` commands will fail.
- name: 🔑 Log in to OpenShift ( ${{ github.ref_name }} )
if: success()
uses: redhat-actions/oc-login@v1
with:
insecure_skip_tls_verify: false
reveal_cluster_name: false
openshift_server_url: ${{ env.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.AUTH_TOKEN_DEV }}
namespace: ${{ env.OPENSHIFT_DEPLOY_PROJECT }}
- name: 🚀 Deploy Backup Container
uses: WyriHaximus/github-action-helm3@v3
with:
exec: |
helm repo add bcgov http://bcgov.github.io/helm-charts
helm repo update
if [[ `oc describe deployment moodle-backup-storage 2>&1` =~ "NotFound" ]]; then
echo "Backup container NOT FOUND. Begin backup container deployment..."
echo '
backupConfig: |
mariadb=db/moodle
0 1 * * * default ./backup.sh -s
0 4 * * * default ./backup.sh -s -v all
db:
secretName: moodle-secrets
usernameKey: database-user
passwordKey: database-password
env:
DATABASE_SERVICE_NAME:
value: db
ENVIRONMENT_FRIENDLY_NAME:
value: "DB Backups"
' > config.yaml
helm upgrade --install moodle -f config.yaml ${{ env.BACKUP_IMAGE }}
else
echo "Backup container installation FOUND. Updating..."
if [[ `helm upgrade --reuse-values moodle ${{ env.BACKUP_IMAGE }} 2>&1` =~ "Error" ]]; then
echo "Backup container update FAILED."
exit 1
fi
echo "Backup container updates completed."
fi