-
Notifications
You must be signed in to change notification settings - Fork 38
/
base_notify_mattermost.yml
27 lines (24 loc) · 1.14 KB
/
base_notify_mattermost.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#
# feature-branches deployments
# these jobs interact with the GitHub API to post the deployment URL and status to the pull-request
#
.base_notify_mattermost:
image: curlimages/curl
dependencies: []
stage: .post
variables:
MATTERMOST_CHANNEL: ${MATTERMOST_CHANNEL:-gitlab/notifications}
before_script:
- HOST="https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_NAME}.${KUBE_INGRESS_BASE_DOMAIN}"
.base_notify_success_mattermost:
extends: .base_notify_mattermost
when: on_success
script:
- |
curl -i -X POST --data-urlencode 'payload={"channel": "'${MATTERMOST_CHANNEL}'", "username":"AutoDevOpsBot", "icon_url":"https://avatars2.githubusercontent.com/u/45039513", "text": ":tada: Deployment ready for '${CI_PROJECT_NAME}' : '${HOST}'"}' ${MATTERMOST_WEBHOOK}
.base_notify_fail_mattermost:
extends: .base_notify_mattermost
when: on_failure
script:
- |
curl -i -X POST --data-urlencode 'payload={"channel": "'${MATTERMOST_CHANNEL}'", "username":"AutoDevOpsBot", "icon_url":"https://avatars2.githubusercontent.com/u/45039513", "text": ":sob: Deployment failed for '${CI_PROJECT_NAME}' : '${HOST}'"}' ${MATTERMOST_WEBHOOK}