Tests Pass Locally, Fail in CI. Just Retry?
Your suite is green on your laptop but red in CI. A teammate wants to add a retry and re-run until green. Defend what you actually do.
Answer key reviewed by Branko Petric
Read first: Building a CI Pipeline with GitHub Actions
Your decision
Your test suite passes on your laptop but fails in CI. A teammate says CI is just flaky, add a retry and re-run until it is green. What do you do, and why?
The situation
Your CI pipeline keeps failing a handful of tests, but the exact same tests pass every time on your laptop. Re-running the job sometimes makes it green.
Context
The project does not pin all dependency versions, CI runs on a different OS than your laptop, and a few tests touch dates and a shared temp directory. A teammate suggests adding automatic retries so the build goes green and stops blocking the release.
Related challenges
- The Pipeline Is Slow. Skip Tests to Ship?
A 40-minute pipeline is blocking releases. A teammate wants to skip the test stage to ship faster. Defend your call.
- Your CI Has Keys to Prod and Pulls Unpinned Deps
CI pulls unpinned dependencies, runs them, and holds prod credentials. A teammate says just add a vulnerability scanner. Defend a real hardening plan.
- Deploy From CI: Paste AWS Keys Into GitHub Secrets?
Your GitHub Actions pipeline needs to deploy to AWS. A teammate wants to paste a long-lived IAM access key into repo secrets. Defend the better option.
- After an Outage, Mandate Manual Approval on Every Deploy?
After a bad deploy caused an outage, leadership wants a mandatory human sign-off on every production release. Defend a better way to prevent the next one.