summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-11 12:10:28 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-11 12:10:28 +0000
commite3190840bc2e05ed04a49869978a54b7b518edf1 (patch)
tree5424582e3fa6c48c6ac8ebb029969e6ac277487c /lib
parentc7ba7b997608a103a0a9165b2e5cef9530c4ef53 (diff)
downloadgitlab-ce-e3190840bc2e05ed04a49869978a54b7b518edf1.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/api/pipelines.rb15
-rw-r--r--lib/gitlab/background_migration/backfill_snippet_repositories.rb6
-rw-r--r--lib/gitlab/background_migration/remove_undefined_occurrence_confidence_level.rb13
-rw-r--r--lib/gitlab/git_access_snippet.rb7
4 files changed, 41 insertions, 0 deletions
diff --git a/lib/api/pipelines.rb b/lib/api/pipelines.rb
index 06f8920b37c..c09bca26a41 100644
--- a/lib/api/pipelines.rb
+++ b/lib/api/pipelines.rb
@@ -108,6 +108,21 @@ module API
present pipeline.variables, with: Entities::Variable
end
+ desc 'Gets the test report for a given pipeline' do
+ detail 'This feature was introduced in GitLab 13.0. Disabled by default behind feature flag `junit_pipeline_view`'
+ success TestReportEntity
+ end
+ params do
+ requires :pipeline_id, type: Integer, desc: 'The pipeline ID'
+ end
+ get ':id/pipelines/:pipeline_id/test_report' do
+ not_found! unless Feature.enabled?(:junit_pipeline_view, user_project)
+
+ authorize! :read_build, pipeline
+
+ present pipeline.test_reports, with: TestReportEntity
+ end
+
desc 'Deletes a pipeline' do
detail 'This feature was introduced in GitLab 11.6'
http_codes [[204, 'Pipeline was deleted'], [403, 'Forbidden']]
diff --git a/lib/gitlab/background_migration/backfill_snippet_repositories.rb b/lib/gitlab/background_migration/backfill_snippet_repositories.rb
index 148c25685ed..75bf0f78f77 100644
--- a/lib/gitlab/background_migration/backfill_snippet_repositories.rb
+++ b/lib/gitlab/background_migration/backfill_snippet_repositories.rb
@@ -100,6 +100,8 @@ module Gitlab
# migrate their snippets as well.
# In this scenario the migration bot user will be the one that will commit the files.
def commit_author(snippet)
+ return migration_bot_user if snippet_content_size_over_limit?(snippet)
+
if Gitlab::UserAccessSnippet.new(snippet.author, snippet: snippet).can_do_action?(:update_snippet)
snippet.author
else
@@ -119,6 +121,10 @@ module Gitlab
def set_file_path_error(error)
@invalid_path_error = error.is_a?(SnippetRepository::InvalidPathError)
end
+
+ def snippet_content_size_over_limit?(snippet)
+ snippet.content.size > Gitlab::CurrentSettings.snippet_size_limit
+ end
end
end
end
diff --git a/lib/gitlab/background_migration/remove_undefined_occurrence_confidence_level.rb b/lib/gitlab/background_migration/remove_undefined_occurrence_confidence_level.rb
new file mode 100644
index 00000000000..3920e8dc2de
--- /dev/null
+++ b/lib/gitlab/background_migration/remove_undefined_occurrence_confidence_level.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+# rubocop:disable Style/Documentation
+
+module Gitlab
+ module BackgroundMigration
+ class RemoveUndefinedOccurrenceConfidenceLevel
+ def perform(start_id, stop_id)
+ end
+ end
+ end
+end
+
+Gitlab::BackgroundMigration::RemoveUndefinedOccurrenceConfidenceLevel.prepend_if_ee('EE::Gitlab::BackgroundMigration::RemoveUndefinedOccurrenceConfidenceLevel')
diff --git a/lib/gitlab/git_access_snippet.rb b/lib/gitlab/git_access_snippet.rb
index a06eddab78f..3326b50ae67 100644
--- a/lib/gitlab/git_access_snippet.rb
+++ b/lib/gitlab/git_access_snippet.rb
@@ -128,5 +128,12 @@ module Gitlab
def check_custom_action(cmd)
nil
end
+
+ override :check_size_limit?
+ def check_size_limit?
+ return false if user&.migration_bot?
+
+ super
+ end
end
end