Add variables option to Ci::CreatePipelineService
This commit is contained in:
parent
0d70dd6c48
commit
2a9a01b955
2 changed files with 20 additions and 2 deletions
|
@ -24,6 +24,7 @@ module Ci
|
|||
ignore_skip_ci: ignore_skip_ci,
|
||||
save_incompleted: save_on_errors,
|
||||
seeds_block: block,
|
||||
variables: params[:variables_attributes],
|
||||
project: project,
|
||||
current_user: current_user)
|
||||
|
||||
|
|
|
@ -17,11 +17,13 @@ describe Ci::CreatePipelineService do
|
|||
after: project.commit.id,
|
||||
message: 'Message',
|
||||
ref: ref_name,
|
||||
trigger_request: nil)
|
||||
trigger_request: nil,
|
||||
variables: nil)
|
||||
params = { ref: ref,
|
||||
before: '00000000',
|
||||
after: after,
|
||||
commits: [{ message: message }] }
|
||||
commits: [{ message: message }],
|
||||
variables_attributes: variables }
|
||||
|
||||
described_class.new(project, user, params).execute(
|
||||
source, trigger_request: trigger_request)
|
||||
|
@ -545,5 +547,20 @@ describe Ci::CreatePipelineService do
|
|||
expect(pipeline.tag?).to be true
|
||||
end
|
||||
end
|
||||
|
||||
context 'when pipeline variables are specified' do
|
||||
let(:variables) do
|
||||
[{ key: 'first', secret_value: 'world' },
|
||||
{ key: 'second', secret_value: 'second_world' }]
|
||||
end
|
||||
|
||||
subject { execute_service(variables: variables) }
|
||||
|
||||
it 'creates a pipeline with specified variables' do
|
||||
expect(subject.variables.count).to eq(variables.count)
|
||||
expect(subject.variables.first.key).to eq(variables.first[:key])
|
||||
expect(subject.variables.last.secret_value).to eq(variables.last[:secret_value])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue