Initial reactive cache implementation for pipeline inputs
What does this MR do and why?
This MR implements reactive caching for the ciPipelineCreationInputs GraphQL query to improve performance when fetching pipeline inputs that may include external file references.
Problem: With the introduction of external files for pipeline inputs, the ciPipelineCreationInputs GraphQL query can become slow due to external file fetching (local, project, remote, etc.). This is similar to the performance issue we encountered with prefill variables.
Solution: Following the same pattern used in Ci::ListConfigVariablesService, this MR adds ReactiveCaching to Ci::PipelineCreation::FindPipelineInputsService. This caches the pipeline inputs calculation results, preventing repeated slow external file fetches.
References
- Caching ciPipelineCreationInputs (#581342) • Sahil Sharma • 18.9
- Feature flag rollout: [FF] `ci_pipeline_inputs_reactive_cache` -- Int... (#587022)
- Related pattern:
app/services/ci/list_config_variables_service.rb
How to set up and validate locally
Setup
-
Create a test project with pipeline inputs:
Create a
.gitlab-ci.ymlwith inputs:spec: inputs: environment: type: string default: "production" deploy_enabled: type: boolean default: true stages: - deploy deploy: stage: deploy script: - echo "Deploying to $[[ inputs.environment ]]" rules: - if: $[[ inputs.deploy_enabled ]] -
Enable the feature flag:
# In Rails console Feature.enable(:ci_pipeline_inputs_reactive_cache)
Validation
-
Test cache miss behavior (default - silent):
query { project(fullPath: "your/project") { ciPipelineCreationInputs(ref: "main") { name default required } } }- First request returns
null(cache miss, worker enqueued) - Subsequent requests return the cached inputs
- First request returns
-
Test cache miss behavior (fail on miss):
- Reset the existing cache by updating the inputs in
.gitlab-ci.ymlfile
query { project(fullPath: "your/project") { ciPipelineCreationInputs(ref: "main", failOnCacheMiss: true) { name default required } } }- Returns error: "Failed to retrieve pipeline inputs from cache." on cache miss
- Reset the existing cache by updating the inputs in
-
Test with feature flag disabled:
Feature.disable(:ci_pipeline_inputs_reactive_cache)- Query should return inputs directly without caching (original behavior)
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.