Commit 25b13eee authored by Matija Čupić's avatar Matija Čupić

Send only latest jobs in pipeline webhook

parent c9be3478
......@@ -13,7 +13,7 @@ module Gitlab
user: pipeline.user.try(:hook_attrs),
project: pipeline.project.hook_attrs(backward: false),
commit: pipeline.commit.try(:hook_attrs),
builds: pipeline.builds.map(&method(:build_hook_attrs))
builds: pipeline.builds.latest.map(&method(:build_hook_attrs))
}
end
......
......@@ -104,5 +104,16 @@ RSpec.describe Gitlab::DataBuilder::Pipeline do
expect(merge_request_attrs[:url]).to eq("http://localhost/#{merge_request.target_project.full_path}/-/merge_requests/#{merge_request.iid}")
end
end
context 'when pipeline has retried builds' do
before do
create(:ci_build, :retried, pipeline: pipeline)
end
it 'does not contain retried builds in payload' do
expect(data[:builds].count).to eq(1)
expect(build_data[:id]).to eq(build.id)
end
end
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