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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
d57e809c
Commit
d57e809c
authored
Feb 28, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set supported events per project service.
parent
85fa334e
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
156 additions
and
57 deletions
+156
-57
app/models/project_services/asana_service.rb
app/models/project_services/asana_service.rb
+5
-2
app/models/project_services/assembla_service.rb
app/models/project_services/assembla_service.rb
+5
-2
app/models/project_services/bamboo_service.rb
app/models/project_services/bamboo_service.rb
+5
-2
app/models/project_services/buildbox_service.rb
app/models/project_services/buildbox_service.rb
+5
-2
app/models/project_services/campfire_service.rb
app/models/project_services/campfire_service.rb
+5
-2
app/models/project_services/ci_service.rb
app/models/project_services/ci_service.rb
+4
-0
app/models/project_services/emails_on_push_service.rb
app/models/project_services/emails_on_push_service.rb
+5
-2
app/models/project_services/flowdock_service.rb
app/models/project_services/flowdock_service.rb
+5
-2
app/models/project_services/gemnasium_service.rb
app/models/project_services/gemnasium_service.rb
+5
-2
app/models/project_services/gitlab_ci_service.rb
app/models/project_services/gitlab_ci_service.rb
+5
-2
app/models/project_services/hipchat_service.rb
app/models/project_services/hipchat_service.rb
+5
-2
app/models/project_services/issue_tracker_service.rb
app/models/project_services/issue_tracker_service.rb
+5
-2
app/models/project_services/pivotaltracker_service.rb
app/models/project_services/pivotaltracker_service.rb
+5
-2
app/models/project_services/pushover_service.rb
app/models/project_services/pushover_service.rb
+5
-2
app/models/project_services/slack_service.rb
app/models/project_services/slack_service.rb
+5
-0
app/models/project_services/teamcity_service.rb
app/models/project_services/teamcity_service.rb
+5
-2
app/models/service.rb
app/models/service.rb
+6
-0
app/views/admin/services/_form.html.haml
app/views/admin/services/_form.html.haml
+37
-0
app/views/projects/services/_form.html.haml
app/views/projects/services/_form.html.haml
+34
-29
No files found.
app/models/project_services/asana_service.rb
View file @
d57e809c
...
...
@@ -65,9 +65,12 @@ automatically inspected. Leave blank to include all branches.'
]
end
def
supported_events
%w(push)
end
def
execute
(
data
)
object_kind
=
data
[
:object_kind
]
return
unless
object_kind
==
"push"
return
unless
supported_events
.
include?
(
data
[
:object_kind
])
Asana
.
configure
do
|
client
|
client
.
api_key
=
api_key
...
...
app/models/project_services/assembla_service.rb
View file @
d57e809c
...
...
@@ -42,9 +42,12 @@ class AssemblaService < Service
]
end
def
supported_events
%w(push)
end
def
execute
(
data
)
object_kind
=
data
[
:object_kind
]
return
unless
object_kind
==
"push"
return
unless
supported_events
.
include?
(
data
[
:object_kind
])
url
=
"https://atlas.assembla.com/spaces/
#{
subdomain
}
/github_tool?secret_key=
#{
token
}
"
AssemblaService
.
post
(
url
,
body:
{
payload:
data
}.
to_json
,
headers:
{
'Content-Type'
=>
'application/json'
})
...
...
app/models/project_services/bamboo_service.rb
View file @
d57e809c
...
...
@@ -73,6 +73,10 @@ class BambooService < CiService
]
end
def
supported_events
%w(push)
end
def
build_info
(
sha
)
url
=
URI
.
parse
(
"
#{
bamboo_url
}
/rest/api/latest/result?label=
#{
sha
}
"
)
...
...
@@ -123,8 +127,7 @@ class BambooService < CiService
end
def
execute
(
data
)
object_kind
=
data
[
:object_kind
]
return
unless
object_kind
==
"push"
return
unless
supported_events
.
include?
(
data
[
:object_kind
])
# Bamboo requires a GET and does not take any data.
self
.
class
.
get
(
"
#{
bamboo_url
}
/updateAndBuild.action?buildKey=
#{
build_key
}
"
,
...
...
app/models/project_services/buildbox_service.rb
View file @
d57e809c
...
...
@@ -36,9 +36,12 @@ class BuildboxService < CiService
hook
.
save
end
def
supported_events
%w(push)
end
def
execute
(
data
)
object_kind
=
data
[
:object_kind
]
return
unless
object_kind
==
"push"
return
unless
supported_events
.
include?
(
data
[
:object_kind
])
service_hook
.
execute
(
data
)
end
...
...
app/models/project_services/campfire_service.rb
View file @
d57e809c
...
...
@@ -41,9 +41,12 @@ class CampfireService < Service
]
end
def
supported_events
%w(push)
end
def
execute
(
data
)
object_kind
=
data
[
:object_kind
]
return
unless
object_kind
==
"push"
return
unless
supported_events
.
include?
(
data
[
:object_kind
])
room
=
gate
.
find_room_by_name
(
self
.
room
)
return
true
unless
room
...
...
app/models/project_services/ci_service.rb
View file @
d57e809c
...
...
@@ -25,6 +25,10 @@ class CiService < Service
:ci
end
def
supported_events
%w(push)
end
# Return complete url to build page
#
# Ex.
...
...
app/models/project_services/emails_on_push_service.rb
View file @
d57e809c
...
...
@@ -33,9 +33,12 @@ class EmailsOnPushService < Service
'emails_on_push'
end
def
supported_events
%w(push)
end
def
execute
(
data
)
object_kind
=
data
[
:object_kind
]
return
unless
object_kind
==
"push"
return
unless
supported_events
.
include?
(
data
[
:object_kind
])
EmailsOnPushWorker
.
perform_async
(
project_id
,
recipients
,
data
)
end
...
...
app/models/project_services/flowdock_service.rb
View file @
d57e809c
...
...
@@ -41,9 +41,12 @@ class FlowdockService < Service
]
end
def
supported_events
%w(push)
end
def
execute
(
data
)
object_kind
=
data
[
:object_kind
]
return
unless
object_kind
==
"push"
return
unless
supported_events
.
include?
(
data
[
:object_kind
])
Flowdock
::
Git
.
post
(
data
[
:ref
],
...
...
app/models/project_services/gemnasium_service.rb
View file @
d57e809c
...
...
@@ -42,9 +42,12 @@ class GemnasiumService < Service
]
end
def
supported_events
%w(push)
end
def
execute
(
data
)
object_kind
=
data
[
:object_kind
]
return
unless
object_kind
==
"push"
return
unless
supported_events
.
include?
(
data
[
:object_kind
])
Gemnasium
::
GitlabService
.
execute
(
ref:
data
[
:ref
],
...
...
app/models/project_services/gitlab_ci_service.rb
View file @
d57e809c
...
...
@@ -30,9 +30,12 @@ class GitlabCiService < CiService
hook
.
save
end
def
supported_events
%w(push tag_push)
end
def
execute
(
data
)
object_kind
=
data
[
:object_kind
]
return
unless
%w(push tag_push)
.
include?
(
object_kind
)
return
unless
supported_events
.
include?
(
data
[
:object_kind
])
service_hook
.
execute
(
data
)
end
...
...
app/models/project_services/hipchat_service.rb
View file @
d57e809c
...
...
@@ -44,9 +44,12 @@ class HipchatService < Service
]
end
def
supported_events
%w(push)
end
def
execute
(
data
)
object_kind
=
data
[
:object_kind
]
return
unless
object_kind
==
"push"
return
unless
supported_events
.
include?
(
data
[
:object_kind
])
gate
[
room
].
send
(
'GitLab'
,
create_message
(
data
))
end
...
...
app/models/project_services/issue_tracker_service.rb
View file @
d57e809c
...
...
@@ -69,9 +69,12 @@ class IssueTrackerService < Service
end
end
def
supported_events
%w(push)
end
def
execute
(
data
)
object_kind
=
data
[
:object_kind
]
return
unless
object_kind
==
"push"
return
unless
supported_events
.
include?
(
data
[
:object_kind
])
message
=
"
#{
self
.
type
}
was unable to reach
#{
self
.
project_url
}
. Check the url and try again."
result
=
false
...
...
app/models/project_services/pivotaltracker_service.rb
View file @
d57e809c
...
...
@@ -41,9 +41,12 @@ class PivotaltrackerService < Service
]
end
def
supported_events
%w(push)
end
def
execute
(
data
)
object_kind
=
data
[
:object_kind
]
return
unless
object_kind
==
"push"
return
unless
supported_events
.
include?
(
data
[
:object_kind
])
url
=
'https://www.pivotaltracker.com/services/v5/source_commits'
data
[
:commits
].
each
do
|
commit
|
...
...
app/models/project_services/pushover_service.rb
View file @
d57e809c
...
...
@@ -80,9 +80,12 @@ class PushoverService < Service
]
end
def
supported_events
%w(push)
end
def
execute
(
data
)
object_kind
=
data
[
:object_kind
]
return
unless
object_kind
==
"push"
return
unless
supported_events
.
include?
(
data
[
:object_kind
])
ref
=
data
[
:ref
].
gsub
(
'refs/heads/'
,
''
)
before
=
data
[
:before
]
...
...
app/models/project_services/slack_service.rb
View file @
d57e809c
...
...
@@ -42,7 +42,12 @@ class SlackService < Service
]
end
def
supported_events
%w(push issue merge_request)
end
def
execute
(
data
)
return
unless
supported_events
.
include?
(
data
[
:object_kind
])
return
unless
webhook
.
present?
object_kind
=
data
[
:object_kind
]
...
...
app/models/project_services/teamcity_service.rb
View file @
d57e809c
...
...
@@ -61,6 +61,10 @@ class TeamcityService < CiService
'teamcity'
end
def
supported_events
%w(push)
end
def
fields
[
{
type:
'text'
,
name:
'teamcity_url'
,
...
...
@@ -120,8 +124,7 @@ class TeamcityService < CiService
end
def
execute
(
data
)
object_kind
=
data
[
:object_kind
]
return
unless
object_kind
==
"push"
return
unless
supported_events
.
include?
(
data
[
:object_kind
])
auth
=
{
username:
username
,
...
...
app/models/service.rb
View file @
d57e809c
...
...
@@ -80,6 +80,10 @@ class Service < ActiveRecord::Base
[]
end
def
supported_events
%w(push tag_push issue merge_request)
end
def
execute
# implement inside child
end
...
...
@@ -105,6 +109,8 @@ class Service < ActiveRecord::Base
end
def
async_execute
(
data
)
return
unless
supported_events
.
include?
(
data
[
:object_kind
])
Sidekiq
::
Client
.
enqueue
(
ProjectServiceWorker
,
id
,
data
)
end
...
...
app/views/admin/services/_form.html.haml
View file @
d57e809c
...
...
@@ -14,6 +14,43 @@
=
preserve
do
=
markdown
@service
.
help
.form-group
=
f
.
label
:url
,
"Trigger"
,
class:
'control-label'
-
if
@service
.
supported_events
.
length
>
1
.col-sm-10
-
if
@service
.
supported_events
.
include?
(
"push"
)
%div
=
f
.
check_box
:push_events
,
class:
'pull-left'
.prepend-left-20
=
f
.
label
:push_events
,
class:
'list-label'
do
%strong
Push events
%p
.light
This url will be triggered by a push to the repository
-
if
@service
.
supported_events
.
include?
(
"tag_push"
)
%div
=
f
.
check_box
:tag_push_events
,
class:
'pull-left'
.prepend-left-20
=
f
.
label
:tag_push_events
,
class:
'list-label'
do
%strong
Tag push events
%p
.light
This url will be triggered when a new tag is pushed to the repository
-
if
@service
.
supported_events
.
include?
(
"issue"
)
%div
=
f
.
check_box
:issues_events
,
class:
'pull-left'
.prepend-left-20
=
f
.
label
:issues_events
,
class:
'list-label'
do
%strong
Issues events
%p
.light
This url will be triggered when an issue is created
-
if
@service
.
supported_events
.
include?
(
"merge_request"
)
%div
=
f
.
check_box
:merge_requests_events
,
class:
'pull-left'
.prepend-left-20
=
f
.
label
:merge_requests_events
,
class:
'list-label'
do
%strong
Merge Request events
%p
.light
This url will be triggered when a merge request is created
-
@service
.
fields
.
each
do
|
field
|
-
name
=
field
[
:name
]
-
value
=
@service
.
send
(
name
)
unless
field
[
:type
]
==
'password'
...
...
app/views/projects/services/_form.html.haml
View file @
d57e809c
...
...
@@ -29,7 +29,9 @@
.form-group
=
f
.
label
:url
,
"Trigger"
,
class:
'control-label'
-
if
@service
.
supported_events
.
length
>
1
.col-sm-10
-
if
@service
.
supported_events
.
include?
(
"push"
)
%div
=
f
.
check_box
:push_events
,
class:
'pull-left'
.prepend-left-20
...
...
@@ -37,6 +39,7 @@
%strong
Push events
%p
.light
This url will be triggered by a push to the repository
-
if
@service
.
supported_events
.
include?
(
"tag_push"
)
%div
=
f
.
check_box
:tag_push_events
,
class:
'pull-left'
.prepend-left-20
...
...
@@ -44,6 +47,7 @@
%strong
Tag push events
%p
.light
This url will be triggered when a new tag is pushed to the repository
-
if
@service
.
supported_events
.
include?
(
"issue"
)
%div
=
f
.
check_box
:issues_events
,
class:
'pull-left'
.prepend-left-20
...
...
@@ -51,6 +55,7 @@
%strong
Issues events
%p
.light
This url will be triggered when an issue is created
-
if
@service
.
supported_events
.
include?
(
"merge_request"
)
%div
=
f
.
check_box
:merge_requests_events
,
class:
'pull-left'
.prepend-left-20
...
...
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