Seed the job variable count limit behind a feature flag
What does this MR do and why?
Sets the ci_job_variables_count plan limit to 200 on GitLab.com, and puts the job variable limits behind the ci_job_variable_limits feature flag. The limits are checked when a user runs or retries a manual job with variables.
The seed sets the limit on free, bronze, silver, premium, gold, ultimate, ultimate_trial, ultimate_trial_paid_customer, premium_trial and opensource.
- It runs only when
Gitlab.com?is true, so GitLab Self-Managed and GitLab Dedicated do not change. defaultis left out. On GitLab.com a namespace without a subscription falls back tofree, so this leaves no gap.early_adopteris left out. The internal note on this MR has the reason, and the usage that supports200.- It is a post-deployment migration, so the flag is deployed before the limit is set.
- It runs without a transaction. On GitLab.com,
create_or_update_plan_limitalso upserts theplansrow, so each call writes two tables, and the multiple-locks check rejects that in one transaction. Each upsert is idempotent, so a partial run can be repeated.
Feature flag
ci_job_variable_limits is a beta flag, enabled by default, with the top-level namespace as actor. It gates the count check and both size checks for job variables. Turning it off through ChatOps is faster than setting a plan limit back to 0 on GitLab.com.
With the flag off, a request over a limit is accepted. Every request over a limit is logged as Job variables exceed a plan limit, and extra.rejected shows whether it was blocked.
The flag is already set to false on GitLab.com, before this MR is merged. Flag state is stored by name, so it can be set before the flag definition is deployed, and a stored state wins over default_enabled. The commands are in the rollout issue. After this MR is deployed:
- On GitLab.com, nothing is blocked until the flag is enabled through the rollout issue. This includes the size checks, which are enforced today. The
rejected: falselogs show what would be blocked. - On GitLab Self-Managed and GitLab Dedicated, the flag is enabled by default, so the size checks stay enforced. The count limit stays
0there, so nothing changes.
The GitLab.com docs already list 200 for job variables, so the docs change only adds the flag history.
References
- https://gitlab.com/gitlab-org/gitlab/-/work_items/613417 (confidential)
- https://gitlab.com/groups/gitlab-org/-/work_items/23230
- #640709, the flag rollout issue
- !254701 (merged), which added the column and the checks
Screenshots or screen recordings
Not applicable. No UI change.
How to set up and validate locally
- Run
bin/rails db:migratewithoutGITLAB_SIMULATE_SAAS. The seed changes nothing. - Run
bin/rails db:migrate:down:main VERSION=20261117134520, thenGITLAB_SIMULATE_SAAS=1 bin/rails db:migrate. - In
GITLAB_SIMULATE_SAAS=1 bin/rails console, check the values:Plan.all.map { |p| [p.name, p.actual_limits.ci_job_variables_count] }. The seeded plans show200anddefaultshows0. - Run
GITLAB_SIMULATE_SAAS=1 bin/rails db:migrate:down:main VERSION=20261117134520and check that the seeded plans show0again. - Set
Plan.default.actual_limits.update!(ci_job_variables_count: 1)and run a manual job with two variables. The job does not run. - Run
Feature.disable(:ci_job_variable_limits)and run the job again. The job runs, andlog/application_json.loghas aJob variables exceed a plan limitentry with"rejected":false.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.