From 6be4acd5094954851a956dd93d8c4043979011d9 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Sat, 7 Nov 2020 11:27:58 -0800 Subject: [PATCH] Use no-kpi subdomains for tests downloading artifacts (#64502) This commit converts build code that downloads distributions or other artifacts to use the new no-kpi subdomain, and removes the formerly used no-kpi header. --- .../gradle/DistributionDownloadPlugin.java | 12 ++---------- .../src/test/resources/create_test_nodes_info.bash | 4 ++-- distribution/docker/build.gradle | 2 +- x-pack/plugin/sql/qa/jdbc/build.gradle | 2 +- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/DistributionDownloadPlugin.java b/buildSrc/src/main/java/org/elasticsearch/gradle/DistributionDownloadPlugin.java index 4cbd142b829..dbf2da9e5d3 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/DistributionDownloadPlugin.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/DistributionDownloadPlugin.java @@ -34,10 +34,8 @@ import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.dsl.DependencyHandler; import org.gradle.api.artifacts.repositories.IvyArtifactRepository; import org.gradle.api.artifacts.type.ArtifactTypeDefinition; -import org.gradle.api.credentials.HttpHeaderCredentials; import org.gradle.api.internal.artifacts.ArtifactAttributes; import org.gradle.api.provider.Provider; -import org.gradle.authentication.http.HttpHeaderAuthentication; import java.util.Comparator; import static org.elasticsearch.gradle.util.Util.capitalize; @@ -147,12 +145,6 @@ public class DistributionDownloadPlugin implements Plugin { repo.setName(name); repo.setUrl(url); repo.metadataSources(IvyArtifactRepository.MetadataSources::artifact); - // this header is not a credential but we hack the capability to send this header to avoid polluting our download stats - repo.credentials(HttpHeaderCredentials.class, creds -> { - creds.setName("X-Elastic-No-KPI"); - creds.setValue("1"); - }); - repo.getAuthentication().create("header", HttpHeaderAuthentication.class); repo.patternLayout(layout -> layout.artifact("/downloads/elasticsearch/[module]-[revision](-[classifier]).[ext]")); }); project.getRepositories().exclusiveContent(exclusiveContentRepository -> { @@ -165,8 +157,8 @@ public class DistributionDownloadPlugin implements Plugin { if (project.getRepositories().findByName(DOWNLOAD_REPO_NAME) != null) { return; } - addIvyRepo(project, DOWNLOAD_REPO_NAME, "https://artifacts.elastic.co", FAKE_IVY_GROUP); - addIvyRepo(project, SNAPSHOT_REPO_NAME, "https://snapshots.elastic.co", FAKE_SNAPSHOT_IVY_GROUP); + addIvyRepo(project, DOWNLOAD_REPO_NAME, "https://artifacts-no-kpi.elastic.co", FAKE_IVY_GROUP); + addIvyRepo(project, SNAPSHOT_REPO_NAME, "https://snapshots-no-kpi.elastic.co", FAKE_SNAPSHOT_IVY_GROUP); } /** diff --git a/client/sniffer/src/test/resources/create_test_nodes_info.bash b/client/sniffer/src/test/resources/create_test_nodes_info.bash index f4f1c09882e..aa20ddffc48 100644 --- a/client/sniffer/src/test/resources/create_test_nodes_info.bash +++ b/client/sniffer/src/test/resources/create_test_nodes_info.bash @@ -22,8 +22,8 @@ pushd ${work} >> /dev/null echo Working in ${work} wget https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.0.0/elasticsearch-2.0.0.tar.gz -wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.0.0.tar.gz -wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.0.0.tar.gz +wget https://artifacts-no-kpi.elastic.co/downloads/elasticsearch/elasticsearch-5.0.0.tar.gz +wget https://artifacts-no-kpi.elastic.co/downloads/elasticsearch/elasticsearch-6.0.0.tar.gz sha1sum -c - << __SHAs e369d8579bd3a2e8b5344278d5043f19f14cac88 elasticsearch-2.0.0.tar.gz d25f6547bccec9f0b5ea7583815f96a6f50849e0 elasticsearch-5.0.0.tar.gz diff --git a/distribution/docker/build.gradle b/distribution/docker/build.gradle index a71180c7df7..e44a00e32d4 100644 --- a/distribution/docker/build.gradle +++ b/distribution/docker/build.gradle @@ -57,7 +57,7 @@ ext.expansions = { Architecture architecture, boolean oss, DockerBase base, bool sourceElasticsearch = """ RUN curl --retry 8 -S -L \\ --output /opt/elasticsearch.tar.gz \\ - https://artifacts.elastic.co/downloads/elasticsearch/$elasticsearch + https://artifacts-no-kpi.elastic.co/downloads/elasticsearch/$elasticsearch """ } diff --git a/x-pack/plugin/sql/qa/jdbc/build.gradle b/x-pack/plugin/sql/qa/jdbc/build.gradle index b13052b78f5..73f82bc0665 100644 --- a/x-pack/plugin/sql/qa/jdbc/build.gradle +++ b/x-pack/plugin/sql/qa/jdbc/build.gradle @@ -36,7 +36,7 @@ subprojects { repositories { maven { // Repository for downloading BWC compatible JDBC driver releases - url = 'https://artifacts.elastic.co/maven' + url = 'https://artifacts-no-kpi.elastic.co/maven' } }