Dynamic Input Selection in GitLab Pipelines planning/discussion
Technical details
Syntax - rules
:
instance_type:
type: string
description: "Virtual machine size"
rules:
- if: inputs.cloud_provider == 'aws' && inputs.environment == 'development'
options: ['t3.micro', 't3.small']
default: 't3.micro'
- if: inputs.cloud_provider == 'gcp' && inputs.environment == 'production'
options: ['e2-standard-4', 'e2-standard-8']
default: 'e2-standard-4'
- options: [] # for unmatched conditions
API structure:
{
"data": {
"project": {
"id": "gid://gitlab/Project/XYZ",
"ciPipelineCreationInputs": [
{
"name": "instance_type",
"type": "STRING",
"options": [],
"default": "",
"required": true,
"description": null,
"regex": null,
"rules": [
{
"when": {
"cloud_provider": "aws",
"environment": "development"
},
"options": ["t3.micro", "t3.small"],
"default": "t3.micro"
},
{
"when": {},
"options": [],
"default": null
}
]
}
]
}
}
}
Problem Statement
When non-technical users trigger GitLab pipelines, they need a way to easily configure inputs for this pipeline in the UI. When configuring a input, users should be able to select one or more values from a dropdown. Additionally, there needs to be a way to link two or more inputs such that the choices in the dropdown of the second input change depending on what was selected as the value for the first variable.
Proposed Workflow
- Users go to Build -> Pipelines and Click on "New Pipeline"
- They select which pre-defined input they want to configure
- They select one or more values from a dropdown for that input
- They select the second input they want to configure
- Dropdown for second variable dynamically populates with relevant values based on value of first variable
- User manually triggers the pipeline which gets executed with the selected input values
Requirements
- User-friendly UI for pipeline triggering
- One or more values for a preconfigured input can be selected from a dropdown
- Cascading dropdown functionality:
- Options in dropdown change depending on which input was selected
- Options in dropdown change depending on what selection was made for a previous input
- Possibility to set up input that need to be defined for every pipeline run
- Possibility to define multiple value options for a input
- Possibility to define relationships between different inputs
Impact
- Operational: Maintains separation of concerns between pipeline authors and users
- Business: Ensures long-term sustainability of deployment process
- User Experience: Simple, web-based interface for non-technical users
- Error Prevention: Dynamic filtering prevents selection of inappropriate input values
- Efficiency: Streamlines the deployment process while maintaining control
Notes
A similar capability was proposed in this epic: &11595
Earlier part of description was created with the help of AI , the rest is human
Edited by Laura Montemayor