Not all maven repos searched


(Ryan Ernst) #1

I have an odd issue that I cannot reproduce locally, yet happens (periodically) in our CI testing. We have some backwards compatibility tests which pull old versions. In these tests, in addition to mavenCentral() which we have configured for all projects, we add this:

repositories {
  maven {
    url "https://artifacts.elastic.co/maven"
  }
  maven {
    url "https://snapshots.elastic.co/maven"
  }
}

This works most of the time, finding released versions in artifacts.elastic.co and snapshots under snapshots.elastic.co. However, we have seen some failures which cannot find a snapshot version, but the gradle output makes it look like only artifacts.elastic.co was searched.

09:43:56 * What went wrong:
09:43:56 Could not resolve all files for configuration ':x-pack:qa:full-cluster-restart:with-system-key:v5.6.10-SNAPSHOT#oldClusterTestCluster_elasticsearchBwcPlugins'.
09:43:56 > Could not find x-pack.zip (org.elasticsearch.plugin:x-pack:5.6.10-SNAPSHOT).
09:43:56   Searched in the following locations:
09:43:56       https://artifacts.elastic.co/maven/org/elasticsearch/plugin/x-pack/5.6.10-SNAPSHOT/x-pack-5.6.10-SNAPSHOT.zip
09:43:56 

I’m looking for any guidance on how to debug this issue. In particular, I have run this test locally with debug logging, and can see the 3 different repos being looked at:

15:25:52.211 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver] Attempting to resolve component for org.elasticsearch.plugin:x-pack:5.6.10-SNAPSHOT using repositories [MavenRepo, maven, maven2]
15:25:52.211 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Detected non-existence of module 'org.elasticsearch.plugin:x-pack:5.6.10-SNAPSHOT' in resolver cache 'MavenRepo'
15:25:52.212 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Detected non-existence of module 'org.elasticsearch.plugin:x-pack:5.6.10-SNAPSHOT' in resolver cache 'maven'
15:25:52.212 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Cached meta-data for changing module is expired: will perform fresh resolve of 'org.elasticsearch.plugin:x-pack:5.6.10-SNAPSHOT' in 'maven2'

I would love to enable debug logging just for those loggers in CI, but I have not found a way to control this as the SLF4j logger seems to be wrapped by gradle and does not allow setting the level.

Note we have experienced this in gradle 4.5 and 4.7, but we only introduced this testing which pulls from maven for snapshots very recently, so it may have happened on earlier versions but we have no data.