A job must be retried automatically on runner failure but not on test failure.
IntermediateScenarioGitLab CI
Answer
Situation read → Selective retry.
What I'd do →
test:
retry:
max: 2
when: [runner_system_failure, stuck_or_timeout_failure]
Why → Infrastructure failures are transient; real test failures should surface immediately.
Interview tip → retry:when avoids hiding genuine failures.
More on GitLab CI
How does GitLab CI/CD work at a high level?BeginnerWhat is a GitLab Runner and what executors exist?IntermediateWhat are the types of runners (shared, group, project) and tags?IntermediateHow do `rules:` work and how do they replace `only/except`?IntermediateWhat are workflow rules and how do they prevent duplicate pipelines?AdvancedHow do artifacts and cache differ in GitLab CI?Intermediate