summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-03-15 15:09:10 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-03-15 15:09:10 +0000
commitcb7f766437db0c483adf3c128e35c64237a2ef53 (patch)
tree0b9bd9fdedad14dd065d14d9198ce080fbbeb8a5 /lib
parent6a9ab27963fc1479fe7c78581b942c8dcce322e5 (diff)
downloadgitlab-ce-cb7f766437db0c483adf3c128e35c64237a2ef53.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/analytics/cycle_analytics/request_params.rb13
-rw-r--r--lib/gitlab/merge_requests/commit_message_generator.rb13
2 files changed, 24 insertions, 2 deletions
diff --git a/lib/gitlab/analytics/cycle_analytics/request_params.rb b/lib/gitlab/analytics/cycle_analytics/request_params.rb
index 623f9d8082d..af695c5cfa4 100644
--- a/lib/gitlab/analytics/cycle_analytics/request_params.rb
+++ b/lib/gitlab/analytics/cycle_analytics/request_params.rb
@@ -80,7 +80,7 @@ module Gitlab
direction: direction&.to_sym,
page: page,
end_event_filter: end_event_filter.to_sym,
- use_aggregated_data_collector: Feature.enabled?(:use_vsa_aggregated_tables, group || project, default_enabled: :yaml)
+ use_aggregated_data_collector: use_aggregated_backend?
}.merge(attributes.symbolize_keys.slice(*FINDER_PARAM_NAMES))
end
@@ -104,8 +104,13 @@ module Gitlab
private
+ def use_aggregated_backend?
+ group.present? && # for now it's only available on the group-level
+ aggregation.enabled &&
+ Feature.enabled?(:use_vsa_aggregated_tables, group, default_enabled: :yaml)
+ end
+
def aggregation_attributes
- aggregation = ::Analytics::CycleAnalytics::Aggregation.safe_create_for_group(group)
{
enabled: aggregation.enabled.to_s,
last_run_at: aggregation.last_incremental_run_at&.iso8601,
@@ -113,6 +118,10 @@ module Gitlab
}
end
+ def aggregation
+ @aggregation ||= ::Analytics::CycleAnalytics::Aggregation.safe_create_for_group(group)
+ end
+
def group_data_attributes
{
id: group.id,
diff --git a/lib/gitlab/merge_requests/commit_message_generator.rb b/lib/gitlab/merge_requests/commit_message_generator.rb
index 0515c17fe5d..ef5c63925c2 100644
--- a/lib/gitlab/merge_requests/commit_message_generator.rb
+++ b/lib/gitlab/merge_requests/commit_message_generator.rb
@@ -50,6 +50,19 @@ module Gitlab
.except(commit_author&.commit_email_or_default)
.map { |author_email, author_name| "Co-authored-by: #{author_name} <#{author_email}>" }
.join("\n")
+ end,
+ 'all_commits' => -> (merge_request, _, _) do
+ merge_request
+ .recent_commits
+ .without_merge_commits
+ .map do |commit|
+ if commit.safe_message&.bytesize&.>(100.kilobytes)
+ "* #{commit.title}\n\n-- Skipped commit body exceeding 100KiB in size."
+ else
+ "* #{commit.safe_message&.strip}"
+ end
+ end
+ .join("\n\n")
end
}.freeze