-
Notifications
You must be signed in to change notification settings - Fork 4
58 lines (50 loc) · 1.83 KB
/
rollback-stack.yml
File metadata and controls
58 lines (50 loc) · 1.83 KB
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
51
52
53
54
55
56
57
58
name: Rollback Stack
run-name: Rollback to inactive stack in ${{ inputs.environment }} by ${{ github.actor }}
on:
workflow_dispatch:
inputs:
environment:
description: "Environment to rollback the stack in"
required: true
default: "dev"
type: environment
jobs:
rollback-stack:
name: Rollback to inactive stack for ${{ inputs.environment }}
runs-on: codebuild-nhsd-nrlf-ci-build-project-${{ github.run_id }}-${{ github.run_attempt }}
environment: ${{ inputs.environment }}
permissions:
id-token: write
contents: read
actions: write
steps:
- name: Git clone - ${{ github.ref }}
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Setup environment
run: |
echo "${HOME}/.asdf/bin" >> $GITHUB_PATH
poetry install --no-root
- name: Configure Management Credentials
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a #v4.3.1
with:
aws-region: eu-west-2
role-to-assume: ${{ secrets.MGMT_ROLE_ARN }}
role-session-name: github-actions-ci-${{ inputs.environment }}-${{ github.run_id}}
- name: Get current environment config
env:
ENVIRONMENT: ${{ inputs.environment }}
run: |
poetry run python ./scripts/get_env_config.py all $ENVIRONMENT
- name: Rollback
env:
ENVIRONMENT: ${{ inputs.environment }}
run: |
inactive_stack_name=$(poetry run python ./scripts/get_env_config.py inactive-stack $ENVIRONMENT)
poetry run python ./scripts/activate_stack.py ${inactive_stack_name} $ENVIRONMENT
- name: "Smoke Test"
env:
ENVIRONMENT: ${{ inputs.environment }}
run: |
make ENV=$ENVIRONMENT test-smoke-public