From fea86fb8bf2339727de5e91ccf17ab105e993dca Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 10 Jan 2024 03:12:01 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../gitlab_com_derisk/enhanced_review_email.yml | 9 ++++ .../fog_google_list_objects_match_glob_support.rb | 52 ++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 config/feature_flags/gitlab_com_derisk/enhanced_review_email.yml create mode 100644 config/initializers/fog_google_list_objects_match_glob_support.rb (limited to 'config') diff --git a/config/feature_flags/gitlab_com_derisk/enhanced_review_email.yml b/config/feature_flags/gitlab_com_derisk/enhanced_review_email.yml new file mode 100644 index 00000000000..71bdc424ec2 --- /dev/null +++ b/config/feature_flags/gitlab_com_derisk/enhanced_review_email.yml @@ -0,0 +1,9 @@ +--- +name: enhanced_review_email +feature_issue_url: +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/141187 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/437582 +milestone: '16.8' +group: group::code review +type: gitlab_com_derisk +default_enabled: false diff --git a/config/initializers/fog_google_list_objects_match_glob_support.rb b/config/initializers/fog_google_list_objects_match_glob_support.rb new file mode 100644 index 00000000000..37eacf33743 --- /dev/null +++ b/config/initializers/fog_google_list_objects_match_glob_support.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# We force require this to trigger the autoload and so that our monkeypatch will +# be applied in correct order, which is only after the class is loaded. +require 'fog/storage/google_json/requests/list_objects' + +# +# Monkey patching the list_objects to support match_glob parameter +# See https://github.com/fog/fog-google/issues/614 +# +module Fog + module Storage + class GoogleJSON + class Real + # This an identical copy of + # https://github.com/fog/fog-google/blob/v1.19.0/lib/fog/storage/google_json/requests/list_objects.rb + # with just match_glob added to the allowed_opts + def list_objects(bucket, options = {}) + # rubocop: disable Style/PercentLiteralDelimiters -- this is an exact copy of the original method, just added match_glob here. + allowed_opts = %i( + delimiter + match_glob + max_results + page_token + prefix + projection + versions + ) + # rubocop: enable Style/PercentLiteralDelimiters + + # rubocop: disable Gitlab/ModuleWithInstanceVariables -- this is an exact copy of the original method + @storage_json.list_objects( + bucket, + **options.select { |k, _| allowed_opts.include? k } + ) + # rubocop: enable Gitlab/ModuleWithInstanceVariables + end + end + end + end +end + +# We just need to add the match_glob attribute support here +module Fog + module Storage + class GoogleJSON + class Files < Fog::Collection + attribute :match_glob, aliases: "matchGlob" + end + end + end +end -- cgit v1.2.3