summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorJames Ramsay <james@jramsay.com.au>2018-04-01 17:16:35 -0400
committerJames Ramsay <james@jramsay.com.au>2018-04-27 11:00:52 +0100
commitb65fcc320d65367973a58a01618914056993541b (patch)
treed845d07c49dcba94ebb12781fb6effc2cdbd8ac4 /app
parentc73b5d31e680b175b2592d299c901bdcb43bca9f (diff)
downloadgitlab-ce-b65fcc320d65367973a58a01618914056993541b.tar.gz
Add sha filter to list pipelines
To find the pipeline for a specific sha requires scanning the list of all pipelines for a ref that contains the sha. This makes it hard to find the pipeline id needed to access a trace for a specific job run in the pipeline using the API.
Diffstat (limited to 'app')
-rw-r--r--app/finders/pipelines_finder.rb9
1 files changed, 9 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] })