Commit 73388007 authored by Shinya Maeda's avatar Shinya Maeda

Fix PipelineTriggerService to associate trigger_request with builds

parent 373ff978
...@@ -14,7 +14,7 @@ module Ci ...@@ -14,7 +14,7 @@ module Ci
pipeline = Ci::CreatePipelineService.new(project, trigger.owner, ref: params[:ref]) pipeline = Ci::CreatePipelineService.new(project, trigger.owner, ref: params[:ref])
.execute(:trigger, ignore_skip_ci: true) do |pipeline| .execute(:trigger, ignore_skip_ci: true) do |pipeline|
trigger.trigger_requests.create!(pipeline: pipeline) pipeline.trigger_requests.create!(trigger: trigger)
create_pipeline_variables!(pipeline) create_pipeline_variables!(pipeline)
end end
......
...@@ -34,6 +34,8 @@ describe Ci::PipelineTriggerService do ...@@ -34,6 +34,8 @@ describe Ci::PipelineTriggerService do
expect(result[:pipeline].ref).to eq('master') expect(result[:pipeline].ref).to eq('master')
expect(result[:pipeline].project).to eq(project) expect(result[:pipeline].project).to eq(project)
expect(result[:pipeline].user).to eq(trigger.owner) expect(result[:pipeline].user).to eq(trigger.owner)
expect([result[:pipeline].trigger_requests.last])
.to eq(result[:pipeline].builds.map(&:trigger_request).uniq)
expect(result[:status]).to eq(:success) expect(result[:status]).to eq(:success)
end end
......
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