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
Boxiang Sun
gitlab-ce
Commits
5fe354ef
Commit
5fe354ef
authored
Feb 03, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored rake task and make build pass
parent
63a950a5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
6 deletions
+5
-6
.gitlab-ci.yml
.gitlab-ci.yml
+1
-1
app/models/project.rb
app/models/project.rb
+1
-2
lib/tasks/ci/slack.rake
lib/tasks/ci/slack.rake
+3
-3
No files found.
.gitlab-ci.yml
View file @
5fe354ef
...
@@ -183,7 +183,7 @@ spinach:ruby21:
...
@@ -183,7 +183,7 @@ spinach:ruby21:
notify:slack:
notify:slack:
stage
:
notifications
stage
:
notifications
script
:
script
:
-
bundle exec rake ci:slack:error
-
bundle exec rake ci:slack:error
["#ci-test","Build failed for master/tags"]
when
:
on_failure
when
:
on_failure
# only:
# only:
# - master
# - master
...
...
app/models/project.rb
View file @
5fe354ef
...
@@ -42,8 +42,7 @@
...
@@ -42,8 +42,7 @@
require
'carrierwave/orm/activerecord'
require
'carrierwave/orm/activerecord'
require
'file_size_validator'
require
'file_size_validator'
class
Project
<
ActiveRecord
::
Base
lass
Project
<
ActiveRecord
::
Base
include
Gitlab
::
ConfigHelper
include
Gitlab
::
ConfigHelper
include
Gitlab
::
ShellAdapter
include
Gitlab
::
ShellAdapter
include
Gitlab
::
VisibilityLevel
include
Gitlab
::
VisibilityLevel
...
...
lib/tasks/ci/slack.rake
View file @
5fe354ef
namespace
:ci
do
namespace
:ci
do
namespace
:slack
do
namespace
:slack
do
desc
"GitLab CI | Send slack notification on build failure"
desc
"GitLab CI | Send slack notification on build failure"
task
error: :environment
do
task
:error
,
[
:channel
,
:error
]
do
|
t
,
args
|
error_text
=
'Build failed for master/tags'
next
unless
!
"
#{
ENV
[
'CI_SLACK_WEBHOOK_URL'
]
}
"
.
blank?
&&
args
.
channel
&&
args
.
error
Kernel
.
system
"curl -X POST --data-urlencode 'payload={
\"
channel
\"
:
\"
#
ci-test
\"
,
\"
username
\"
:
\"
gitlab-ci
\"
,
\"
text
\"
:
\"
#{
error_text
}
\"
,
\"
icon_emoji
\"
:
\"
:gitlab:
\"
}' $CI_SLACK_WEBHOOK_URL"
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
end
end
end
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