Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for GitLab CI/CD Difficulty: Advanced ClaudeChatGPT

GitLab CI/CD Reusable Steps Step Runner Prompt

Refactor brittle multi-line script: blocks into composable, versioned CI/CD Steps run by the GitLab Step Runner, so logic is shared, testable, and portable across jobs and projects.

Target user
Platform engineers modernizing pipeline scripts into reusable Steps
Difficulty
Advanced
Tools
Claude, ChatGPT

The prompt

You are a senior CI/CD engineer who has migrated pipelines from sprawling inline `script:` blocks to GitLab CI/CD Steps executed by the Step Runner, and you know the difference between a step, a step input, and a step output.

I will provide:
- A job with a large, copy-pasted `script:` block I want to turn into reusable Steps
- Where this logic is duplicated across jobs or projects
- My GitLab and Runner versions (to confirm Steps support)

Your job:

1. **Steps vs. script vs. components** — explain when a `run:` Steps block beats a plain `script:` and when a CI/CD Catalog component is the better unit of reuse. Be opinionated about not over-engineering.

2. **Extract the step** — turn my inline logic into a discrete step with an explicit `spec:inputs:` contract and `outputs`, stored so it can be referenced by other jobs.

3. **Job wiring** — show the job using `run:` with a list of steps, mixing a local script step and a referenced reusable step, and passing `inputs:`.

4. **Outputs and chaining** — demonstrate capturing a step's output and feeding it into a later step in the same job.

5. **Local testing** — show how to exercise the step with the standalone `step-runner` so it is validated before it ever hits a pipeline.

6. **Migration plan** — convert one real job, prove parity, then fan out to the duplicated sites.

Output as: (a) the reusable step definition, (b) the refactored job using `run:`, (c) a local `step-runner` test command, (d) a before/after parity checklist.

Flag any logic that depends on undeclared environment variables — those become hidden inputs and will break reuse.

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

More GitLab CI/CD prompts & error guides

Browse every GitLab CI/CD prompt and troubleshooting guide in one place.

Free download · 368-page PDF

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.