summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wray <jason@mapbox.com>2018-08-24 16:30:54 -0400
committerJason Wray <friedbunny@users.noreply.github.com>2018-08-28 14:53:56 -0400
commit4061e9026e0a90c10f1f2cc77322e05ac8a45cf8 (patch)
tree20d3d72bd5519bc2ed3ca50b7376c6734764d64c
parent361d83af543ed3f2878d83f9fbc0990b938e7038 (diff)
downloadqtlocation-mapboxgl-4061e9026e0a90c10f1f2cc77322e05ac8a45cf8.tar.gz
[build] Add Slack notifications for important iOS builds
- Notifies #apple when nightly builds fail. - Notifies #apple when release deployment jobs start/finish.
-rw-r--r--circle.yml40
-rwxr-xr-xscripts/notify-slack.sh12
2 files changed, 52 insertions, 0 deletions
diff --git a/circle.yml b/circle.yml
index 0cb06e9926..24920c4814 100644
--- a/circle.yml
+++ b/circle.yml
@@ -285,6 +285,18 @@ step-library:
store_artifacts:
path: build/logs
+
+ - &notify-slack-nightly-failure
+ run:
+ name: Send a Slack notification on nightly failure
+ when: on_fail
+ command: |
+ if [[ -z $CIRCLE_COMPARE_URL && $CIRCLE_BRANCH == master ]]; then
+ export SLACK_MESSAGE="Nightly build of \`$CIRCLE_JOB\` <$CIRCLE_BUILD_URL|failed>."
+ export SLACK_COLOR="danger"
+ scripts/notify-slack.sh
+ fi
+
jobs:
nitpick:
docker:
@@ -851,6 +863,7 @@ jobs:
environment:
BUILDTYPE: Debug
HOMEBREW_NO_AUTO_UPDATE: 1
+ SLACK_CHANNEL: C0ACM9Q2C
steps:
- checkout
- *restore-node_modules-cache
@@ -870,6 +883,7 @@ jobs:
- *save-ccache
- *collect-xcode-build-logs
- *upload-xcode-build-logs
+ - *notify-slack-nightly-failure
# ------------------------------------------------------------------------------
ios-sanitize-address:
@@ -878,6 +892,7 @@ jobs:
environment:
BUILDTYPE: Debug
HOMEBREW_NO_AUTO_UPDATE: 1
+ SLACK_CHANNEL: C0ACM9Q2C
steps:
- checkout
- *restore-node_modules-cache
@@ -897,6 +912,7 @@ jobs:
- *save-ccache
- *collect-xcode-build-logs
- *upload-xcode-build-logs
+ - *notify-slack-nightly-failure
# ------------------------------------------------------------------------------
ios-static-analyzer:
@@ -905,6 +921,7 @@ jobs:
environment:
BUILDTYPE: Debug
HOMEBREW_NO_AUTO_UPDATE: 1
+ SLACK_CHANNEL: C0ACM9Q2C
steps:
- checkout
- *restore-node_modules-cache
@@ -924,6 +941,7 @@ jobs:
- *save-ccache
- *collect-xcode-build-logs
- *upload-xcode-build-logs
+ - *notify-slack-nightly-failure
# ------------------------------------------------------------------------------
ios-release:
@@ -932,6 +950,7 @@ jobs:
environment:
BUILDTYPE: Release
HOMEBREW_NO_AUTO_UPDATE: 1
+ SLACK_CHANNEL: C0ACM9Q2C
steps:
- checkout
- *restore-node_modules-cache
@@ -961,6 +980,7 @@ jobs:
- *save-ccache
- *collect-xcode-build-logs
- *upload-xcode-build-logs
+ - *notify-slack-nightly-failure
# ------------------------------------------------------------------------------
ios-release-tag:
@@ -969,7 +989,13 @@ jobs:
environment:
BUILDTYPE: Release
HOMEBREW_NO_AUTO_UPDATE: 1
+ SLACK_CHANNEL: C0ACM9Q2C
steps:
+ - run:
+ name: Send a Slack notification on start
+ command: |
+ export SLACK_MESSAGE="Release build for <$CIRCLE_COMPARE_URL|\`$CIRCLE_TAG\`> <$CIRCLE_BUILD_URL|started>."
+ scripts/notify-slack.sh
- checkout
- *restore-node_modules-cache
- *npm-install
@@ -992,6 +1018,20 @@ jobs:
- *save-ccache
- *collect-xcode-build-logs
- *upload-xcode-build-logs
+ - run:
+ name: Send a Slack notification on failure
+ when: on_fail
+ command: |
+ export SLACK_MESSAGE="Release build for <$CIRCLE_COMPARE_URL|\`$CIRCLE_TAG\`> <$CIRCLE_BUILD_URL|failed>."
+ export SLACK_COLOR="danger"
+ scripts/notify-slack.sh
+ - run:
+ name: Send a Slack notification on success
+ when: on_success
+ command: |
+ export SLACK_MESSAGE="Release build for <$CIRCLE_COMPARE_URL|\`$CIRCLE_TAG\`> <$CIRCLE_BUILD_URL|succeeded>."
+ export SLACK_COLOR="good"
+ scripts/notify-slack.sh
# ------------------------------------------------------------------------------
macos-debug:
diff --git a/scripts/notify-slack.sh b/scripts/notify-slack.sh
new file mode 100755
index 0000000000..5b637e87af
--- /dev/null
+++ b/scripts/notify-slack.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+set -u
+
+SLACK_CHANNEL=${SLACK_CHANNEL:-''}
+SLACK_COLOR=${SLACK_COLOR:-''}
+
+curl -g -H "Content-Type: application/json" -X POST \
+ -d "{\"channel\": \"$SLACK_CHANNEL\", \"attachments\": [{\"text\": \"$SLACK_MESSAGE\", \"color\": \"$SLACK_COLOR\", \"author_name\": \"$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME\"}]}" \
+ $SLACK_WEBHOOK_URL