Commit 7e05f3b7 authored by Shinya Maeda's avatar Shinya Maeda
Browse files

Use source ref for pipeline webhook

When user uses Pipelines for merge requests, the pipeline is a run on
a merge request ref instead of branch ref. However, we should send
source ref as a webhook in order to respect the original behavior.
parent 2b8d597f
title: Use source ref in pipeline webhook
merge_request: 28772
type: fixed
......@@ -19,7 +19,7 @@ def build(pipeline)
def hook_attrs(pipeline)
ref: pipeline.ref,
ref: pipeline.source_ref,
tag: pipeline.tag,
sha: pipeline.sha,
before_sha: pipeline.before_sha,
......@@ -50,5 +50,14 @@
it { expect(attributes[:variables]).to be_a(Array) }
it { expect(attributes[:variables]).to contain_exactly({ key: 'TRIGGER_KEY_1', value: 'TRIGGER_VALUE_1' }) }
context 'when pipeline is a detached merge request pipeline' do
let(:merge_request) { create(:merge_request, :with_detached_merge_request_pipeline) }
let(:pipeline) { merge_request.all_pipelines.first }
it 'returns a source ref' do
expect(attributes[:ref]).to eq(merge_request.source_branch)
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