Fail pipeline creation when pipeline variables exceed the 10 MiB size limit

Summary

Pipeline variables are stored as a pipeline artifact, which has a 10 MiB size limit (Ci::PipelineArtifact::FILE_SIZE_LIMIT). When the total size of the pipeline variables is over this limit, the artifact is not saved, but the pipeline is still created. The jobs run without the pipeline variables, and the user sees no error.

Steps to reproduce

Create a pipeline with pipeline variables whose total size is over 10 MiB, for example one variable with a value just over 10 MiB.

What is the current bug behavior?

  • The pipeline is created successfully.
  • The pipeline variables are not saved, and the jobs run without them.
  • No error is shown.

What is the expected correct behavior?

Pipeline creation fails with a clear error:

Failed to build pipeline variables: total size exceeds the limit of 10 MiB

Proposal

Check the total size of the pipeline variables before building the artifact, and fail pipeline creation with a config_error if it is over the limit. Put the change behind the ci_enforce_pipeline_variables_total_size_limit beta feature flag, disabled by default.

Edited by Furkan Ayhan