Skip to content

Oracle: delius_core_development_dev_delius_primarydb_database_backup #3

Oracle: delius_core_development_dev_delius_primarydb_database_backup

Oracle: delius_core_development_dev_delius_primarydb_database_backup #3

name: "Oracle: Backup"
run-name: "Oracle: ${{ (github.event_name == 'workflow_dispatch' && format('{0}_{1}_{2}', github.event.inputs.TargetEnvironment, github.event.inputs.Period, github.event.inputs.TargetHost) || (github.event_name == 'schedule' && format('{0}_{1}_{2}',inputs.TargetEnvironment, inputs.Period, inputs.TargetHost) || 'delius_core_development_dev_delius_primarydb'))}}_database_backup"
on:
workflow_dispatch:
inputs:
TargetEnvironment:
description: "Target environment"
required: true
type: choice
options:
- "delius_core_development_dev"
- "delius_core_development_mis_dev"
TargetHost:
description: "Backup target host"
required: true
type: choice
options:
- "delius_primarydb"
- "mis_primarydb"
- "misboe_primarydb"
- "misdsd_primarydb"
- "delius_standbydb1"
- "mis_standbydb1"
- "misboe_standbydb1"
- "misdsd_standbydb1"
- "delius_standbydb2"
TargetHostList:
description: "INTERNAL USE ONLY"
type: string
default: "delius_primarydb, mis_primarydb, misboe_primarydb, misdsd_primarydb, delius_standbydb1, mis_standbydb1,misboe_standbydb1,misdsd_standbydb1,delius_standbydb2"
Period:
description: "Is this a daily or weekly backup?"
required: true
type: choice
options:
- "daily"
- "weekly"
FixAbsentChunks:
description: "Validate and fix absent S3 missing backup chunks"
type: choice
default: "yes"
options:
- "yes"
- "no"
DeleteDefunct:
description: "Delete backups for DBIDs no longer in use"
type: choice
default: "no"
options:
- "yes"
- "no"
EnableTrace:
description: "Enable RMAN trace for debugging"
required: false
type: choice
default: "no"
options:
- "yes"
- "no"
VerboseOutput:
description: "Verbose Output level"
type: choice
options:
- ""
- "-v"
- "-vv"
- "-vvv"
- "-vvvv"
SourceCodeVersion:
description: "Source version for the hmpps-delius-operation-automation. Enter a pull request, branch, commit ID, tag, or reference."
type: string
default: "main"
SourceConfigVersion:
description: "Source version for the modernisation-platform-configuration-management. Enter a pull request, branch, commit ID, tag, or reference."
type: string
default: "main"
workflow_call:
inputs:
TargetEnvironment:
description: "Target environment"
required: true
type: string
TargetHost:
description: "Backup target host"
required: true
type: string
Period:
description: "Is this a daily or weekly backup?"
required: true
type: string
DeleteDefunct:
description: "Delete backups for DBIDs no longer in use"
required: false
type: string
default: "no"
push:
branches:
- DBA-531-BACKUP
paths:
- .github/workflows/oracle-db-backup.yml
- playbooks/**
# Allow permissions on repository and docker image respectively
permissions:
contents: read
packages: read
jobs:
# Start deployment container job based on the build delius-ansible-aws image
deployment:
name: "oracle-backup"
environment: delius-core-dev
runs-on: ubuntu-latest
container:
image: ghcr.io/ministryofjustice/hmpps-delius-operational-automation:0.1
timeout-minutes: 1440
env:
backup_command: ansible-playbook operations/playbooks/oracle_backup/backup.yml
validate_command: ansible-playbook operations/playbooks/oracle_backup/validate.yml
delete_dbids_command: ansible-playbook operations/playbooks/oracle_backup/delete_dbids_not_in_use.yml
inventory: inventory/ansible
TargetEnvironment: "${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.TargetEnvironment || (github.event_name == 'schedule' && inputs.TargetEnvironment || (github.event_name == 'push' && 'delius_core_development_dev'))) }}"
TargetHost: "${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.TargetHost || (github.event_name == 'schedule' && inputs.TargetHost || (github.event_name == 'push' && 'delius_primarydb'))) }}"
Period: "${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.Period || (github.event_name == 'schedule' && inputs.Period || (github.event_name == 'push' && 'daily'))) }}"
FixAbsentChunks: "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.FixAbsentChunks || 'yes' }}"
DeleteDefunct: "${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.DeleteDefunct || (github.event_name == 'schedule' && inputs.DeleteDefunct || 'no')) }}"
EnableTrace: "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.EnableTrace || 'no' }}"
VerboseOutput: "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.VerboseOutput || '' }}"
RmanTarget: "environment_name_${{ env.TargetEnvironment }}_${{ env.TargetHost }}"

Check failure on line 131 in .github/workflows/oracle-db-backup.yml

View workflow run for this annotation

GitHub Actions / Oracle: Backup

Invalid workflow file

The workflow is not valid. .github/workflows/oracle-db-backup.yml (Line: 131, Col: 19): Unrecognized named-value: 'env'. Located at position 1 within expression: env.TargetEnvironment
continue-on-error: false
steps:
- name: Checkout hmpps-delius-operation-automation
uses: actions/checkout@v4
with:
sparse-checkout-cone-mode: false
sparse-checkout: |
playbooks/oracle_backup
path: operations
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.SourceCodeVersion || 'main' }}
fetch-depth: 0
- name: Checkout modernisation-platform-configuration-management
uses: actions/checkout@v4
with:
repository: ministryofjustice/modernisation-platform-configuration-management
sparse-checkout-cone-mode: false
sparse-checkout: |
ansible/hosts
ansible/group_vars
path: inventory
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.SourceConfigVersion || 'main' }}
fetch-depth: 0
- name: Configure AWS Credentials
id: login-aws
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.CICD_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.CICD_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Start Ansible Backup
run: $backup_command -i $inventory -e rman_target=$RmanTarget -e daily_weekly=$Period -e enable_trace=$EnableTrace $VerboseOutput
- name: Start Ansible Validate And Fix Absent Chunks
run: $validate_command -i $inventory -e rman_target=$RmanTarget -e fix_absent_chunks=$FixAbsentChunks $VerboseOutput
- name: Start Ansible Delete DBIDs Not In Use
if: ${{ env.DeleteDefunct == 'yes' }}
run: $delete_dbids_command -i $inventory -e rman_target=$RmanTarget $VerboseOutput