Skip to content

Destroy

Destroy #1640

Workflow file for this run

name: Destroy
on: delete
permissions:
id-token: write
contents: read
actions: read
jobs:
destroy:
if: github.event.ref_type == 'branch'
runs-on: ubuntu-latest
steps:
- name: set branch_name
run: echo "branch_name=${{ github.event.ref }}" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: set branch specific variable names
run: ./.github/build_vars.sh set_names
- name: set variable values
run: ./.github/build_vars.sh set_values
env:
AWS_OIDC_ROLE_TO_ASSUME: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_AWS_OIDC_ROLE_TO_ASSUME] || secrets.AWS_OIDC_ROLE_TO_ASSUME }}
AWS_DEFAULT_REGION: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_AWS_DEFAULT_REGION] || secrets.AWS_DEFAULT_REGION }}
STAGE_PREFIX: ${{ secrets.STAGE_PREFIX }}
- name: Configure AWS credentials for GitHub Actions
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.AWS_OIDC_ROLE_TO_ASSUME }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: lock this branch to prevent concurrent builds
run: ./.github/github-lock.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: ./destroy.sh $STAGE_PREFIX$branch_name
- name: Tell bigmac which topics to delete
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Delete Topics
repo: cmsgov/cms-bigmac
ref: refs/heads/master # OneMAC uses develop, bigmac uses master, dispatch assumes same name
token: ${{ secrets.BIGMAC_PERSONAL_ACCESS_TOKEN }}
inputs: '{ "topics": "mgmt.connect.stream-functions-${{ env.branch_name }}.offsets,mgmt.connect.stream-functions-${{ env.branch_name }}.config,mgmt.connect.stream-functions-${{ env.branch_name }}.status"}'