Published on: March 4, 2024
3 min read
CI/CD components are the next generation of CI/CD templates, enhancing pipeline creation and maintenance. Learn how to transition from templates to components.
GitLab recently introduced CI/CD components as the next generation of the traditional CI/CD templates, and a novel approach to constructing CI/CD pipelines. CI/CD components offer reusable pipeline configurations that can be customized using input parameters.
Although GitLab continues to support templates, they come with certain drawbacks that are addressed by the introduction of components. Therefore, we highly recommend refactoring existing templates into CI/CD components.
This article will guide you through the steps of converting your current GitLab CI/CD templates into reusable CI/CD components. Prior familiarity with how to create CI/CD components is a prerequisite, which you can learn about in this blog post: Introducing the GitLab CI/CD Catalog Beta.
These are the steps to convert a CI/CD template to a CI/CD component:
spec
keyword.Here is a code example of a job in an existing template:
And this is the refactored component code:
Once your components are ready, you can publish them to the CI/CD catalog so others will be able to find and consume them.
We've prepared a brief product tour so you can quickly dive into the CI/CD catalog and see it in action (use the "Next" button to progress through the demo).
Please refer to the official documentation on CI/CD components for more on how to convert templates to components.
You can explore an additional practical example, demonstrating the steps to convert GitLab Go templates to CI/CD components.
Then, you can watch the following video where Fabio Pitino, GitLab Principal Engineer, demonstrates the process of refactoring GitLab AWS templates to CI/CD components.