ASAP-810 Reorder Events in GP2 Dashboard #3329
Workflow file for this run
This file contains 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: Remove environment | |
permissions: read-all | |
on: | |
pull_request_target: | |
types: [closed] | |
workflow_dispatch: | |
inputs: | |
pr-number: | |
required: true | |
type: string | |
description: Choose which PR number to destroy | |
crn-create-env: | |
required: false | |
type: boolean | |
description: Destroy dedicated CRN enironment | |
gp2-create-env: | |
required: false | |
type: boolean | |
description: Destroy dedicated GP2 enironment | |
jobs: | |
crn-sls-remove: | |
if: ${{ github.event.inputs.pr-number || github.event.pull_request.head.repo.full_name == 'yldio/asap-hub' }} | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/yldio/asap-hub/node-python-sq:86a189edc900d4e1afdcf3935c697292f69d409b | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
environment: Branch | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup | |
id: setup | |
uses: ./.github/actions/setup-environment | |
with: | |
environment-name: Branch | |
- name: Remove sls for crn | |
uses: ./.github/actions/sls-remove | |
with: | |
app: crn-server | |
auth0-audience: ${{ steps.setup.outputs.crn-auth0-audience }} | |
auth0-client-id: ${{ steps.setup.outputs.crn-auth0-client-id }} | |
auth0-shared-secret: ${{ secrets.CRN_AUTH0_SHARED_SECRET }} | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-acm-certificate-arn: ${{ steps.setup.outputs.crn-aws-acm-certificate-arn }} | |
aws-region: ${{ steps.setup.outputs.aws-region }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
environment-name: Branch | |
hostname: ${{ steps.setup.outputs.crn-hostname }} | |
sentry-dsn-api: ${{ steps.setup.outputs.crn-sentry-dsn-api }} | |
sentry-dsn-public-api: ${{ steps.setup.outputs.crn-sentry-dsn-public-api }} | |
sentry-dsn-handlers: ${{ steps.setup.outputs.crn-sentry-dsn-handlers }} | |
ses-region: ${{ steps.setup.outputs.crn-ses-region }} | |
slack-webhook: ${{ secrets.SLACK_WEBHOOK }} | |
sls-stage: ${{ steps.setup.outputs.sls-stage}} | |
gp2-sls-remove: | |
if: ${{ github.event.inputs.pr-number || github.event.pull_request.head.repo.full_name == 'yldio/asap-hub' }} | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/yldio/asap-hub/node-python-sq:86a189edc900d4e1afdcf3935c697292f69d409b | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
environment: Branch | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup | |
id: setup | |
uses: ./.github/actions/setup-environment | |
with: | |
environment-name: Branch | |
- name: Remove sls for gp2 | |
uses: ./.github/actions/sls-remove | |
with: | |
app: gp2-server | |
auth0-audience: ${{ steps.setup.outputs.gp2-auth0-audience }} | |
auth0-client-id: ${{ steps.setup.outputs.gp2-auth0-client-id }} | |
auth0-shared-secret: ${{ secrets.GP2_AUTH0_SHARED_SECRET }} | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-acm-certificate-arn: ${{ steps.setup.outputs.gp2-aws-acm-certificate-arn }} | |
aws-region: ${{ steps.setup.outputs.aws-region }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
environment-name: Branch | |
hostname: ${{ steps.setup.outputs.gp2-hostname }} | |
sentry-dsn-api: ${{ steps.setup.outputs.gp2-sentry-dsn-api }} | |
sentry-dsn-public-api: ${{ steps.setup.outputs.gp2-sentry-dsn-public-api }} | |
sentry-dsn-handlers: ${{ steps.setup.outputs.gp2-sentry-dsn-handlers }} | |
ses-region: ${{ steps.setup.outputs.gp2-ses-region }} | |
slack-webhook: ${{ secrets.SLACK_WEBHOOK }} | |
sls-stage: ${{ steps.setup.outputs.sls-stage}} | |
crn-contentful-remove: | |
if: ${{ github.event.inputs.pr-number || github.event.pull_request.head.repo.full_name == 'yldio/asap-hub' }} | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/yldio/asap-hub/node-python-sq:86a189edc900d4e1afdcf3935c697292f69d409b | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
environment: Branch | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Check PR number | |
if: ${{ github.event.inputs.pr-number }} | |
uses: ./.github/actions/is-number | |
with: | |
number: ${{ github.event.inputs.pr-number }} | |
- name: Setup | |
id: setup | |
uses: ./.github/actions/setup-environment | |
with: | |
environment-name: Branch | |
crn-create-env: ${{inputs.crn-create-env}} | |
- name: Contentful Environment Teardown | |
id: contentful-env-teardown | |
shell: bash | |
run: yarn workspace @asap-hub/contentful space:remove-environment | |
env: | |
CONTENTFUL_SPACE_ID: ${{ steps.setup.outputs.crn-contentful-space-id }} | |
CONTENTFUL_MANAGEMENT_ACCESS_TOKEN: ${{ secrets.CONTENTFUL_MANAGEMENT_TOKEN }} | |
CONTENTFUL_ENV_ID: ${{ steps.setup.outputs.crn-contentful-env-id }} | |
- name: Contentful Webhook Teardown | |
if: ${{ steps.setup.outputs.crn-contentful-on-branch-env == 'true' }} | |
id: contentful-webhook-teardown | |
shell: bash | |
run: yarn workspace @asap-hub/contentful space:remove-webhook | |
env: | |
CONTENTFUL_ENVIRONMENT: ${{ steps.setup.outputs.crn-contentful-env-id }} | |
CONTENTFUL_MANAGEMENT_ACCESS_TOKEN: ${{ secrets.CONTENTFUL_MANAGEMENT_TOKEN }} | |
CONTENTFUL_SPACE_ID: ${{ steps.setup.outputs.crn-contentful-space-id }} | |
gp2-contentful-remove: | |
if: ${{ github.event.inputs.pr-number || github.event.pull_request.head.repo.full_name == 'yldio/asap-hub' }} | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/yldio/asap-hub/node-python-sq:86a189edc900d4e1afdcf3935c697292f69d409b | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
environment: Branch | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Check PR number | |
if: ${{ github.event.inputs.pr-number }} | |
uses: ./.github/actions/is-number | |
with: | |
number: ${{ github.event.inputs.pr-number }} | |
- name: Setup | |
id: setup | |
uses: ./.github/actions/setup-environment | |
with: | |
environment-name: Branch | |
gp2-create-env: ${{inputs.gp2-create-env}} | |
- name: Contentful Environment Teardown | |
id: contentful-env-teardown | |
shell: bash | |
run: yarn workspace @asap-hub/contentful space:remove-environment | |
env: | |
CONTENTFUL_SPACE_ID: ${{ steps.setup.outputs.gp2-contentful-space-id }} | |
CONTENTFUL_MANAGEMENT_ACCESS_TOKEN: ${{ secrets.CONTENTFUL_MANAGEMENT_TOKEN }} | |
CONTENTFUL_ENV_ID: ${{ steps.setup.outputs.gp2-contentful-env-id }} | |
- name: Contentful Webhook Teardown | |
if: ${{ steps.setup.outputs.gp2-on-branch-env == 'true' }} | |
id: contentful-webhook-teardown | |
shell: bash | |
run: yarn workspace @asap-hub/contentful space:remove-webhook | |
env: | |
CONTENTFUL_ENVIRONMENT: ${{ steps.setup.outputs.gp2-contentful-env-id }} | |
CONTENTFUL_MANAGEMENT_ACCESS_TOKEN: ${{ secrets.CONTENTFUL_MANAGEMENT_TOKEN }} | |
CONTENTFUL_SPACE_ID: ${{ steps.setup.outputs.gp2-contentful-space-id }} | |
crn-algolia-index: | |
if: ${{ github.event.inputs.pr-number || github.event.pull_request.head.repo.full_name == 'yldio/asap-hub' }} | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/yldio/asap-hub/node-python-sq:86a189edc900d4e1afdcf3935c697292f69d409b | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Re-Build | |
uses: ./.github/actions/build-rebuild | |
- name: Cache build typecheck output | |
uses: ./.github/actions/cache-unplugged | |
with: | |
environment-name: Branch | |
- name: Check PR Number | |
if: ${{ github.event.inputs.pr-number }} | |
uses: ./.github/actions/is-number | |
with: | |
number: ${{ github.event.inputs.pr-number }} | |
- name: Setup | |
id: setup | |
uses: ./.github/actions/setup-environment | |
with: | |
environment-name: Branch | |
crn-create-env: ${{inputs.crn-create-env}} | |
- name: Rebuild dependencies | |
run: yarn build:babel | |
- name: Get Algolia Keys | |
id: algolia-keys | |
uses: ./.github/actions/algolia-keys | |
with: | |
algolia-app-id-name: ${{ steps.setup.outputs.crn-algolia-app-id-name }} | |
algolia-api-key-name: ${{ steps.setup.outputs.crn-algolia-api-key-name }} | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-default-region: ${{ steps.setup.outputs.aws-default-region }} | |
- name: Delete the entity index | |
if: ${{ steps.setup.outputs.crn-contentful-on-branch-env == 'true' && steps.setup.outputs.crn-algolia-index != 'asap-hub_dev' && steps.setup.outputs.crn-algolia-index != 'asap-hub_prod' }} | |
run: | | |
yarn algolia:delete-index -a $ALGOLIA_APP_ID -k $ALGOLIA_API_KEY -n $ALGOLIA_INDEX | |
env: | |
ALGOLIA_API_KEY: ${{ steps.algolia-keys.outputs.algolia-api-key }} | |
ALGOLIA_APP_ID: ${{ steps.algolia-keys.outputs.algolia-app-id }} | |
ALGOLIA_INDEX: ${{ steps.setup.outputs.crn-algolia-index }} | |
- name: Delete the analytics index | |
if: ${{ steps.setup.outputs.crn-analytics-algolia-on-branch-env == 'true' && steps.setup.outputs.crn-analytics-algolia-index != 'crn-analytics_dev' && steps.setup.outputs.crn-analytics-algolia-index != 'crn-analytics_prod' }} | |
run: | | |
yarn algolia:delete-index -a $ALGOLIA_APP_ID -k $ALGOLIA_API_KEY -n $ALGOLIA_ANALYTICS_INDEX | |
env: | |
ALGOLIA_API_KEY: ${{ steps.algolia-keys.outputs.algolia-api-key }} | |
ALGOLIA_APP_ID: ${{ steps.algolia-keys.outputs.algolia-app-id }} | |
ALGOLIA_ANALYTICS_INDEX: ${{ steps.setup.outputs.crn-analytics-algolia-index }} | |
gp2-algolia-index: | |
if: ${{ github.event.inputs.pr-number || github.event.pull_request.head.repo.full_name == 'yldio/asap-hub' }} | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/yldio/asap-hub/node-python-sq:86a189edc900d4e1afdcf3935c697292f69d409b | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Re-Build | |
uses: ./.github/actions/build-rebuild | |
- name: Cache build typecheck output | |
uses: ./.github/actions/cache-unplugged | |
with: | |
environment-name: Branch | |
- name: Check PR Number | |
if: ${{ github.event.inputs.pr-number }} | |
uses: ./.github/actions/is-number | |
with: | |
number: ${{ github.event.inputs.pr-number }} | |
- name: Setup | |
id: setup | |
uses: ./.github/actions/setup-environment | |
with: | |
environment-name: Branch | |
gp2-create-env: ${{inputs.gp2-create-env}} | |
- name: Rebuild dependencies | |
run: yarn build:babel | |
- name: Get Algolia Keys | |
id: algolia-keys | |
uses: ./.github/actions/algolia-keys | |
with: | |
algolia-app-id-name: ${{ steps.setup.outputs.gp2-algolia-app-id-name }} | |
algolia-api-key-name: ${{ steps.setup.outputs.gp2-algolia-api-key-name }} | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-default-region: ${{ steps.setup.outputs.aws-default-region }} | |
- name: Delete the index | |
if: ${{ steps.setup.outputs.gp2-on-branch-env == 'true' }} | |
run: | | |
yarn algolia:delete-index -a $ALGOLIA_APP_ID -k $ALGOLIA_API_KEY -n $ALGOLIA_INDEX | |
env: | |
ALGOLIA_API_KEY: ${{ steps.algolia-keys.outputs.algolia-api-key }} | |
ALGOLIA_APP_ID: ${{ steps.algolia-keys.outputs.algolia-app-id }} | |
ALGOLIA_INDEX: ${{ steps.setup.outputs.gp2-algolia-index }} | |
notify_failure: | |
runs-on: ubuntu-latest | |
needs: | |
[ | |
crn-algolia-index, | |
crn-contentful-remove, | |
crn-sls-remove, | |
gp2-algolia-index, | |
gp2-contentful-remove, | |
gp2-sls-remove, | |
] | |
if: ${{ failure() && (github.event.inputs.pr-number || github.event.pull_request.head.repo.full_name == 'yldio/asap-hub') }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: ./.github/actions/slack/ | |
with: | |
message: Environment teardown | |
webhook: ${{ secrets.SLACK_WEBHOOK }} | |
status: failure |