Developers complain CI takes 25 minutes. Where do you start?
IntermediateScenarioPipeline Design & Triggers
Answer
Situation read → Need data before optimizing.
What I'd do →
- Pull timings:
gh run view <id> --json jobs --jq '.jobs[] | {name, startedAt, completedAt}'across 20 runs, and check queue time vs execution time. - Look for: serial jobs that could be parallel, missing caches (setup step minutes), Docker builds without layer cache, tests not sharded, a full matrix on every PR.
- Fix in order of impact: caching, parallelism with
needsgraph, test sharding with matrix, PR-only reduced matrix, cancel superseded runs. - If queue time dominates, the account's concurrency limit or self-hosted capacity is the bottleneck, not the YAML.
Why → Queue time and run time have completely different fixes.
Interview tip → Quote a before-and-after number from your own experience.
More on Pipeline Design & Triggers
You join a team whose single 900-line workflow runs everything on every push to every branch. How do you restructure it?IntermediatePushing to a PR branch runs CI twice (once for push, once for pull_request). How do you fix it?BeginnerProduct wants a "Deploy to staging" button that lets QA pick a version. Design it.BeginnerA nightly security scan should run at 02:00 India time on weekdays and also be runnable on demand. Write it.BeginnerYour team wants preview environments per PR on EKS, destroyed when the PR closes. Design the workflow.AdvancedTwo workflows must run in sequence: CI then a separate deploy workflow owned by another team. How do you link them?Intermediate