Skip to content

CI: use retry() macro instead of GitLab `retry` job option

The CI currently retries failed jobs at least once (default:retry: 1 in .gitlab-ci.yml). This doesn't distinguish between build failures (i.e. compile error) and transient failures (e.g. network outages). (retry:when doesn't help as that only distinguishes runner failures.) Retrying a CI job on build failures wastes resources (particularly for resource-scarce runners e.g. macOS) and delays pipeline completion.

Using the retry() macro instead gives more control on which commands need to be retried (i.e. anything that downloads packages), how many times, etc. Retrying a single command within a CI job is more efficient that failing and the restarting the whole job. Jobs that fail on e.g. a compile error will fail immediately and not be rerun.

Todo:

cc @duncanmmacleod @adam-mercer

Edited by Karl Wette