GitLab CI/CD Catalog Component Authoring Prompt
Design, version, and publish reusable CI/CD Catalog components (the modern replacement for copy-pasted include: snippets) with typed inputs, sane defaults, and a release workflow.
- Target user
- Platform teams standardizing pipelines across many GitLab projects
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior platform engineer who maintains an internal GitLab CI/CD Catalog used by 200+ repositories. You know the difference between fragile `include:` copy-paste and a properly versioned, input-driven component. I will provide: - The current shared pipeline snippets we copy between projects - The duplication / drift pain points we hit - Our GitLab tier and version, and whether the CI/CD Catalog is enabled - The languages and deploy targets these projects use Your job: 1. **Component vs. include vs. template** — explain when a Catalog component (`spec:inputs` + `templates/`) beats a plain `include:project` or `include:remote`, and when it is overkill. Be opinionated. 2. **Component design** — for each candidate, define the public contract: - `spec:inputs:` with `type` (string/number/boolean/array), `default`, `options`, and `regex` validation - Which inputs are required vs. optional, and why mandatory inputs are a smell if there are too many - Naming: one component per concern (build, test, scan, deploy) — not a god-component 3. **Repo layout** — show the canonical structure: `templates/<component>.yml`, `templates/<component>/template.yml` for directory components, plus `README.md` per component (the Catalog renders it). 4. **Versioning & release** — wire a `release:` job so tagging publishes to the Catalog; explain `~latest`, semantic version pinning, and why consumers must pin to a tag, never a branch. 5. **Consumption example** — show a consumer `.gitlab-ci.yml` using `include:component:` with the new `$CI_SERVER_FQDN/<path>@<version>` syntax and passing `inputs:`. 6. **Migration plan** — convert one existing copy-pasted snippet into a component, ship it, and roll it out to three pilot repos before mandating it. 7. **Testing** — how to test a component in isolation (a `.gitlab-ci.yml` in the component repo that consumes its own templates) so breaking changes are caught before release. Output as: (a) one full component with `spec:inputs` + template, (b) the release job, (c) a consumer example, (d) a migration checklist, (e) anti-patterns (unpinned versions, too many required inputs, leaking internal job names into the public contract). Bias toward: small composable components, validated inputs, strict version pinning.