diff options
author | Shinya Maeda <shinya@gitlab.com> | 2019-04-02 14:07:11 +0700 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2019-04-02 15:55:06 +0700 |
commit | a04e1d5e32f7ae1740ba8b9daaf3f71a5048126c (patch) | |
tree | ce9b5458a09928c9827c1bc7e89ec57f97451a52 /app | |
parent | ba23d6377c650ecaac420c8085a2cd82737d3ced (diff) | |
download | gitlab-ce-a04e1d5e32f7ae1740ba8b9daaf3f71a5048126c.tar.gz |
Backport EE changeexpose-mr-pipeline-parameters-for-merge-widget-ce
This is for merge request pipelines
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/pipeline.rb | 8 | ||||
-rw-r--r-- | app/serializers/merge_request_widget_entity.rb | 1 | ||||
-rw-r--r-- | app/serializers/pipeline_entity.rb | 2 |
3 files changed, 3 insertions, 8 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index abac16a138d..01d96754518 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -206,10 +206,6 @@ module Ci triggered_by_merge_request(merge_request).for_source_sha(source_sha) end - scope :mergeable_merge_request_pipelines, -> (merge_request) do - triggered_by_merge_request(merge_request).where(target_sha: merge_request.target_branch_sha) - end - scope :triggered_for_branch, -> (ref) do where(source: branch_pipeline_sources).where(ref: ref, tag: false) end @@ -746,10 +742,6 @@ module Ci triggered_by_merge_request? && target_sha.present? end - def mergeable_merge_request_pipeline? - triggered_by_merge_request? && target_sha == merge_request.target_branch_sha - end - def merge_request_ref? MergeRequest.merge_request_ref?(ref) end diff --git a/app/serializers/merge_request_widget_entity.rb b/app/serializers/merge_request_widget_entity.rb index 2142ceb6122..d673f8ae896 100644 --- a/app/serializers/merge_request_widget_entity.rb +++ b/app/serializers/merge_request_widget_entity.rb @@ -20,6 +20,7 @@ class MergeRequestWidgetEntity < IssuableEntity end expose :squash expose :target_branch + expose :target_branch_sha expose :target_project_id expose :target_project_full_path do |merge_request| merge_request.project&.full_path diff --git a/app/serializers/pipeline_entity.rb b/app/serializers/pipeline_entity.rb index fba72410217..8fe5df81e6c 100644 --- a/app/serializers/pipeline_entity.rb +++ b/app/serializers/pipeline_entity.rb @@ -59,6 +59,8 @@ class PipelineEntity < Grape::Entity end expose :commit, using: CommitEntity + expose :source_sha, if: -> (pipeline, _) { pipeline.merge_request_pipeline? } + expose :target_sha, if: -> (pipeline, _) { pipeline.merge_request_pipeline? } expose :yaml_errors, if: -> (pipeline, _) { pipeline.has_yaml_errors? } expose :failure_reason, if: -> (pipeline, _) { pipeline.failure_reason? } do |pipeline| |