Add support for reading local inputs from a file
What does this MR do and why?
This code change adds support for including external input files in CI/CD pipeline configurations. Previously, pipeline inputs had to be defined directly in the main configuration file. Now users can organize their inputs by splitting them into separate files and including them using a new include section in the pipeline specification.
The implementation creates several new components: an include mapper that handles different types of file includes (currently supporting local files), an include processor that merges inputs from included files with inline inputs, and validation logic to ensure the included files are properly formatted. When processing a pipeline configuration, the system now checks if there are any included input files, loads their content, and merges those inputs with any directly specified inputs, giving priority to inline definitions when there are conflicts.
This enhancement improves organization and reusability of pipeline configurations by allowing teams to share common input definitions across multiple pipeline files rather than duplicating them.
We will work on a follow-up MR as part of the same issue to handle the inputs in config include files as discussed in !197684 (comment 2660845710)
References
Screenshots or screen recordings
Screen_Recording_2025-07-21_at_7.41.16_PM
How to set up and validate locally
- Create a separate inputs file -
inputs:
environment:
default: "staging"
options: ["development", "staging", "production"]
app_version:
default: "1.0.0"
replicas:
type: number
default: 3
- Use the below sample
.gitlab-ci.yml-
spec:
include:
- local: '/ci/inputs.yml'
inputs:
job_prefix:
description: "Prefix for job names (inline)"
default: "inline"
environment:
default: "production" # This should override external
---
$[[ inputs.job_prefix ]]-test:
script:
- echo "Environment (should be inline-production):" $[[ inputs.environment ]]
- echo "Job prefix (inline only):" $[[ inputs.job_prefix ]]
- echo "App version (from external):" $[[ inputs.app_version ]]
- echo "Replicas (from external):" $[[ inputs.replicas ]]
- The pipeline should run as expected.
- It should show the inputs all included of external file and inline in the
New Pipelinepage. - The pipeline should log the inputs as interpolated in the script from inline and external.
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.
Related to #415636 (closed)