diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/build.rb | 5 | ||||
-rw-r--r-- | app/models/concerns/has_ref.rb | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 21863a8197d..3b34fe48683 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -25,7 +25,8 @@ module Ci belongs_to :erased_by, class_name: 'User' RUNNER_FEATURES = { - upload_multiple_artifacts: -> (build) { build.publishes_artifacts_reports? } + upload_multiple_artifacts: -> (build) { build.publishes_artifacts_reports? }, + refspecs: -> (build) { build.merge_request? } }.freeze has_one :deployment, as: :deployable, class_name: 'Deployment' @@ -464,6 +465,8 @@ module Ci def merge_request return @merge_request if defined?(@merge_request) + @merge_request ||= pipeline.merge_request if merge_request? + @merge_request ||= begin merge_requests = MergeRequest.includes(:latest_merge_request_diff) diff --git a/app/models/concerns/has_ref.rb b/app/models/concerns/has_ref.rb index a80e4a508aa..f16e879c264 100644 --- a/app/models/concerns/has_ref.rb +++ b/app/models/concerns/has_ref.rb @@ -36,14 +36,18 @@ module HasRef def refspecs spec = [] + if merge_request? + spec << "+#{merge_request.ref_path}:#{merge_request.ref_path}" + end + if git_depth > 0 - if branch? || merge_request? + if branch? spec << "+#{git_branch_ref}:refs/remotes/origin/#{ref}" elsif tag? spec << "+#{git_tag_ref}:#{git_tag_ref}" end else - if branch? || merge_request? || tag? + if branch? || tag? spec << '+refs/heads/*:refs/remotes/origin/*' spec << '+refs/tags/*:refs/tags/*' end |