Add pipeline inputs to the PipelineCreate GraphQL mutation
What does this MR do and why?
Add pipeline inputs to the PipelineCreate GraphQL mutation
- The mutation accepts
inputs. -
inputsis an array ofTypes::Ci::Inputs::InputType. -
Types::Ci::Inputs::InputTypeconsists ofkeyandvalue. -
keyis a string. -
value(Types::Ci::Inputs::ValueInputType) can be a string, array, number, or boolean.
References
This is the first step of #519958 (closed). Future MRs will implement inputs in other pipeline creation endpoints.
Feature flag: ci_inputs_for_pipelines
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
- Enable the feature flag
ci_inputs_for_pipelines. - Have a sample CI config;
spec:
inputs:
environment:
description: "The deployment environment"
default: "test"
options: ["test", "staging", "production"]
scan_security:
description: "Whether to run security scans"
type: boolean
default: true
---
build-app:
stage: build
script:
- echo "Building application for $[[ inputs.environment ]] environment"
security-scan:
stage: test
script:
- echo "Running security scans"
rules:
- if: '"$[[ inputs.scan_security ]]" == "true"'
- Run the mutation GraphQL query;
mutation internalPipelineCreate($input: PipelineCreateInput!) {
pipelineCreate(input: $input) {
clientMutationId
errors
pipeline {
id
path
errorMessages {
nodes {
id
content
}
}
warningMessages {
nodes {
id
content
}
}
}
}
}
{
"input": {
"projectPath": "root/support-inputs-for-pipelines",
"ref": "no-trigger",
"inputs": [
{ "key": "environment", "value": "staging" }
]
}
}
- Result;
Edited by Furkan Ayhan


