Why it's Not a Good Idea to Use "Retry" in GitLab CI?

Modified on Wed, 29 Mar 2023 at 03:09 PM

GitLab CI's "retry" keyword can be alluring because it seems like a simple method to handle pipeline failures and retries. In the long term, though, it might actually cause more issues and headaches.

The fact that "retry" can make your pipeline run for a lot longer than it needs to is one of the major problems with it. Every time a job fails and needs to be retried, it uses up time and resources, possibly slowing down the remainder of the pipeline and creating a backlog of other jobs that need to run.

It can conceal the true issues in your process, which is another problem. You might just keep retrying the task until it succeeds rather than addressing the underlying cause of the loss. This can create a false feeling of security and make it more difficult to find and address real problems.

It is preferable to concentrate on resolving the primary reason of the failure rather than simply "trying again." This might entail enhancing the employed code or dependencies, modifying the work settings or configurations, or attending to underlying infrastructure problems.

As a result, even though "retry" may appear to be a simple way to handle pipeline failures, it can ultimately result in more issues and expenses. You can guarantee a more effective and efficient GitLab CI pipeline by concentrating on resolving the primary source of errors and using more targeted retry approaches when necessary.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article