Commit be56144a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'ci_yml_file' into 'master'

GitLab CI service sends gitlab-ci.yml file

See merge request !689
parents 1c328fa4 b931c11e
No related merge requests found
......@@ -39,6 +39,7 @@ v 7.12.0 (unreleased)
- Allow to configure a URL to show after sign out
- Add an option to automatically sign-in with an Omniauth provider
- 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
- Fix missing bullets when creating lists
......
......@@ -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
......
......@@ -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("issue#2", 'master')).to eq("http://ci.gitlab.org/projects/2/refs/master/commits/issue%232")}
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
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