Skip to content

Commit

Permalink
Try regression_tests/src/send_failure_alerts.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
WillGibson committed Oct 1, 2024
1 parent 8f48dd3 commit bab6664
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ env:
phases:
install:
commands:
- exit 1
- source ./regression_tests/actions/create_virtual_environment.sh

- source ./regression_tests/actions/set_up_git_config.sh
Expand All @@ -29,13 +30,7 @@ phases:

post_build:
commands:
# Todo: Look to extract to a helper script in a followup pull request
- |
if [ "${CODEBUILD_BUILD_SUCCEEDING}" != "1" ] && git branch --contains $CODEBUILD_RESOLVED_SOURCE_VERSION | grep -q "main" && "${TARGET_ENVIRONMENT:-toolspr}" == "toolspr"; then
pip install dbt-platform-helper
MESSAGE=":alert: @here DBT Platform regression tests have failed in <https://eu-west-2.console.aws.amazon.com/codesuite/codebuild/763451185160/projects/platform-tools-test/build/${CODEBUILD_BUILD_ID}/?region=eu-west-2|build ${CODEBUILD_BUILD_NUMBER}> :sob:"
platform-helper notify add-comment "${SLACK_CHANNEL_ID}" "${SLACK_TOKEN}" "" "${MESSAGE}"
fi
- ./regression_tests/src/send_failure_alerts.sh

artifacts:
files:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@ phases:

post_build:
commands:
# Todo: Look to extract to a helper script in a followup pull request
- |
if [ "${CODEBUILD_BUILD_SUCCEEDING}" != "1" ] && git branch --contains $CODEBUILD_RESOLVED_SOURCE_VERSION | grep -q "main" && "${TARGET_ENVIRONMENT:-toolspr}" == "toolspr"; then
pip install dbt-platform-helper
MESSAGE=":alert: @here DBT Platform regression tests have failed in <https://eu-west-2.console.aws.amazon.com/codesuite/codebuild/763451185160/projects/platform-tools-test/build/${CODEBUILD_BUILD_ID}/?region=eu-west-2|build ${CODEBUILD_BUILD_NUMBER}> :sob:"
platform-helper notify add-comment "${SLACK_CHANNEL_ID}" "${SLACK_TOKEN}" "" "${MESSAGE}"
fi
- ./regression_tests/src/send_failure_alerts.sh

artifacts:
files:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@ phases:

post_build:
commands:
# Todo: Look to extract to a helper script in a followup pull request
- |
if [ "${CODEBUILD_BUILD_SUCCEEDING}" != "1" ] && git branch --contains $CODEBUILD_RESOLVED_SOURCE_VERSION | grep -q "main" && "${TARGET_ENVIRONMENT:-toolspr}" == "toolspr"; then
pip install dbt-platform-helper
MESSAGE=":alert: @here DBT Platform regression tests have failed in <https://eu-west-2.console.aws.amazon.com/codesuite/codebuild/763451185160/projects/platform-tools-test/build/${CODEBUILD_BUILD_ID}/?region=eu-west-2|build ${CODEBUILD_BUILD_NUMBER}> :sob:"
platform-helper notify add-comment "${SLACK_CHANNEL_ID}" "${SLACK_TOKEN}" "" "${MESSAGE}"
fi
- ./regression_tests/src/send_failure_alerts.sh

artifacts:
files:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ phases:

post_build:
commands:
# Todo: Look to extract to a helper script in a followup pull request
- |
if [ "${CODEBUILD_BUILD_SUCCEEDING}" != "1" ] && git branch --contains $CODEBUILD_RESOLVED_SOURCE_VERSION | grep -q "main" && "${TARGET_ENVIRONMENT:-toolspr}" == "toolspr"; then
pip install dbt-platform-helper
MESSAGE=":alert: @here DBT Platform regression tests have failed in <https://eu-west-2.console.aws.amazon.com/codesuite/codebuild/763451185160/projects/platform-tools-test/build/${CODEBUILD_BUILD_ID}/?region=eu-west-2|build ${CODEBUILD_BUILD_NUMBER}> :sob:"
platform-helper notify add-comment "${SLACK_CHANNEL_ID}" "${SLACK_TOKEN}" "" "${MESSAGE}"
fi
- ./regression_tests/src/send_failure_alerts.sh

artifacts:
files:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@ phases:

post_build:
commands:
# Todo: Look to extract to a helper script in a followup pull request
- |
if [ "${CODEBUILD_BUILD_SUCCEEDING}" != "1" ] && git branch --contains $CODEBUILD_RESOLVED_SOURCE_VERSION | grep -q "main" && "${TARGET_ENVIRONMENT:-toolspr}" == "toolspr"; then
pip install dbt-platform-helper
MESSAGE=":alert: @here DBT Platform regression tests have failed in <https://eu-west-2.console.aws.amazon.com/codesuite/codebuild/763451185160/projects/platform-tools-test/build/${CODEBUILD_BUILD_ID}/?region=eu-west-2|build ${CODEBUILD_BUILD_NUMBER}> :sob:"
platform-helper notify add-comment "${SLACK_CHANNEL_ID}" "${SLACK_TOKEN}" "" "${MESSAGE}"
fi
- ./regression_tests/src/send_failure_alerts.sh

artifacts:
files:
Expand Down
12 changes: 12 additions & 0 deletions regression_tests/src/send_failure_alerts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

env

if [ "${CODEBUILD_BUILD_SUCCEEDING}" != "1" ] && git branch --contains $CODEBUILD_RESOLVED_SOURCE_VERSION | grep -q "main" && [ "${TARGET_ENVIRONMENT:-toolspr}" == "toolspr" ]; then
echo -e "\nAction failed sending alert"
pip install dbt-platform-helper
MESSAGE=":alert: @here DBT Platform regression tests have failed in <https://eu-west-2.console.aws.amazon.com/codesuite/codebuild/763451185160/projects/platform-tools-test/build/${CODEBUILD_BUILD_ID}/?region=eu-west-2|build ${CODEBUILD_BUILD_NUMBER}> :sob:"
platform-helper notify add-comment "${SLACK_CHANNEL_ID}" "${SLACK_TOKEN}" "" "${MESSAGE}"
else
echo -e "\nAction succeeded, no alert sent"
fi

0 comments on commit bab6664

Please sign in to comment.