Read inputs from a file
Related issue https://gitlab.com/gitlab-org/gitlab/-/issues/34202 ### Problem Users would like to run a pipeline that reads values from an interface as inputs ### Requirements * The users is responsible for the API endpoint being updated with the an up to date values. * GitLab should be able to hit that endpoint and receives that information to be used as part of our inputs interpolation so if the endpoint returns `{"id": "my_params", "my_value": "fgh", "another_one": "ijk", }`. Then `$[[ parameters.my_params.my_value ]]` will evaluate to `fgh`. ### Proposal Allow users to read inputs from a file in the following manner. ```yaml spec: include: # just like our standard include syntax - remote: https://example.com/inputs.yml inputs: # standard inputs ``` ```yaml spec: include: # just like our standard include syntax - local: ci/config/inputs.yml inputs: # standard inputs ``` The included file would look like this: ```yaml inputs: job-prefix: description: "Define a prefix for the job name" job-stage: default: test environment: options: ['test', 'staging', 'production'] ``` We will allow a mix and match between multiple input files and existing spec: input configuration ```yaml spec: include: # just like our standard include syntax - remote: https://example.com/inputs.yml - local: ci/config/inputs.yml inputs: # standard inputs job-prefix: description: "Define a prefix for the job name" job-stage: default: test environment: options: ['test', 'staging', 'production'] ``` <details><summary> WIP Proposal (not final)</summary> ```yaml # components/my_component: spec: inputs: my_static_value: my_dynamic_value_1: my_dynamic_value_2: --- test: script: - echo $[[ inputs.my_static_value ]] - echo $[[ inputs.my_dynamic_value_1 ]] - echo $[[ inputs.my_dynamic_value_2 ]] # my .gitlab-ci.yml include: - local: 'components/my_component' inputs: my_static_value: 1234 my_dynamic_value_1: $[[ repository.file('inputs.abc.yaml').my_dynamic_value ]] # Read input from a file my_dynamic_value_2: $[[ parameters.json('somewhere').something ]] # read input from JSON ``` </details>
issue