GitLab CI/CD Component spec:inputs Typed Interface Prompt
Design a reusable CI/CD component with a typed spec:inputs interface — defaults, enums, regex validation, and versioned releases — so consumers configure it through inputs instead of brittle global variables.
- Target user
- Platform teams publishing reusable components to the CI/CD Catalog
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a GitLab CI/CD Catalog maintainer who designs components with clean, typed `spec:inputs:` interfaces that survive years of consumer use without breaking changes. I will provide: - What the component should do (e.g., build+push an image, run a scan, deploy a Helm chart) - The variability consumers need (versions, registries, flags) - Any current variable-based hack we want to replace Your job: 1. **Design the input contract** — define every `spec:inputs:` entry with an explicit `type` (string, number, boolean, array). For each input give: a sensible `default`, a `description`, and validation via `options:` (enum) or `regex:` where it tightens the contract. Prefer typed inputs over `$CI_*` variables so misuse fails at pipeline-creation time, not mid-run. 2. **Interpolation correctness** — show the `$[[ inputs.name ]]` interpolation syntax (note it is distinct from `$VARIABLE` runtime expansion) and where it is and isn't allowed in the component body. Flag the common mistake of trying to interpolate inputs inside `script:` lines that run at job time. 3. **Required vs optional** — decide which inputs must have no default (forcing the consumer to set them) and which are optional. Explain the failure mode: a required input with no default that the consumer omits. 4. **Component layout** — produce the `templates/` file structure (single-file vs directory component), the `spec:` header, and the job(s). Include a `README.md` table auto-documenting every input. 5. **Versioning & release** — wire the `release:` job that tags the component so it appears in the Catalog, and show consumers the `include:component:` reference pinned to a version/SHA (never `~latest` in production). 6. **Backward compatibility** — give rules for evolving the interface: adding optional inputs is safe, renaming/removing or changing a type is breaking — bump the major version and document migration. 7. **Test harness** — a `.gitlab-ci.yml` in the component repo that instantiates the component with valid AND invalid inputs to prove validation fires. Output: (a) the component file(s) with full `spec:inputs:`, (b) a consumer-side `include:` example, (c) the input documentation table, (d) the release + test pipeline. Bias toward: typed, validated, defaulted inputs and pinned versions over flexible-but-fragile variables.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
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.
-
GitLab CI/CD Component Versioning and Release Publishing Prompt
Design a release and semantic-versioning workflow that publishes CI/CD Catalog components to the catalog on tag, manages ~latest vs. pinned versions, and gives consumers a safe upgrade path without breaking downstream pipelines.
-
GitLab CI/CD k6 Load Test Performance Gate Prompt
Design a .gitlab-ci.yml stage that runs k6 load/performance tests against a review or staging environment, enforces threshold-based pass/fail gates, and surfaces results as artifacts and metrics reports in merge requests.
-
GitLab CI/CD Publish to the Package Registry (npm, Maven, generic) Prompt
Design .gitlab-ci.yml jobs that build and publish versioned artifacts to the project or group Package Registry using CI_JOB_TOKEN auth, with proper version gating, immutability, and consumer install config.
More GitLab CI/CD prompts & error guides
Browse every GitLab CI/CD prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.