diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /lib/tasks/gitlab/product_intelligence.rake | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'lib/tasks/gitlab/product_intelligence.rake')
-rw-r--r-- | lib/tasks/gitlab/product_intelligence.rake | 24 |
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 |