Commit 7c2e0e1b authored by Stan Hu's avatar Stan Hu Committed by Fabio Pitino

Waive credit card validation if project has paid CI/CD minutes

Previously users working on a namespace on a free plan would generally
be required to add a credit card if they use shared runners. However,
free namespaces are not really free if the owner pays for add-on CI/CD
minutes. In these instances, we should treat these namespaces as we do
with Ultimate/Premium and not require credit card validation for users
who use them.

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/349835

Changelog: fixed
EE: true
parent 9e971c74
---
name: ci_skip_require_credit_card_for_addon_ci_minutes
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/77829
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/349841
milestone: '14.7'
type: development
group: group::fulfillment
default_enabled: false
......@@ -267,7 +267,9 @@ module EE
end
def ci_minutes_quota
@ci_minutes_quota ||= ::Ci::Minutes::Quota.new(self)
strong_memoize(:ci_minutes_quota) do
::Ci::Minutes::Quota.new(self)
end
end
def new_monthly_ci_minutes_enabled?
......
......@@ -473,6 +473,10 @@ module EE
return false unless created_after_credit_card_release_day?(project)
root_namespace = project.root_namespace
ci_quota = root_namespace.ci_minutes_quota
return false if ci_quota.enabled? && ci_quota.limit.any_purchased? && ::Feature.enabled?(:ci_skip_require_credit_card_for_addon_ci_minutes, project, default_enabled: :yaml)
if root_namespace.free_plan?
::Feature.enabled?(:ci_require_credit_card_on_free_plan, project, default_enabled: :yaml)
elsif root_namespace.trial?
......
This diff is collapsed.
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