Commit 394217b4 authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'mc/feature/remove-ff-reset-ci-minutes-all-namespaces' into 'master'

Remove reset_ci_minutes_for_all_namespaces FF

Closes #234067

See merge request gitlab-org/gitlab!40396
parents cbddbc3b 9925166e
...@@ -23,7 +23,6 @@ class ProjectStatistics < ApplicationRecord ...@@ -23,7 +23,6 @@ class ProjectStatistics < ApplicationRecord
scope :for_project_ids, ->(project_ids) { where(project_id: project_ids) } scope :for_project_ids, ->(project_ids) { where(project_id: project_ids) }
scope :for_namespaces, -> (namespaces) { where(namespace: namespaces) } scope :for_namespaces, -> (namespaces) { where(namespace: namespaces) }
scope :with_any_ci_minutes_used, -> { where.not(shared_runners_seconds: 0) }
def total_repository_size def total_repository_size
repository_size + lfs_objects_size repository_size + lfs_objects_size
......
...@@ -6,7 +6,6 @@ class NamespaceStatistics < ApplicationRecord ...@@ -6,7 +6,6 @@ class NamespaceStatistics < ApplicationRecord
validates :namespace, presence: true validates :namespace, presence: true
scope :for_namespaces, -> (namespaces) { where(namespace: namespaces) } scope :for_namespaces, -> (namespaces) { where(namespace: namespaces) }
scope :with_any_ci_minutes_used, -> { where.not(shared_runners_seconds: 0) }
def shared_runners_minutes(include_extra: true) def shared_runners_minutes(include_extra: true)
minutes = shared_runners_seconds.to_i / 60 minutes = shared_runners_seconds.to_i / 60
......
...@@ -81,11 +81,9 @@ module Ci ...@@ -81,11 +81,9 @@ module Ci
def reset_shared_runners_seconds!(namespaces) def reset_shared_runners_seconds!(namespaces)
namespace_relation = NamespaceStatistics.for_namespaces(namespaces) namespace_relation = NamespaceStatistics.for_namespaces(namespaces)
namespace_relation = namespace_relation.with_any_ci_minutes_used unless ::Gitlab::Ci::Features.reset_ci_minutes_for_all_namespaces?
namespace_relation.update_all(shared_runners_seconds: 0, shared_runners_seconds_last_reset: Time.current) namespace_relation.update_all(shared_runners_seconds: 0, shared_runners_seconds_last_reset: Time.current)
project_relation = ::ProjectStatistics.for_namespaces(namespaces) project_relation = ::ProjectStatistics.for_namespaces(namespaces)
project_relation = project_relation.with_any_ci_minutes_used unless ::Gitlab::Ci::Features.reset_ci_minutes_for_all_namespaces?
project_relation.update_all(shared_runners_seconds: 0, shared_runners_seconds_last_reset: Time.current) project_relation.update_all(shared_runners_seconds: 0, shared_runners_seconds_last_reset: Time.current)
end end
......
---
title: Reset CI minutes for all namespaces every month.
merge_request: 40396
author:
type: changed
...@@ -68,10 +68,6 @@ module Gitlab ...@@ -68,10 +68,6 @@ module Gitlab
::Feature.enabled?(:ci_lint_creates_pipeline_with_dry_run, project, default_enabled: true) ::Feature.enabled?(:ci_lint_creates_pipeline_with_dry_run, project, default_enabled: true)
end end
def self.reset_ci_minutes_for_all_namespaces?
::Feature.enabled?(:reset_ci_minutes_for_all_namespaces, default_enabled: false)
end
def self.project_transactionless_destroy?(project) def self.project_transactionless_destroy?(project)
Feature.enabled?(:project_transactionless_destroy, project, default_enabled: false) Feature.enabled?(:project_transactionless_destroy, project, default_enabled: false)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment