Jenkins Monorepo Pipeline Prompt
Design a Jenkins pipeline for a monorepo that builds and tests only the components affected by a change — path-based change detection, per-service stages, and correct dependency ordering — instead of rebuilding everything every time.
- Target user
- Engineers running CI on a large monorepo
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a build engineer who makes monorepo CI fast by building only what changed while keeping correctness. I will provide: - The monorepo layout (services/packages/libs) and their dependency graph - The build tooling (Bazel/Nx/Turbo/Make/plain scripts) and current pipeline - How long a full build takes and where the pain is Your job: 1. **Change detection** — determine which paths changed for this build (diff against the merge-base/target branch), and map changed paths to affected components. Handle the "shared lib changed → rebuild dependents" case. 2. **Affected graph** — use the dependency graph (or the build tool's affected/targets query) so a change to a base library triggers everything downstream, not just the edited file's package. 3. **Dynamic stages** — generate build/test stages only for affected components (parallel where independent), and skip cleanly when nothing relevant changed. 4. **First-build & fallback** — handle the base-branch build, force-full triggers (nightly/manual), and the case where change detection can't be trusted (fall back to full build). 5. **Caching** — reuse build/test caches keyed by content so unchanged components don't re-run; tie into artifact/dependency caching. 6. **Correctness guardrails** — ensure a merge can't skip a needed rebuild (path filters that are too narrow are a silent-breakage risk); validate on main. Output: (a) the change-detection step, (b) the affected-component mapping + dynamic stage generation, (c) the full-build fallback, (d) the caching + correctness guardrails. Bias toward: dependency-aware affected detection, a safe full-build fallback, and never shipping an unbuilt-but-affected component.
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
-
Jenkins Parallel & Matrix Stages Prompt
Speed up a slow Jenkins pipeline with parallel stages and the declarative matrix — fan out tests across OS/version combos, run independent stages concurrently, and fail fast without starving executors.
-
Jenkins Dependency Caching Prompt
Speed up Jenkins builds by caching package-manager dependencies (Maven/Gradle, npm/yarn/pnpm, pip, Go modules) correctly — right cache keys, restore/save timing, and invalidation — especially on ephemeral agents that start empty.
-
Jenkins Artifact & Cache Strategy Prompt
Design how a Jenkins pipeline stores and reuses artifacts and caches — archiving, stash/unstash between stages, external artifact repos, and cache keys — so builds are fast and outputs are traceable.
-
Jenkins Agent & Executor Label Strategy Prompt
Design a Jenkins agent and label scheme so jobs land on the right node — build tools, OS, GPU, network zone — without pinning to a single machine, overloading executors, or leaving capacity idle.
More Jenkins prompts & error guides
Browse every Jenkins 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.