Set pipeline config source attribute in a build step
This commit is contained in:
parent
54f490a455
commit
eedf43d69b
|
@ -18,6 +18,8 @@ module Gitlab
|
||||||
pipeline_schedule: @command.schedule,
|
pipeline_schedule: @command.schedule,
|
||||||
protected: protected_ref?
|
protected: protected_ref?
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@pipeline.set_config_source
|
||||||
end
|
end
|
||||||
|
|
||||||
def break?
|
def break?
|
||||||
|
|
|
@ -20,7 +20,7 @@ describe Gitlab::Ci::Pipeline::Chain::Build do
|
||||||
let(:step) { described_class.new(pipeline, command) }
|
let(:step) { described_class.new(pipeline, command) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
stub_ci_pipeline_to_return_yaml_file
|
stub_repository_ci_yaml_file(sha: anything)
|
||||||
|
|
||||||
step.perform!
|
step.perform!
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe Ci::CreatePipelineService do
|
||||||
let(:ref_name) { 'refs/heads/master' }
|
let(:ref_name) { 'refs/heads/master' }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
stub_ci_pipeline_to_return_yaml_file
|
stub_repository_ci_yaml_file(sha: anything)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#execute' do
|
describe '#execute' do
|
||||||
|
@ -44,6 +44,7 @@ describe Ci::CreatePipelineService do
|
||||||
expect(pipeline).to eq(project.pipelines.last)
|
expect(pipeline).to eq(project.pipelines.last)
|
||||||
expect(pipeline).to have_attributes(user: user)
|
expect(pipeline).to have_attributes(user: user)
|
||||||
expect(pipeline).to have_attributes(status: 'pending')
|
expect(pipeline).to have_attributes(status: 'pending')
|
||||||
|
expect(pipeline.repository_source?).to be true
|
||||||
expect(pipeline.builds.first).to be_kind_of(Ci::Build)
|
expect(pipeline.builds.first).to be_kind_of(Ci::Build)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,12 @@ module StubGitlabCalls
|
||||||
allow_any_instance_of(Ci::Pipeline).to receive(:ci_yaml_file) { ci_yaml }
|
allow_any_instance_of(Ci::Pipeline).to receive(:ci_yaml_file) { ci_yaml }
|
||||||
end
|
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
|
def stub_ci_builds_disabled
|
||||||
allow_any_instance_of(Project).to receive(:builds_enabled?).and_return(false)
|
allow_any_instance_of(Project).to receive(:builds_enabled?).and_return(false)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue