CI/CD inputs: Secure and prefe... Note
GitLab

CI/CD inputs: Secure and preferred method to pass parameters to a pipeline

GitLab CI/CD inputs are a modern solution for pipeline parameter passing, offering typed parameters with validation and clear contracts. Traditional CI/CD variables, originally for configuration, present reliability and security issues due to their string-only nature and runtime mutability. Inputs eliminate these problems by enforcing type safety, preventing unexpected failures, and mitigating variable collisions.Variables lack type validation, leading to runtime errors when expecting numbers or booleans but receiving strings. They are also mutable during runtime, causing unpredictable behavior when multiple jobs modify the same variables. Furthermore, variables can pose security risks as they often inherit the same access permissions as sensitive secrets without clear distinction.Error detection with variables is often delayed, wasting CI/CD resources and developer time. Elaborate workarounds are needed to ensure reliability with variables. Local debugging is difficult due to reliance on external systems.Variable precedence in GitLab can lead to unpredictable behavior, especially with reusable pipeline components across different projects. This complexity requires extensive documentation for template authors. Inputs, however, are evaluated at pipeline creation time, allowing interpolation in various configuration elements, including job names.This feature prevents job name collisions when reusable components are included multiple times. Inputs support different value types and validate them at pipeline creation, rejecting pipelines with type mismatches before execution. This provides immediate feedback, unlike the delayed failures common with variables.Inputs enhance security by defining explicit parameter expectations and are immutable once set. This creates clear boundaries for parameter passing, improving overall pipeline robustness and maintainability. Transitioning to inputs offers increased reliability and efficiency for CI/CD workflows.