Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add message to post in slack on failure for acceptance tests #190

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/acceptance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
module: network/sandbox
secrets:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

apply_cluster:
name: Apply Cluster
Expand All @@ -29,6 +30,7 @@ jobs:
module: cluster/sandbox-v1
secrets:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

apply_ingress:
name: Apply Ingress
Expand All @@ -40,6 +42,7 @@ jobs:
module: ingress/sandbox
secrets:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

apply_platform:
name: Apply Platform
Expand All @@ -51,6 +54,7 @@ jobs:
module: platform/sandbox-v1
secrets:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

tests:
name: Run Tests
Expand All @@ -60,6 +64,7 @@ jobs:
concurrency: ${{ github.ref_name }}-platform
secrets:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

cleanup_platform:
name: Cleanup Platform
Expand All @@ -72,6 +77,7 @@ jobs:
terraform_command: destroy
secrets:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

cleanup_ingress:
name: Cleanup Ingress
Expand All @@ -84,6 +90,7 @@ jobs:
terraform_command: destroy
secrets:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

cleanup_cluster:
name: Cleanup Cluster
Expand All @@ -96,6 +103,7 @@ jobs:
terraform_command: destroy
secrets:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

cleanup_network:
name: Cleanup Network
Expand All @@ -108,3 +116,4 @@ jobs:
terraform_command: destroy
secrets:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/terraform-dispatch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ jobs:
terraform_version: ${{ github.event.inputs.terraform_version }}
secrets:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}

SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
15 changes: 14 additions & 1 deletion .github/workflows/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ on:
AWS_ACCOUNT_ID:
description: AWS account in which Terraform will run
required: true
SLACK_BOT_TOKEN:
description: Token used to send messages to Slack
required: true

env:
SLACK_CHANNEL: '#mission-control'

jobs:
plan:
Expand All @@ -26,7 +32,6 @@ jobs:
working-directory: ${{ inputs.module }}

steps:

- name: Checkout
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -92,3 +97,11 @@ jobs:
run: |
terraform ${{ inputs.terraform_command }} -auto-approve

- name: Notify Slack
if: failure()
uses: slackapi/slack-github-action@007b2c3c751a190b6f0f040e47ed024deaa72844 # v1.23.0
with:
channel-id: ${{ env.SLACK_CHANNEL }}
slack-message: "Flightdeck acceptance terraform has failed to ${{ inputs.terraform_command }} on the ${{ inputs.module }} module."
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
13 changes: 13 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ on:
AWS_ACCOUNT_ID:
description: AWS account in which tests will run
required: true
SLACK_BOT_TOKEN:
description: Token used to send messages to Slack
required: true

env:
KUBECONFIG: /tmp/kubeconfig
SLACK_CHANNEL: '#mission-control'

jobs:
plan:
Expand Down Expand Up @@ -68,3 +72,12 @@ jobs:
make tests \
ADDRESS=https://${{ github.ref_name }}.flightdeck-test.thoughtbot.com \
CLUSTER="$CLUSTER"

- name: Notify Slack
if: failure()
uses: slackapi/slack-github-action@007b2c3c751a190b6f0f040e47ed024deaa72844 # v1.23.0
with:
channel-id: ${{ env.SLACK_CHANNEL }}
slack-message: "Flightdeck acceptance tests have failed on the testing cluster."
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
Loading