Skip to content

Commit

Permalink
Override PTR server name
Browse files Browse the repository at this point in the history
  • Loading branch information
saliceti committed Oct 3, 2024
1 parent 125c052 commit 9cce3b6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/postgres-ptr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ on:
description: Restore point in time in UTC. e.g. 2024-07-24T06:00:00
type: string
required: true
new-db-server:
description: Name of the new database server. Default is <original-server-name>-ptr.
type: string

env:
SERVICE_SHORT: trs
Expand All @@ -45,14 +48,22 @@ jobs:
tf_vars_file=${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 "DB_SERVER=${AZURE_RESOURCE_PREFIX}-${SERVICE_SHORT}-${CONFIG_SHORT}-pg" >> $GITHUB_ENV
DB_SERVER="${AZURE_RESOURCE_PREFIX}-${SERVICE_SHORT}-${CONFIG_SHORT}-pg"
if [[ -n "${{ inputs.new-db-server }}" ]]; then
NEW_DB_SERVER="${{ inputs.new-db-server }}"
else
NEW_DB_SERVER="${DB_SERVER}-ptr"
fi
echo "DB_SERVER=${DB_SERVER}" >> $GITHUB_ENV
echo "NEW_DB_SERVER=${NEW_DB_SERVER}" >> $GITHUB_ENV
- name: Restore ${{ inputs.environment }} postgres
uses: DFE-Digital/github-actions/ptr-postgres@master
with:
resource-group: ${{ env.RESOURCE_GROUP_NAME }}
source-server: ${{ env.DB_SERVER }}
new-server: ${{ env.DB_SERVER }}-ptr
new-server: ${{ env.NEW_DB_SERVER }}
restore-time: ${{ inputs.restore-time }}
cluster: ${{ env.CLUSTER }}
azure-credentials: ${{ secrets.AZURE_CREDENTIALS}}
Expand Down

0 comments on commit 9cce3b6

Please sign in to comment.