summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-02-24 14:29:21 +0100
committerDouwe Maan <douwe@gitlab.com>2015-03-03 11:14:32 +0100
commitf13567edc4b9ce68179d12562a711540c8994206 (patch)
treeabea2216ed0df30a688c7d903814e1b20e1c24ad
parentd86c0cda24a76c9330b5fed59e857ce9e4150b9b (diff)
downloadgitlab-ce-f13567edc4b9ce68179d12562a711540c8994206.tar.gz
Only execute GitlabCiService for push events.
-rw-r--r--app/models/project_services/gitlab_ci_service.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/models/project_services/gitlab_ci_service.rb b/app/models/project_services/gitlab_ci_service.rb
index a64b24b5ef1..34a20f55792 100644
--- a/app/models/project_services/gitlab_ci_service.rb
+++ b/app/models/project_services/gitlab_ci_service.rb
@@ -22,8 +22,6 @@ class GitlabCiService < CiService
validates :project_url, presence: true, if: :activated?
validates :token, presence: true, if: :activated?
- delegate :execute, to: :service_hook, prefix: nil
-
after_save :compose_service_hook, if: :activated?
def compose_service_hook
@@ -32,6 +30,13 @@ class GitlabCiService < CiService
hook.save
end
+ def execute(data)
+ object_kind = data[:object_kind]
+ return unless object_kind == "push"
+
+ service_hook.execute(data)
+ end
+
def commit_status_path(sha)
project_url + "/commits/#{sha}/status.json?token=#{token}"
end