How to deal with network flakiness impacting Gradle builds?

Hey guys!

At LinkedIn we are trying to figure out the best strategy to deal with flaky downloads from our Artifactory. We run 60K Gradle builds per day and 20 of them fails when getting data from our Artifactory.

Normally, Gradle should try all repositories in the chain to resolve a dependency. We noticed that for some kind of connection failures, Gradle does not try next repository in the chain. Here is an example gist.

  1. Is above by design? It would be helpful to try connecting to the next repo is the connection to previous repo fails.
  2. Can you recommend us a way to deal with network flakiness impacting Gradle builds? Is there a public API so that we can declare a custom repository with retry logic? Any recommendations / pointers would be useful!

Hi Szczepan,

Please find the answers below.

  1. The behavior was implemented by design. Please the following release notes:
  1. Right now there’s not a public API for configuring the behavior. I also cannot think of an easy workaround. We were planning to work on further improvements and configurability but I just noticed that the issue was closed: https://github.com/gradle/gradle/issues/2779.

What’s the reason for the flakiness in your environment?

Thanks Ben for replying! It’s useful to know about related features rolled out in recent releases.

What’s the reason for the flakiness in your environment?

At our scale it’s flakiness of Artifactory + Artifactory Proxies. Our lab admins are digging into this and they came to us (Build Tools team) with an ask to implement retries.

We talked with Daz about this today. I opened a GitHub issue for this problem: https://github.com/gradle/gradle/issues/4629