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:
Diffstat (limited to 'lib/tasks/gitlab/product_intelligence.rake')
-rw-r--r--lib/tasks/gitlab/product_intelligence.rake24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/tasks/gitlab/product_intelligence.rake b/lib/tasks/gitlab/product_intelligence.rake
new file mode 100644
index 00000000000..329cd9c8c2a
--- /dev/null
+++ b/lib/tasks/gitlab/product_intelligence.rake
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+namespace :gitlab do
+ namespace :product_intelligence do
+ # @example
+ # bundle exec rake gitlab:product_intelligence:activate_metrics MILESTONE=14.0
+
+ desc 'GitLab | Product Intelligence | Update milestone metrics status to data_available'
+ task activate_metrics: :environment do
+ milestone = ENV['MILESTONE']
+ raise "Please supply the MILESTONE env var".color(:red) unless milestone.present?
+
+ Gitlab::Usage::MetricDefinition.definitions.values.each do |metric|
+ next if metric.attributes[:milestone] != milestone || metric.attributes[:status] != 'implemented'
+
+ metric.attributes[:status] = 'data_available'
+ path = metric.path
+ File.open(path, "w") { |file| file << metric.to_h.deep_stringify_keys.to_yaml }
+ end
+
+ puts "Task completed successfully"
+ end
+ end
+end