Oracle: Schedule Validate Backups #218
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Oracle: Schedule Validate Backups" | |
on: | |
schedule: | |
- cron: '20 14 * * WED' | |
- cron: '20 15 * * WED' | |
- cron: '20 16 * * WED' | |
jobs: | |
prepare-run-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
scheduled_matrix: ${{ steps.filter-validate-schedule.outputs.scheduling_matrix }} | |
steps: | |
- name: Checkout Validate Backups Schedule | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout-cone-mode: false | |
sparse-checkout: | | |
.github/workflows/oracle-db-validate-backups-schedule.json | |
path: operations | |
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.SourceCodeVersion || 'main' }} | |
fetch-depth: 0 | |
- name: Filter Validate Schedule | |
id: filter-validate-schedule | |
run: | | |
SCHEDULED_JSON=$(jq '[.[] | select (.CronSchedule=="${{ github.event.schedule }}") | {"TargetEnvironment","TargetHost"}]' operations/.github/workflows/oracle-db-validate-backups-schedule.json | jq '{include: .}') | |
echo "scheduling_matrix="$(echo ${SCHEDULED_JSON} | sed 's/ //g') >> $GITHUB_OUTPUT | |
report-schedule-validate-backup: | |
needs: prepare-run-matrix | |
runs-on: ubuntu-latest | |
if: ${{ needs.prepare-run-matrix.outputs.scheduled_matrix != '{"include":[]}' }} | |
steps: | |
- name: Report Validations Scheduled to Run | |
id: report-run | |
run: | | |
echo "Running Validation of Backups for these targets: ${{ needs.prepare-run-matrix.outputs.scheduled_matrix }}" | |
report-no-scheduled-validate-backup: | |
needs: prepare-run-matrix | |
runs-on: ubuntu-latest | |
if: ${{ needs.prepare-run-matrix.outputs.scheduled_matrix == '{"include":[]}' }} | |
steps: | |
- name: Report Nothing to Do | |
id: report-no-run | |
run: | | |
echo "No targets scheduled for validation run." | |
validate-backup: | |
needs: prepare-run-matrix | |
if: ${{ needs.prepare-run-matrix.outputs.scheduled_matrix != '{"include":[]}' }} | |
strategy: | |
matrix: ${{fromJson(needs.prepare-run-matrix.outputs.scheduled_matrix)}} | |
name: Validate Backup | |
uses: | |
ministryofjustice/hmpps-delius-operational-automation/.github/workflows/oracle-db-validate-backups.yml@main | |
with: | |
TargetEnvironment: ${{ matrix.TargetEnvironment }} | |
TargetHost: ${{ matrix.TargetHost }} |