Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
0309e081
Commit
0309e081
authored
Feb 05, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed slack task and added bash script instead. Updated gitlab-ci config file
parent
70f82cc5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
13 deletions
+20
-13
.gitlab-ci.yml
.gitlab-ci.yml
+7
-4
lib/tasks/ci/slack.rake
lib/tasks/ci/slack.rake
+0
-9
scripts/notify_slack.sh
scripts/notify_slack.sh
+13
-0
No files found.
.gitlab-ci.yml
View file @
0309e081
...
...
@@ -183,8 +183,11 @@ spinach:ruby21:
notify:slack:
stage
:
notifications
script
:
-
bundle exec rake ci:slack:error["#ci-test","Build failed for master/tags"]
-
source ./scripts/notify_slack.sh "#ci-test" "Build failed for master/tags!"
when
:
on_failure
only
:
-
master
-
tags
\ No newline at end of file
# TODO: uncomment these lines.
#only:
# - master@gitlab-org/gitlab-ce
# - tags@gitlab-org/gitlab-ce
# - master@gitlab-org/gitlab-ee
# - tags@gitlab-org/gitlab-ee
\ No newline at end of file
lib/tasks/ci/slack.rake
deleted
100644 → 0
View file @
70f82cc5
namespace
:ci
do
namespace
:slack
do
desc
"GitLab CI | Send slack notification on build failure"
task
:error
,
[
:channel
,
:error
]
do
|
t
,
args
|
next
unless
!
"
#{
ENV
[
'CI_SLACK_WEBHOOK_URL'
]
}
"
.
blank?
&&
args
.
channel
&&
args
.
error
Kernel
.
system
"curl -X POST --data-urlencode 'payload={
\"
channel
\"
:
\"
#{
args
.
channel
}
\"
,
\"
username
\"
:
\"
gitlab-ci
\"
,
\"
text
\"
:
\"
#{
args
.
error
}
\"
,
\"
icon_emoji
\"
:
\"
:gitlab:
\"
}' $CI_SLACK_WEBHOOK_URL"
end
end
end
scripts/notify_slack.sh
0 → 100755
View file @
0309e081
#!/bin/bash
# Sends Slack notification ERROR_MSG to CHANNEL
# An env. variable CI_SLACK_WEBHOOK_URL needs to be set.
CHANNEL
=
$1
ERROR_MSG
=
$2
if
[
-z
"
$CHANNEL
"
]
||
[
-z
"
$ERROR_MSG
"
]
||
[
-z
"
$CI_SLACK_WEBHOOK_URL
"
]
;
then
echo
"Missing argument(s) - Use:
$0
channel message"
echo
"and set CI_SLACK_WEBHOOK_URL environment variable."
else
curl
-X
POST
--data-urlencode
'payload={"channel": "'
"
$CHANNEL
"
'", "username": "gitlab-ci", "text": "'
"
$ERROR_MSG
"
'", "icon_emoji": ":gitlab:"}'
"
$CI_SLACK_WEBHOOK_URL
"
fi
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment