Last active
August 29, 2015 14:13
-
-
Save datacoda/f32ec0a21a04718ff36f to your computer and use it in GitHub Desktop.
Shippable and HipChat notifications
This file contains hidden or 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
language: ruby | |
bundler_args: --without kitchen_vagrant | |
cache: true | |
env: | |
- secure: {{ENCRYPTED_ENVIRONMENT_VARS_FROM_UI}} | |
rvm: | |
- 2.0.0 | |
script: | |
- bundle exec rake ci | |
notifications: | |
email: false | |
before_install: | |
- export SHORT=`echo $COMMIT | cut -c 1-7` | |
- export HC_MESSAGE="<a href=\"${BUILD_URL}\">Started a new build</a> for branch ${BRANCH} on ${REPO_NAME} (${SHORT})" | |
- export HC_CONFIG="room_id=${HIPCHAT_ROOM}&from=Shippable&message_format=html¬ify=1&color=yellow" | |
- export HC_NOTIFY_API="https://api.hipchat.com/v1/rooms/message?auth_token=${HIPCHAT_TOKEN}" | |
- curl -d $HC_CONFIG --data-urlencode "message=${HC_MESSAGE}" ${HC_NOTIFY_API} | |
after_success: | |
- export SHORT=`echo $COMMIT | cut -c 1-7` | |
- export HC_STATUS="succeeded" | |
- export HC_MESSAGE="<a href=\"${BUILD_URL}\">Build ${HC_STATUS}</a> for branch ${BRANCH} on ${REPO_NAME} (${SHORT})" | |
- export HC_CONFIG="room_id=${HIPCHAT_ROOM}&from=Shippable&message_format=html¬ify=1&color=green" | |
- export HC_NOTIFY_API="https://api.hipchat.com/v1/rooms/message?auth_token=${HIPCHAT_TOKEN}" | |
- curl -d $HC_CONFIG --data-urlencode "message=${HC_MESSAGE}" ${HC_NOTIFY_API} | |
after_failure: | |
- export SHORT=`echo $COMMIT | cut -c 1-7` | |
- export HC_STATUS="failed" | |
- export HC_MESSAGE="<a href=\"${BUILD_URL}\">Build ${HC_STATUS}</a> for branch ${BRANCH} on ${REPO_NAME} (${SHORT})" | |
- export HC_CONFIG="room_id=${HIPCHAT_ROOM}&from=Shippable&message_format=html¬ify=1&color=red" | |
- export HC_NOTIFY_API="https://api.hipchat.com/v1/rooms/message?auth_token=${HIPCHAT_TOKEN}" | |
- curl -d $HC_CONFIG --data-urlencode "message=${HC_MESSAGE}" ${HC_NOTIFY_API} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
HIPCHAT_TOKEN and HIPCHAT_ROOM are the environment variables that need to be encrypted from the dashboard UI.