Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preproduction database restore #2482

Closed
wants to merge 15 commits into from
3 changes: 2 additions & 1 deletion .github/workflows/database-ptr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
type: choice
options:
- test
- preprod
- production
confirm-production:
description: Must be set to true if restoring production
Expand Down Expand Up @@ -45,7 +46,7 @@ jobs:
- name: Set environment variables
run: |
source global_config/${{ inputs.environment }}.sh
tf_vars_file=${{ env.TF_VARS_PATH }}/${{ inputs.environment }}/variables.tfvars.json
tf_vars_file=${{ env.TF_VARS_PATH }}/${{ env.ENVIRONMENT }}/variables.tfvars.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${{ env.ENVIRONMENT }} is not set at this point
But $ENVIRONMENT should work

echo "CLUSTER=$(jq -r '.cluster' ${tf_vars_file})" >> $GITHUB_ENV
echo "RESOURCE_GROUP_NAME=${AZURE_RESOURCE_PREFIX}-${SERVICE_SHORT}-${CONFIG_SHORT}-rg" >> $GITHUB_ENV

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/database-restore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
options:
- development
- test
- preprod
- production
confirm-production:
description: Must be set to true if restoring production
Expand Down Expand Up @@ -45,7 +46,7 @@ jobs:
- name: Set environment variables
run: |
source global_config/${{ inputs.environment }}.sh
tf_vars_file=${{ env.TF_VARS_PATH }}/${{ inputs.environment }}/variables.tfvars.json
tf_vars_file=${{ env.TF_VARS_PATH }}/${{ env.ENVIRONMENT }}/variables.tfvars.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${{ env.ENVIRONMENT }} is not set at this point
But $ENVIRONMENT should work

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
Expand All @@ -64,7 +65,7 @@ jobs:
with:
storage-account: ${{ env.STORAGE_ACCOUNT_NAME }}
resource-group: ${{ env.RESOURCE_GROUP_NAME }}
app-name: ${{ env.SERVICE_NAME }}-${{ inputs.environment }}-web
app-name: ${{ env.SERVICE_NAME }}-${{ env.ENVIRONMENT }}-web
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ENVIRONMENT is not set in GITHUB_ENV

cluster: ${{ env.CLUSTER }}
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }}
backup-file: ${{ env.BACKUP_FILE }}
6 changes: 4 additions & 2 deletions .github/workflows/database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
type: choice
options:
- test
- preprod
- production
backup-file:
description: |
Expand Down Expand Up @@ -61,7 +62,8 @@ jobs:
- name: Set environment variables
run: |
source global_config/${DEPLOY_ENV}.sh
tf_vars_file=${TF_VARS_PATH}/${DEPLOY_ENV}/variables.tfvars.json
tf_vars_file=${TF_VARS_PATH}/${CONFIG}/variables.tfvars.json
echo "ENVIRONMENT=${ENVIRONMENT}" >> $GITHUB_ENV
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
Expand Down Expand Up @@ -91,7 +93,7 @@ jobs:
with:
storage-account: ${{ env.STORAGE_ACCOUNT_NAME }}
resource-group: ${{ env.RESOURCE_GROUP_NAME }}
app-name: ${{ env.SERVICE_NAME }}-${{ env.DEPLOY_ENV }}-web
app-name: ${{ env.SERVICE_NAME }}-${{ env.ENVIRONMENT }}-web
cluster: ${{ env.CLUSTER }}
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }}
backup-file: ${{ env.BACKUP_FILE }}.sql
Expand Down
Loading