summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-02 17:26:19 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-02 17:26:19 +0200
commitd85a7437a5651a93fc20d9bf7f183293151adb77 (patch)
treead55a27b9b05e38fbbdcec072036bdd68662560e /app
parentc4cb563e986e9082228e7732f0f6554997f6fa33 (diff)
parentbe56144a3d08836bebb49865749aae8e26d74d1a (diff)
downloadgitlab-ce-d85a7437a5651a93fc20d9bf7f183293151adb77.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
Diffstat (limited to 'app')
-rw-r--r--app/models/project_services/gitlab_ci_service.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/project_services/gitlab_ci_service.rb b/app/models/project_services/gitlab_ci_service.rb
index 949a4d7111b..a9354754686 100644
--- a/app/models/project_services/gitlab_ci_service.rb
+++ b/app/models/project_services/gitlab_ci_service.rb
@@ -40,6 +40,12 @@ class GitlabCiService < CiService
def execute(data)
return unless supported_events.include?(data[:object_kind])
+ ci_yaml_file = ci_yaml_file(data)
+
+ if ci_yaml_file
+ data.merge!(ci_yaml_file: ci_yaml_file)
+ end
+
service_hook.execute(data)
end
@@ -123,6 +129,14 @@ class GitlabCiService < CiService
private
+ def ci_yaml_file(data)
+ ref = data[:checkout_sha]
+ repo = project.repository
+ commit = repo.commit(ref)
+ blob = Gitlab::Git::Blob.find(repo, commit.id, ".gitlab-ci.yml")
+ blob && blob.data
+ end
+
def fork_registration_path
project_url.sub(/projects\/\d*/, "#{API_PREFIX}/forks")
end