Rollback to inactive stack in dev by mattdean3-nhs #17
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| permissions: | |
| id-token: write | |
| contents: read | |
| actions: write | |
| 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 }} | |
| 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@v4 | |
| 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 | |
| run: | | |
| poetry run python ./scripts/get_env_config.py all ${{ inputs.environment }} | |
| - name: Rollback | |
| run: | | |
| inactive_stack_name=$(poetry run python ./scripts/get_env_config.py inactive-stack ${{ inputs.environment }}) | |
| poetry run python ./scripts/activate_stack.py ${inactive_stack_name} ${{ inputs.environment }} | |
| - name: "Smoke Test" | |
| run: | | |
| make ENV=${{ inputs.environment }} test-smoke-public |