BigW Consortium Gitlab

Commit b931c11e by Valery Sizov

GitLab CI service sends gitlab-ci.yml file

parent 1c328fa4
...@@ -39,6 +39,7 @@ v 7.12.0 (unreleased) ...@@ -39,6 +39,7 @@ v 7.12.0 (unreleased)
- Allow to configure a URL to show after sign out - Allow to configure a URL to show after sign out
- Add an option to automatically sign-in with an Omniauth provider - Add an option to automatically sign-in with an Omniauth provider
- Better performance for web editor (switched from satellites to rugged) - Better performance for web editor (switched from satellites to rugged)
- GitLab CI service sends .gitlab-ci.yaml in each push call
v 7.11.4 v 7.11.4
- Fix missing bullets when creating lists - Fix missing bullets when creating lists
......
...@@ -40,6 +40,12 @@ class GitlabCiService < CiService ...@@ -40,6 +40,12 @@ class GitlabCiService < CiService
def execute(data) def execute(data)
return unless supported_events.include?(data[:object_kind]) 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) service_hook.execute(data)
end end
...@@ -123,6 +129,14 @@ class GitlabCiService < CiService ...@@ -123,6 +129,14 @@ class GitlabCiService < CiService
private 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 def fork_registration_path
project_url.sub(/projects\/\d*/, "#{API_PREFIX}/forks") project_url.sub(/projects\/\d*/, "#{API_PREFIX}/forks")
end end
......
...@@ -48,6 +48,21 @@ describe GitlabCiService do ...@@ -48,6 +48,21 @@ describe GitlabCiService do
it { expect(@service.build_page("2ab7834c", 'master')).to eq("http://ci.gitlab.org/projects/2/refs/master/commits/2ab7834c")} it { expect(@service.build_page("2ab7834c", 'master')).to eq("http://ci.gitlab.org/projects/2/refs/master/commits/2ab7834c")}
it { expect(@service.build_page("issue#2", 'master')).to eq("http://ci.gitlab.org/projects/2/refs/master/commits/issue%232")} it { expect(@service.build_page("issue#2", 'master')).to eq("http://ci.gitlab.org/projects/2/refs/master/commits/issue%232")}
end end
describe "execute" do
let(:user) { create(:user, username: 'username') }
let(:project) { create(:project, name: 'project') }
let(:push_sample_data) { Gitlab::PushDataBuilder.build_sample(project, user) }
it "calls ci_yaml_file" do
service_hook = double
service_hook.should_receive(:execute)
@service.should_receive(:service_hook).and_return(service_hook)
@service.should_receive(:ci_yaml_file).with(push_sample_data)
@service.execute(push_sample_data)
end
end
end end
describe "Fork registration" do describe "Fork registration" do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment