summaryrefslogtreecommitdiff
path: root/tooling
diff options
context:
space:
mode:
Diffstat (limited to 'tooling')
-rwxr-xr-xtooling/bin/find_tests3
-rwxr-xr-xtooling/bin/parallel_rspec2
-rw-r--r--tooling/danger/product_intelligence.rb26
-rw-r--r--tooling/danger/project_helper.rb25
-rw-r--r--tooling/eslint-config/conditionally_ignore.js19
-rw-r--r--tooling/eslint-config/conditionally_ignore_ee.js5
-rw-r--r--tooling/lib/tooling/kubernetes_client.rb7
7 files changed, 40 insertions, 47 deletions
diff --git a/tooling/bin/find_tests b/tooling/bin/find_tests
index 2c0e7ae2c53..97fadf406fe 100755
--- a/tooling/bin/find_tests
+++ b/tooling/bin/find_tests
@@ -5,9 +5,10 @@ require 'gitlab'
require 'test_file_finder'
gitlab_token = ENV.fetch('DANGER_GITLAB_API_TOKEN', '')
+gitlab_endpoint = ENV.fetch('CI_API_V4_URL')
Gitlab.configure do |config|
- config.endpoint = 'https://gitlab.com/api/v4'
+ config.endpoint = gitlab_endpoint
config.private_token = gitlab_token
end
diff --git a/tooling/bin/parallel_rspec b/tooling/bin/parallel_rspec
index a706df69a1e..06e5603a6b8 100755
--- a/tooling/bin/parallel_rspec
+++ b/tooling/bin/parallel_rspec
@@ -16,4 +16,4 @@ OptionParser.new do |opts|
end
end.parse!
-Tooling::ParallelRSpecRunner.run(options)
+Tooling::ParallelRSpecRunner.run(**options)
diff --git a/tooling/danger/product_intelligence.rb b/tooling/danger/product_intelligence.rb
index 2c005b70de0..9eab611ec68 100644
--- a/tooling/danger/product_intelligence.rb
+++ b/tooling/danger/product_intelligence.rb
@@ -43,11 +43,7 @@ module Tooling
tracking_changed_files = all_changed_files & TRACKING_FILES
usage_data_changed_files = all_changed_files.grep(%r{(usage_data)})
- usage_data_changed_files + tracking_changed_files + metrics_changed_files + dictionary_changed_file + snowplow_changed_files
- end
-
- def need_dictionary_changes?
- required_dictionary_update_changed_files.any? && dictionary_changed_file.empty?
+ usage_data_changed_files + tracking_changed_files + metrics_changed_files + snowplow_changed_files
end
private
@@ -56,10 +52,6 @@ module Tooling
helper.all_changed_files
end
- def dictionary_changed_file
- all_changed_files.grep(%r{(doc/development/usage_ping/dictionary\.md)})
- end
-
def metrics_changed_files
all_changed_files.grep(%r{((ee/)?config/metrics/.*\.yml)})
end
@@ -84,22 +76,6 @@ module Tooling
matching_files?(file, extension: '.haml', pattern: %r{data: \{ track})
end
end
-
- def required_dictionary_update_changed_files
- dictionary_pattern = Regexp.union(
- 'key_path:',
- 'description:',
- 'product_section:',
- 'product_stage:',
- 'product_group:',
- 'status:',
- 'tier:'
- )
-
- metrics_changed_files.select do |file|
- matching_files?(file, extension: '.yml', pattern: dictionary_pattern)
- end
- end
end
end
end
diff --git a/tooling/danger/project_helper.rb b/tooling/danger/project_helper.rb
index 8151e074096..07daf249023 100644
--- a/tooling/danger/project_helper.rb
+++ b/tooling/danger/project_helper.rb
@@ -39,8 +39,7 @@ module Tooling
%r{\A(ee/)?config/feature_flags/} => :feature_flag,
- %r{\Adoc/development/usage_ping/dictionary\.md\z} => [:docs, :product_intelligence],
- %r{\Adoc/.*(\.(md|png|gif|jpg))\z} => :docs,
+ %r{\Adoc/.*(\.(md|png|gif|jpg|yml))\z} => :docs,
%r{\A(CONTRIBUTING|LICENSE|MAINTENANCE|PHILOSOPHY|PROCESS|README)(\.md)?\z} => :docs,
%r{\Adata/whats_new/} => :docs,
@@ -74,7 +73,7 @@ module Tooling
%r{(\A|/)(
\.gitlab/ci/frontend\.gitlab-ci\.yml
- )\z}x => %i[frontend engineering_productivity],
+ )\z}x => %i[frontend tooling],
%r{\A(ee/)?db/(geo/)?(migrate|post_migrate)/} => [:database, :migration],
%r{\A(ee/)?db/(?!fixtures)[^/]+} => [:database],
@@ -84,16 +83,16 @@ module Tooling
%r{\A(ee/)?app/finders/} => [:database, :backend],
%r{\Arubocop/cop/migration(/|\.rb)} => :database,
- %r{\A(\.gitlab-ci\.yml\z|\.gitlab\/ci)} => :engineering_productivity,
- %r{\A\.codeclimate\.yml\z} => :engineering_productivity,
- %r{\Alefthook.yml\z} => :engineering_productivity,
- %r{\A\.editorconfig\z} => :engineering_productivity,
- %r{Dangerfile\z} => :engineering_productivity,
- %r{\A(ee/)?(danger/|tooling/danger/)} => :engineering_productivity,
- %r{\A(ee/)?scripts/} => :engineering_productivity,
- %r{\Atooling/} => :engineering_productivity,
- %r{(CODEOWNERS)} => :engineering_productivity,
- %r{(tests.yml)} => :engineering_productivity,
+ %r{\A(\.gitlab-ci\.yml\z|\.gitlab\/ci)} => :tooling,
+ %r{\A\.codeclimate\.yml\z} => :tooling,
+ %r{\Alefthook.yml\z} => :tooling,
+ %r{\A\.editorconfig\z} => :tooling,
+ %r{Dangerfile\z} => :tooling,
+ %r{\A(ee/)?(danger/|tooling/danger/)} => :tooling,
+ %r{\A(ee/)?scripts/} => :tooling,
+ %r{\Atooling/} => :tooling,
+ %r{(CODEOWNERS)} => :tooling,
+ %r{(tests.yml)} => :tooling,
%r{\Alib/gitlab/ci/templates} => :ci_template,
diff --git a/tooling/eslint-config/conditionally_ignore.js b/tooling/eslint-config/conditionally_ignore.js
new file mode 100644
index 00000000000..6132c1f52f4
--- /dev/null
+++ b/tooling/eslint-config/conditionally_ignore.js
@@ -0,0 +1,19 @@
+/* eslint-disable import/no-commonjs */
+
+const IS_EE = require('../../config/helpers/is_ee_env');
+const IS_JH = require('../../config/helpers/is_jh_env');
+
+const allPatterns = [
+ {
+ ignore: !IS_EE,
+ pattern: 'ee/**/*.*',
+ },
+ {
+ ignore: !IS_JH,
+ pattern: 'jh/**/*.*',
+ },
+];
+
+const ignorePatterns = allPatterns.filter((x) => x.ignore).map((x) => x.pattern);
+
+module.exports = { ignorePatterns };
diff --git a/tooling/eslint-config/conditionally_ignore_ee.js b/tooling/eslint-config/conditionally_ignore_ee.js
deleted file mode 100644
index e5e3c8013f4..00000000000
--- a/tooling/eslint-config/conditionally_ignore_ee.js
+++ /dev/null
@@ -1,5 +0,0 @@
-/* eslint-disable import/no-commonjs */
-
-const IS_EE = require('../../config/helpers/is_ee_env');
-
-module.exports = IS_EE ? {} : { ignorePatterns: ['ee/**/*.*'] };
diff --git a/tooling/lib/tooling/kubernetes_client.rb b/tooling/lib/tooling/kubernetes_client.rb
index 12c4ee0039f..1d7b924e2c3 100644
--- a/tooling/lib/tooling/kubernetes_client.rb
+++ b/tooling/lib/tooling/kubernetes_client.rb
@@ -142,10 +142,13 @@ module Tooling
def resources_created_before_date(response, date)
items = JSON.parse(response)['items'] # rubocop:disable Gitlab/Json
- items.filter_map do |item|
+ items.each_with_object([]) do |item, result|
item_created_at = Time.parse(item.dig('metadata', 'creationTimestamp'))
- item.dig('metadata', 'name') if item_created_at < date
+ if item_created_at < date
+ resource_name = item.dig('metadata', 'name')
+ result << resource_name
+ end
end
rescue ::JSON::ParserError => ex
puts "Ignoring this JSON parsing error: #{ex}\n\nResponse was:\n#{response}" # rubocop:disable Rails/Output