Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 17:34:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 17:34:42 +0300
commit9f46488805e86b1bc341ea1620b866016c2ce5ed (patch)
treef9748c7e287041e37d6da49e0a29c9511dc34768 /app/finders/ci
parentdfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff)
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'app/finders/ci')
-rw-r--r--app/finders/ci/daily_build_group_report_results_finder.rb37
-rw-r--r--app/finders/ci/job_artifacts_finder.rb26
2 files changed, 63 insertions, 0 deletions
diff --git a/app/finders/ci/daily_build_group_report_results_finder.rb b/app/finders/ci/daily_build_group_report_results_finder.rb
new file mode 100644
index 00000000000..3c3c24c1479
--- /dev/null
+++ b/app/finders/ci/daily_build_group_report_results_finder.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+module Ci
+ class DailyBuildGroupReportResultsFinder
+ include Gitlab::Allowable
+
+ def initialize(current_user:, project:, ref_path:, start_date:, end_date:, limit: nil)
+ @current_user = current_user
+ @project = project
+ @ref_path = ref_path
+ @start_date = start_date
+ @end_date = end_date
+ @limit = limit
+ end
+
+ def execute
+ return none unless can?(current_user, :download_code, project)
+
+ Ci::DailyBuildGroupReportResult.recent_results(
+ {
+ project_id: project,
+ ref_path: ref_path,
+ date: start_date..end_date
+ },
+ limit: @limit
+ )
+ end
+
+ private
+
+ attr_reader :current_user, :project, :ref_path, :start_date, :end_date
+
+ def none
+ Ci::DailyBuildGroupReportResult.none
+ end
+ end
+end
diff --git a/app/finders/ci/job_artifacts_finder.rb b/app/finders/ci/job_artifacts_finder.rb
new file mode 100644
index 00000000000..808c159ced1
--- /dev/null
+++ b/app/finders/ci/job_artifacts_finder.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+module Ci
+ class JobArtifactsFinder
+ def initialize(project, params = {})
+ @project = project
+ @params = params
+ end
+
+ def execute
+ artifacts = @project.job_artifacts
+
+ sort(artifacts)
+ end
+
+ private
+
+ def sort_key
+ @params[:sort] || 'created_desc'
+ end
+
+ def sort(artifacts)
+ artifacts.order_by(sort_key)
+ end
+ end
+end