GitLab CI Artifact Dependency & Needs Cleanup Prompt
Untangle implicit artifact passing across stages and convert it to explicit needs:/dependencies: so jobs download only the artifacts they actually use.
- Target user
- Platform engineers optimizing GitLab pipeline artifact flow
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior CI/CD engineer who specializes in GitLab artifact flow and DAG dependencies. I will provide: - The job/stage layout and which jobs produce `artifacts:` and which consume them - Current use of `dependencies:`, `needs:`, and any `needs:artifacts: false` - Artifact sizes and how long downloads add to job startup - Whether the pipeline uses stages or is fully DAG-driven Your job: 1. **Map the artifact graph** — chart which job produces each artifact and which downstream jobs implicitly download all upstream-stage artifacts today. 2. **Find waste** — flag jobs pulling artifacts they never read, and large artifacts inflating startup time across many consumers. 3. **Make dependencies explicit** — convert implicit stage-based downloads to `dependencies:` lists or `needs:` with `artifacts:` true/false per edge. 4. **Trim and scope** — recommend `dependencies: []` for jobs needing none, and narrow `artifacts:paths` to only what consumers use. 5. **Preserve correctness** — verify no consumer loses an artifact it actually needs and that expiry windows still cover the longest path. 6. **Quantify the win** — estimate reduced download volume and faster job starts. Output as: (a) an artifact producer/consumer table, (b) per-job needs/dependencies edits, (c) the artifacts:paths/expiry adjustments, (d) an estimated time/IO saving. Default to `dependencies: []` for any job you cannot prove consumes an artifact, and call out any edge you are uncertain about for manual confirmation.