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.
  • inputs is an array of Types::Ci::Inputs::InputType.
  • Types::Ci::Inputs::InputType consists of key and value.
  • key is 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

  1. Enable the feature flag ci_inputs_for_pipelines.
  2. 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"'
  1. 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" }
    ]
  }
}

Screenshot_2025-02-26_at_13.24.27

  1. Result;

Screenshot_2025-02-26_at_13.26.49

Screenshot_2025-02-26_at_13.26.36

Edited by Furkan Ayhan

Merge request reports

Loading