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>2023-10-17 15:10:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-10-17 15:10:51 +0300
commit6081c1224414da0b6bf033c14a2b7c4dff3c0b5d (patch)
tree9e6a1053aaef754fdc712f1b203621ec0b3f82c4 /tooling
parent550096a3bf94b5d8e2b74dc8f94fbb0c579a7313 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'tooling')
-rw-r--r--tooling/danger/config_files.rb2
-rw-r--r--tooling/danger/feature_flag.rb6
-rw-r--r--tooling/danger/saas_feature.rb49
3 files changed, 51 insertions, 6 deletions
diff --git a/tooling/danger/config_files.rb b/tooling/danger/config_files.rb
index 1b09da6c8c9..eacb4263964 100644
--- a/tooling/danger/config_files.rb
+++ b/tooling/danger/config_files.rb
@@ -14,6 +14,8 @@ module Tooling
config/feature_flags
config/metrics
config/events
+ ee/config/feature_flags
+ ee/config/saas_features
].freeze
def add_suggestion_for_missing_introduced_by_url
diff --git a/tooling/danger/feature_flag.rb b/tooling/danger/feature_flag.rb
index 3fb20c561af..da0b7053af1 100644
--- a/tooling/danger/feature_flag.rb
+++ b/tooling/danger/feature_flag.rb
@@ -15,12 +15,6 @@ module Tooling
files.select { |path| path =~ %r{\A(ee/)?config/feature_flags/} }.map { |path| Found.new(path) }
end
- # TODO: Move this to gitlab-dangerfiles helper
- # https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles/-/blob/master/lib/danger/plugins/internal/helper.rb
- def stage_label
- helper.mr_labels.find { |label| label.start_with?("devops::") }
- end
-
class Found
ATTRIBUTES = %w[name introduced_by_url rollout_issue_url milestone type group default_enabled].freeze
diff --git a/tooling/danger/saas_feature.rb b/tooling/danger/saas_feature.rb
new file mode 100644
index 00000000000..d30e8c6cf73
--- /dev/null
+++ b/tooling/danger/saas_feature.rb
@@ -0,0 +1,49 @@
+# frozen_string_literal: true
+
+require 'yaml'
+
+module Tooling
+ module Danger
+ module SaasFeature
+ # `change_type` can be:
+ # - :added
+ # - :modified
+ # - :deleted
+ def files(change_type:)
+ files = helper.public_send("#{change_type}_files") # rubocop:disable GitlabSecurity/PublicSend
+
+ files.filter_map { |path| path.start_with?('ee/config/saas_features/') && Found.new(path) }
+ end
+
+ class Found
+ ATTRIBUTES = %w[name introduced_by_url milestone group].freeze
+
+ attr_reader :path
+
+ def initialize(path)
+ @path = path
+ end
+
+ ATTRIBUTES.each do |attribute|
+ define_method(attribute) do
+ yaml[attribute]
+ end
+ end
+
+ def raw
+ @raw ||= File.read(path)
+ end
+
+ def group_match_mr_label?(mr_group_label)
+ mr_group_label == group
+ end
+
+ private
+
+ def yaml
+ @yaml ||= YAML.safe_load(raw)
+ end
+ end
+ end
+ end
+end