diff options
author | James Ramsay <james@jramsay.com.au> | 2018-04-01 17:16:35 -0400 |
---|---|---|
committer | James Ramsay <james@jramsay.com.au> | 2018-04-01 17:16:35 -0400 |
commit | 3cab2ab1a8c8b7b7c908f599b796310bd589d985 (patch) | |
tree | 125193c4a22006fc678e50d928437a45b1ac28b3 | |
parent | 6b89ab116110f177ecb809adf429fe05f76e97f5 (diff) | |
download | gitlab-ce-jramsay-44880-filter-pipelines-by-sha.tar.gz |
Add sha filter to list pipelinesjramsay-44880-filter-pipelines-by-sha
-rw-r--r-- | app/finders/pipelines_finder.rb | 9 | ||||
-rw-r--r-- | lib/api/pipelines.rb | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/app/finders/pipelines_finder.rb b/app/finders/pipelines_finder.rb index f187a3b61fe..0a487839aff 100644 --- a/app/finders/pipelines_finder.rb +++ b/app/finders/pipelines_finder.rb @@ -14,6 +14,7 @@ class PipelinesFinder items = by_scope(items) items = by_status(items) items = by_ref(items) + items = by_sha(items) items = by_name(items) items = by_username(items) items = by_yaml_errors(items) @@ -69,6 +70,14 @@ class PipelinesFinder end end + def by_sha(items) + if params[:sha].present? + items.where(sha: params[:sha]) + else + items + end + end + def by_name(items) if params[:name].present? items.joins(:user).where(users: { name: params[:name] }) diff --git a/lib/api/pipelines.rb b/lib/api/pipelines.rb index d2b8b832e4e..735591fedd5 100644 --- a/lib/api/pipelines.rb +++ b/lib/api/pipelines.rb @@ -19,6 +19,7 @@ module API optional :status, type: String, values: HasStatus::AVAILABLE_STATUSES, desc: 'The status of pipelines' optional :ref, type: String, desc: 'The ref of pipelines' + optional :sha, type: String, desc: 'The sha of pipelines' optional :yaml_errors, type: Boolean, desc: 'Returns pipelines with invalid configurations' optional :name, type: String, desc: 'The name of the user who triggered pipelines' optional :username, type: String, desc: 'The username of the user who triggered pipelines' |