diff --git a/regression_tests/buildspecs/stages/build/build-platform-helper-and-reclone-demodjango-repositories-action.yml b/regression_tests/buildspecs/stages/build/build-platform-helper-and-reclone-demodjango-repositories-action.yml index 862d6e09e..a3a78c57b 100644 --- a/regression_tests/buildspecs/stages/build/build-platform-helper-and-reclone-demodjango-repositories-action.yml +++ b/regression_tests/buildspecs/stages/build/build-platform-helper-and-reclone-demodjango-repositories-action.yml @@ -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 @@ -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 :sob:" - platform-helper notify add-comment "${SLACK_CHANNEL_ID}" "${SLACK_TOKEN}" "" "${MESSAGE}" - fi + - ./regression_tests/src/send_failure_alerts.sh artifacts: files: diff --git a/regression_tests/buildspecs/stages/deploy/run-codebase-deploy-pipeline.yml b/regression_tests/buildspecs/stages/deploy/run-codebase-deploy-pipeline.yml index fe214659f..2a8aacefd 100644 --- a/regression_tests/buildspecs/stages/deploy/run-codebase-deploy-pipeline.yml +++ b/regression_tests/buildspecs/stages/deploy/run-codebase-deploy-pipeline.yml @@ -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 :sob:" - platform-helper notify add-comment "${SLACK_CHANNEL_ID}" "${SLACK_TOKEN}" "" "${MESSAGE}" - fi + - ./regression_tests/src/send_failure_alerts.sh artifacts: files: diff --git a/regression_tests/buildspecs/stages/deploy/run-environment-pipeline.yml b/regression_tests/buildspecs/stages/deploy/run-environment-pipeline.yml index 93817b697..19feac972 100644 --- a/regression_tests/buildspecs/stages/deploy/run-environment-pipeline.yml +++ b/regression_tests/buildspecs/stages/deploy/run-environment-pipeline.yml @@ -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 :sob:" - platform-helper notify add-comment "${SLACK_CHANNEL_ID}" "${SLACK_TOKEN}" "" "${MESSAGE}" - fi + - ./regression_tests/src/send_failure_alerts.sh artifacts: files: diff --git a/regression_tests/buildspecs/stages/test/run-browser-tests.yml b/regression_tests/buildspecs/stages/test/run-browser-tests.yml index 988d2b847..6a728952b 100644 --- a/regression_tests/buildspecs/stages/test/run-browser-tests.yml +++ b/regression_tests/buildspecs/stages/test/run-browser-tests.yml @@ -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 :sob:" - platform-helper notify add-comment "${SLACK_CHANNEL_ID}" "${SLACK_TOKEN}" "" "${MESSAGE}" - fi + - ./regression_tests/src/send_failure_alerts.sh artifacts: files: diff --git a/regression_tests/buildspecs/stages/test/run-s3-to-s3-data-migration-tests.yml b/regression_tests/buildspecs/stages/test/run-s3-to-s3-data-migration-tests.yml index c4fda3cd1..100f4c175 100644 --- a/regression_tests/buildspecs/stages/test/run-s3-to-s3-data-migration-tests.yml +++ b/regression_tests/buildspecs/stages/test/run-s3-to-s3-data-migration-tests.yml @@ -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 :sob:" - platform-helper notify add-comment "${SLACK_CHANNEL_ID}" "${SLACK_TOKEN}" "" "${MESSAGE}" - fi + - ./regression_tests/src/send_failure_alerts.sh artifacts: files: diff --git a/regression_tests/src/send_failure_alerts.sh b/regression_tests/src/send_failure_alerts.sh new file mode 100755 index 000000000..a77c5a33b --- /dev/null +++ b/regression_tests/src/send_failure_alerts.sh @@ -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 :sob:" + platform-helper notify add-comment "${SLACK_CHANNEL_ID}" "${SLACK_TOKEN}" "" "${MESSAGE}" +else + echo -e "\nAction succeeded, no alert sent" +fi