Make Ci::JobDefinition config size limit configurable via admin setting

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Problem

Since GitLab 18.11 (!218219 (merged)), the compiled per-job config stored in p_ci_job_definitions is subject to a hardcoded 1 MiB size limit enforced by Ci::JobDefinition:

# app/models/ci/job_definition.rb
validates :config, json_schema: {
  filename: 'ci_job_definition_config',
  size_limit: 1.megabyte,
  detail_errors: true
}

When a job's compiled config (its options, yaml_variables, id_tokens, secrets, etc.) exceeds this limit, pipeline creation fails with:

Config is too large. Maximum size allowed is 1 MiB

This limit is not configurable — there is no admin setting, environment variable. It is also distinct from the existing max_yaml_size_bytes application setting, which only governs .gitlab-ci.yml parsing and has no effect here.

Prior to 18.11, oversized configs were validated in a soft mode that logged a warning but deleted the error in production, so pipelines that exceeded 1 MiB passed silently. The change to hard enforcement in 18.11 is a behavior change .

A common real-world trigger is passing a large base64-encoded binary (e.g. a zip file) as a pipeline input variable — the value gets interpolated into yaml_variables for every job that references it, causing each of those job definitions to exceed the limit.

Proposal

Introduce an admin application setting (analogous to max_yaml_size_bytes) to control the Ci::JobDefinition config size limit, for example ci_max_job_definition_config_size_bytes, with a default of 1 MiB to preserve current behavior.

This would allow self-managed administrators to raise the limit for their instance where their workloads legitimately require larger per-job configs, without requiring a GitLab upgrade or code change.

Acceptance criteria

  • A new admin setting ci_max_job_definition_config_size_bytes is added with a default of 1.megabyte
  • The size_limit in Ci::JobDefinition reads from this setting rather than a hardcoded literal
  • The setting is exposed in the Admin UI alongside other CI/CD limits (e.g. near max_yaml_size_bytes)
  • The setting is documented in the CI/CD limits documentation page
  • The error message ideally identifies which job's config is too large

Additional context

  • The Database/JsonbSizeLimit RuboCop rule exists to guard JSONB column size; 1 MiB is already generous relative to the typical 64 KB default for other JSONB columns. Any increase should be approached carefully with awareness of database impact.
  • A separate, lower-priority improvement would be surfacing the offending job name in the error message, since the current error gives no indication of which job triggered the failure.
Edited by 🤖 GitLab Bot 🤖