From 8015c9b96ae593c910e4549f6b52deac9d1a6cf9 Mon Sep 17 00:00:00 2001 From: Neill Turner Date: Thu, 5 Dec 2024 10:48:33 +0000 Subject: [PATCH] test confirm production option --- .github/workflows/test-confirm.yml | 59 ++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/test-confirm.yml diff --git a/.github/workflows/test-confirm.yml b/.github/workflows/test-confirm.yml new file mode 100644 index 000000000..68b7246d1 --- /dev/null +++ b/.github/workflows/test-confirm.yml @@ -0,0 +1,59 @@ +name: Test Confirm + +on: + workflow_dispatch: + inputs: + environment: + description: Environment to restore + required: true + default: test + type: choice + options: + - test + - preprod + confirm-test: + description: Must be set to true if restoring test + required: true + default: "false" + type: choice + options: + - "false" + - "true" + backup-file: + description: Name of the backup file in Azure storage. e.g. aytq_prod_2024-08-09.sql.gz. The default value is today's scheduled backup. + type: string + required: false + +env: + SERVICE_NAME: refer-serious-misconduct + SERVICE_SHORT: rsm + TF_VARS_PATH: terraform/application/config + +jobs: + test: + name: Test AKS + runs-on: ubuntu-latest + environment: aks-${{ inputs.environment }} + concurrency: deploy_${{ inputs.environment }} + + steps: + - uses: actions/checkout@v4 + name: Checkout + + - name: Set environment variables + if: ${{ inputs.environment != 'test' || (inputs.environment == 'test' && inputs.confirm-test == 'true' ) }} + run: | + source global_config/${{ inputs.environment }}.sh + tf_vars_file=${{ env.TF_VARS_PATH }}/${{ inputs.environment }}.tfvars.json + echo "CLUSTER=$(jq -r '.cluster' ${tf_vars_file})" >> $GITHUB_ENV + echo "RESOURCE_GROUP_NAME=${AZURE_RESOURCE_PREFIX}-${SERVICE_SHORT}-${CONFIG_SHORT}-rg" >> $GITHUB_ENV + echo "STORAGE_ACCOUNT_NAME=${AZURE_RESOURCE_PREFIX}${SERVICE_SHORT}dbbkp${CONFIG_SHORT}sa" >> $GITHUB_ENV + echo "DB_SERVER=${AZURE_RESOURCE_PREFIX}-${SERVICE_SHORT}-${CONFIG_SHORT}-pg" >> $GITHUB_ENV + TODAY=$(date +"%F") + echo "BACKUP_FILE=${SERVICE_SHORT}_${CONFIG_SHORT}_${TODAY}.sql" >> $GITHUB_ENV + if [ "${{ inputs.backup-file }}" != "" ]; then + BACKUP_FILE=${{ inputs.backup-file }} + else + BACKUP_FILE=${SERVICE_SHORT}_${CONFIG_SHORT}_${TODAY}.sql.gz + fi + echo "BACKUP_FILE=$BACKUP_FILE" >> $GITHUB_ENV