GitLab Blog

Define input parameters to includable CI/CD configuration files

thumbnail

Introduction

In GitLab 15.11, users can define input parameters for includable configuration files, allowing them to replace any keyword in the template with a parameter. This feature enables users to enforce constraints and declare mandatory inputs for templates.

Define Input Parameters

To define input parameters for a template, create a YAML file with two parts: variables and content. In the variable section, define the input parameters using the variables keyword.

Including Templates with Input Parameters

In the main CI configuration file, include the template and add input parameters using the with keyword. Use interpolation format to reference input parameter values in the template.

Conclusion

Using templates with inputs simplifies pipeline configuration and makes templates more modular and reusable. This new feature is the first milestone of the CI/CD Components Catalog, which will allow users to search and reuse single-purpose CI/CD configuration units with specific parameters for their use case.