Set pipeline config source attribute in a build step

This commit is contained in:
Grzegorz Bizon 2017-10-11 14:48:28 +02:00
parent 54f490a455
commit eedf43d69b
4 changed files with 11 additions and 2 deletions

View File

@ -18,6 +18,8 @@ module Gitlab
pipeline_schedule: @command.schedule,
protected: protected_ref?
)
@pipeline.set_config_source
end
def break?

View File

@ -20,7 +20,7 @@ describe Gitlab::Ci::Pipeline::Chain::Build do
let(:step) { described_class.new(pipeline, command) }
before do
stub_ci_pipeline_to_return_yaml_file
stub_repository_ci_yaml_file(sha: anything)
step.perform!
end

View File

@ -8,7 +8,7 @@ describe Ci::CreatePipelineService do
let(:ref_name) { 'refs/heads/master' }
before do
stub_ci_pipeline_to_return_yaml_file
stub_repository_ci_yaml_file(sha: anything)
end
describe '#execute' do
@ -44,6 +44,7 @@ describe Ci::CreatePipelineService do
expect(pipeline).to eq(project.pipelines.last)
expect(pipeline).to have_attributes(user: user)
expect(pipeline).to have_attributes(status: 'pending')
expect(pipeline.repository_source?).to be true
expect(pipeline.builds.first).to be_kind_of(Ci::Build)
end

View File

@ -21,6 +21,12 @@ module StubGitlabCalls
allow_any_instance_of(Ci::Pipeline).to receive(:ci_yaml_file) { ci_yaml }
end
def stub_repository_ci_yaml_file(sha:, path: '.gitlab-ci.yml')
allow_any_instance_of(Repository)
.to receive(:gitlab_ci_yml_for).with(sha, path)
.and_return(gitlab_ci_yaml)
end
def stub_ci_builds_disabled
allow_any_instance_of(Project).to receive(:builds_enabled?).and_return(false)
end