forked from cds-snc/notification-api
-
Notifications
You must be signed in to change notification settings - Fork 9
50 lines (45 loc) · 1.88 KB
/
db-downgrade.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: DB Downgrade
on:
workflow_dispatch:
inputs:
environment:
description: Deployment environment in which to downgrade the database.
required: true
default: dev
ref:
description: Tag of container to run downgrade from
required: true
default: container_tag
jobs:
run-downgrade:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.VAEC_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.VAEC_AWS_SECRET_ACCESS_KEY }}
aws-region: us-gov-west-1
role-to-assume: ${{ secrets.VAEC_DEPLOY_ROLE }}
role-skip-session-tagging: true
role-duration-seconds: 1800
- name: Login to VAEC ECR
id: login-ecr-vaec
uses: aws-actions/amazon-ecr-login@v2
with:
mask-password: 'true'
- name: Render migration task definition
id: render
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: ./cd/application-deployment/${{ inputs.environment }}/vaec-db-downgrade-task-definition.json
container-name: ${{ inputs.environment }}-notification-api-db-migrations
image: ${{ steps.login-ecr-vaec.outputs.registry }}/notification_api:${{ inputs.ref }}
- name: Register migration task definition
id: register
run: |
echo "arn=$(aws ecs register-task-definition --cli-input-json file://${{ steps.render.outputs.task-definition}} | jq -r '.taskDefinition.taskDefinitionArn')" >> $GITHUB_OUTPUT
- name: Run migration task
run: |
bash ./scripts/run_ci_migrations.sh -c ${{ inputs.environment }}-notification-cluster -e ${{ inputs.environment }} -t ${{ steps.register.outputs.arn }}