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

How to set up and validate locally

Setup

  1. Create a test project with pipeline inputs:

    Create a .gitlab-ci.yml with 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 ]]
  2. Enable the feature flag:

    # In Rails console
    Feature.enable(:ci_pipeline_inputs_reactive_cache)

Validation

  1. 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
  2. Test cache miss behavior (fail on miss):

    • Reset the existing cache by updating the inputs in .gitlab-ci.yml file
    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
  3. 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.

Edited by Sahil Sharma

Merge request reports

Loading