diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/DistributionDownloadPlugin.java b/buildSrc/src/main/java/org/elasticsearch/gradle/DistributionDownloadPlugin.java index fd452abc9442c..09445b296acac 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/DistributionDownloadPlugin.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/DistributionDownloadPlugin.java @@ -22,6 +22,7 @@ import org.elasticsearch.gradle.ElasticsearchDistribution.Flavor; import org.elasticsearch.gradle.ElasticsearchDistribution.Platform; import org.elasticsearch.gradle.ElasticsearchDistribution.Type; +import org.elasticsearch.gradle.tool.ClasspathUtils; import org.gradle.api.GradleException; import org.gradle.api.NamedDomainObjectContainer; import org.gradle.api.Plugin; @@ -56,7 +57,9 @@ public class DistributionDownloadPlugin implements Plugin { private static final String CONTAINER_NAME = "elasticsearch_distributions"; private static final String FAKE_IVY_GROUP = "elasticsearch-distribution"; + private static final String FAKE_SNAPSHOT_IVY_GROUP = "elasticsearch-distribution-snapshot"; private static final String DOWNLOAD_REPO_NAME = "elasticsearch-downloads"; + private static final String SNAPSHOT_REPO_NAME = "elasticsearch-snapshots"; private BwcVersions bwcVersions; private NamedDomainObjectContainer distributionsContainer; @@ -72,9 +75,10 @@ public void apply(Project project) { setupDownloadServiceRepo(project); - ExtraPropertiesExtension extraProperties = project.getExtensions().getExtraProperties(); - this.bwcVersions = (BwcVersions) extraProperties.get("bwcVersions"); - // TODO: setup snapshot dependency instead of pointing to bwc distribution projects for external projects + if (ClasspathUtils.isElasticsearchProject(project)) { + ExtraPropertiesExtension extraProperties = project.getExtensions().getExtraProperties(); + this.bwcVersions = (BwcVersions) extraProperties.get("bwcVersions"); + } project.afterEvaluate(this::setupDistributions); } @@ -148,13 +152,10 @@ private void setupRootDownload(Project rootProject, ElasticsearchDistribution di } } - private static void setupDownloadServiceRepo(Project project) { - if (project.getRepositories().findByName(DOWNLOAD_REPO_NAME) != null) { - return; - } + private static void addIvyRepo(Project project, String name, String url, String group) { project.getRepositories().ivy(ivyRepo -> { - ivyRepo.setName(DOWNLOAD_REPO_NAME); - ivyRepo.setUrl("https://artifacts.elastic.co"); + ivyRepo.setName(name); + ivyRepo.setUrl(url); ivyRepo.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 ivyRepo.credentials(HttpHeaderCredentials.class, creds -> { @@ -163,15 +164,25 @@ private static void setupDownloadServiceRepo(Project project) { }); ivyRepo.getAuthentication().create("header", HttpHeaderAuthentication.class); ivyRepo.patternLayout(layout -> layout.artifact("/downloads/elasticsearch/[module]-[revision](-[classifier]).[ext]")); - ivyRepo.content(content -> content.includeGroup(FAKE_IVY_GROUP)); + ivyRepo.content(content -> content.includeGroup(group)); }); project.getRepositories().all(repo -> { - if (repo.getName().equals(DOWNLOAD_REPO_NAME) == false) { + if (repo.getName().equals(name) == false) { // all other repos should ignore the special group name - repo.content(content -> content.excludeGroup(FAKE_IVY_GROUP)); + repo.content(content -> content.excludeGroup(group)); } }); - // TODO: need maven repo just for integ-test-zip, but only in external cases + } + + private static void setupDownloadServiceRepo(Project project) { + if (project.getRepositories().findByName(DOWNLOAD_REPO_NAME) != null) { + return; + } + addIvyRepo(project, DOWNLOAD_REPO_NAME, "https://artifacts.elastic.co", FAKE_IVY_GROUP); + if (ClasspathUtils.isElasticsearchProject(project) == false) { + // external, so add snapshot repo as well + addIvyRepo(project, SNAPSHOT_REPO_NAME, "https://snapshots.elastic.co", FAKE_SNAPSHOT_IVY_GROUP); + } } /** @@ -187,25 +198,30 @@ private static void setupDownloadServiceRepo(Project project) { */ private Object dependencyNotation(Project project, ElasticsearchDistribution distribution) { - if (Version.fromString(VersionProperties.getElasticsearch()).equals(distribution.getVersion())) { - return projectDependency(project, distributionProjectPath(distribution), "default"); - // TODO: snapshot dep when not in ES repo - } - BwcVersions.UnreleasedVersionInfo unreleasedInfo = bwcVersions.unreleasedInfo(distribution.getVersion()); - if (unreleasedInfo != null) { - assert distribution.getBundledJdk(); - return projectDependency(project, unreleasedInfo.gradleProjectPath, distributionProjectName(distribution)); + if (ClasspathUtils.isElasticsearchProject(project)) { + // non-external project, so depend on local build + + if (VersionProperties.getElasticsearch().equals(distribution.getVersion())) { + return projectDependency(project, distributionProjectPath(distribution), "default"); + } + BwcVersions.UnreleasedVersionInfo unreleasedInfo = bwcVersions.unreleasedInfo(Version.fromString(distribution.getVersion())); + if (unreleasedInfo != null) { + assert distribution.getBundledJdk(); + return projectDependency(project, unreleasedInfo.gradleProjectPath, distributionProjectName(distribution)); + } } if (distribution.getType() == Type.INTEG_TEST_ZIP) { return "org.elasticsearch.distribution.integ-test-zip:elasticsearch:" + distribution.getVersion(); } + + Version distroVersion = Version.fromString(distribution.getVersion()); String extension = distribution.getType().toString(); String classifier = ":x86_64"; if (distribution.getType() == Type.ARCHIVE) { extension = distribution.getPlatform() == Platform.WINDOWS ? "zip" : "tar.gz"; - if (distribution.getVersion().onOrAfter("7.0.0")) { + if (distroVersion.onOrAfter("7.0.0")) { classifier = ":" + distribution.getPlatform() + "-x86_64"; } else { classifier = ""; @@ -214,10 +230,12 @@ private Object dependencyNotation(Project project, ElasticsearchDistribution dis classifier = ":amd64"; } String flavor = ""; - if (distribution.getFlavor() == Flavor.OSS && distribution.getVersion().onOrAfter("6.3.0")) { + if (distribution.getFlavor() == Flavor.OSS && distroVersion.onOrAfter("6.3.0")) { flavor = "-oss"; } - return FAKE_IVY_GROUP + ":elasticsearch" + flavor + ":" + distribution.getVersion() + classifier + "@" + extension; + + String group = distribution.getVersion().endsWith("-SNAPSHOT") ? FAKE_SNAPSHOT_IVY_GROUP : FAKE_IVY_GROUP; + return group + ":elasticsearch" + flavor + ":" + distribution.getVersion() + classifier + "@" + extension; } private static Dependency projectDependency(Project project, String projectPath, String projectConfig) { @@ -251,7 +269,7 @@ private static String distributionProjectName(ElasticsearchDistribution distribu projectName += "no-jdk-"; } if (distribution.getType() == Type.ARCHIVE) { - if (distribution.getVersion().onOrAfter("7.0.0")) { + if (Version.fromString(distribution.getVersion()).onOrAfter("7.0.0")) { Platform platform = distribution.getPlatform(); projectName += platform.toString() + (platform == Platform.WINDOWS ? "-zip" : "-tar"); } else { diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/ElasticsearchDistribution.java b/buildSrc/src/main/java/org/elasticsearch/gradle/ElasticsearchDistribution.java index 22ede2d1becff..0a610c779446f 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/ElasticsearchDistribution.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/ElasticsearchDistribution.java @@ -101,7 +101,7 @@ public String toString() { final Configuration configuration; private final Extracted extracted; - private final Property version; + private final Property version; private final Property type; private final Property platform; private final Property flavor; @@ -111,8 +111,7 @@ public String toString() { Configuration extractedConfiguration) { this.name = name; this.configuration = fileConfiguration; - this.version = objectFactory.property(Version.class); - this.version.convention(Version.fromString(VersionProperties.getElasticsearch())); + this.version = objectFactory.property(String.class).convention(VersionProperties.getElasticsearch()); this.type = objectFactory.property(Type.class); this.type.convention(Type.ARCHIVE); this.platform = objectFactory.property(Platform.class); @@ -125,12 +124,13 @@ public String getName() { return name; } - public Version getVersion() { + public String getVersion() { return version.get(); } public void setVersion(String version) { - this.version.set(Version.fromString(version)); + Version.fromString(version); // ensure the version parses, but don't store as Version since that removes -SNAPSHOT + this.version.set(version); } public Platform getPlatform() { diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java b/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java index 2643845d75fcb..a06b04483846e 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java @@ -180,7 +180,7 @@ public String getName() { @Internal public Version getVersion() { - return distributions.get(currentDistro).getVersion(); + return Version.fromString(distributions.get(currentDistro).getVersion()); } @Internal diff --git a/buildSrc/src/test/java/org/elasticsearch/gradle/DistributionDownloadPluginIT.java b/buildSrc/src/test/java/org/elasticsearch/gradle/DistributionDownloadPluginIT.java index 61283a1b4b47f..fe2ba08853170 100644 --- a/buildSrc/src/test/java/org/elasticsearch/gradle/DistributionDownloadPluginIT.java +++ b/buildSrc/src/test/java/org/elasticsearch/gradle/DistributionDownloadPluginIT.java @@ -38,6 +38,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; public class DistributionDownloadPluginIT extends GradleIntegrationTestCase { + // TODO: check reuse of root task across projects MOVE TO UNIT TEST // TODO: future: check integ-test-zip to maven, snapshots to snapshot service for external project @@ -48,32 +49,61 @@ public void testCurrent() throws Exception { "tests.local_distro.project", projectName); } + public void testCurrentExternal() throws Exception { + checkService(VersionProperties.getElasticsearch(), "archive", "linux", null, null, + "/downloads/elasticsearch/elasticsearch-" + VersionProperties.getElasticsearch() + "-linux-x86_64.tar.gz", + "tests.internal", "false"); + } + public void testBwc() throws Exception { - assertExtractedDistro("1.1.0", "archive", "linux", null, null, - "tests.local_distro.config", "zip", + assertExtractedDistro("8.1.0", "archive", "linux", null, null, + "tests.local_distro.config", "linux-tar", "tests.local_distro.project", ":distribution:bwc:minor", - "tests.current_version", "2.0.0"); + "tests.current_version", "8.0.0"); + } + + public void testBwcExternal() throws Exception { + checkService("8.1.0-SNAPSHOT", "archive", "linux", null, null, + "/downloads/elasticsearch/elasticsearch-8.1.0-SNAPSHOT-linux-x86_64.tar.gz", + "tests.internal", "false", + "tests.current_version", "9.0.0"); } public void testReleased() throws Exception { - doTestReleased("7.0.0", "/downloads/elasticsearch/elasticsearch-7.0.0-windows-x86_64.zip"); - doTestReleased("6.5.0", "/downloads/elasticsearch/elasticsearch-6.5.0.zip"); + checkService("7.0.0", "archive", "windows", null, null, + "/downloads/elasticsearch/elasticsearch-7.0.0-windows-x86_64.zip"); + checkService("6.5.0", "archive", "windows", null, null, + "/downloads/elasticsearch/elasticsearch-6.5.0.zip"); + } + + public void testReleasedExternal() throws Exception { + checkService("7.0.0", "archive", "windows", null, null, + "/downloads/elasticsearch/elasticsearch-7.0.0-windows-x86_64.zip", + "tests.internal", "false"); + checkService("6.5.0", "archive", "windows", null, null, + "/downloads/elasticsearch/elasticsearch-6.5.0.zip", + "tests.internal", "false"); } - private void doTestReleased(String version, String urlPath) throws IOException { + private void checkService(String version, String type, String platform, String flavor, Boolean bundledJdk, + String urlPath, String... sysProps) throws IOException { + String suffix = urlPath.endsWith("zip") ? "zip" : "tar.gz"; + String sourceFile = "src/testKit/distribution-download/distribution/files/fake_elasticsearch." + suffix; WireMockServer wireMock = new WireMockServer(0); try { final byte[] filebytes; - try (InputStream stream = - Files.newInputStream(Paths.get("src/testKit/distribution-download/distribution/files/fake_elasticsearch.zip"))) { + try (InputStream stream = Files.newInputStream(Paths.get(sourceFile))) { filebytes = stream.readAllBytes(); } wireMock.stubFor(head(urlEqualTo(urlPath)).willReturn(aResponse().withStatus(200))); wireMock.stubFor(get(urlEqualTo(urlPath)).willReturn(aResponse().withStatus(200).withBody(filebytes))); wireMock.start(); - assertExtractedDistro(version, "archive", "windows", null, null, - "tests.download_service", wireMock.baseUrl()); + List allSysProps = new ArrayList<>(); + allSysProps.addAll(Arrays.asList(sysProps)); + allSysProps.add("tests.download_service"); + allSysProps.add(wireMock.baseUrl()); + assertExtractedDistro(version, type, platform, flavor, bundledJdk, allSysProps.toArray(new String[0])); } catch (Exception e) { // for debugging System.err.println("missed requests: " + wireMock.findUnmatchedRequests().getRequests()); diff --git a/buildSrc/src/test/java/org/elasticsearch/gradle/DistributionDownloadPluginTests.java b/buildSrc/src/test/java/org/elasticsearch/gradle/DistributionDownloadPluginTests.java index a58a08423fed6..d68869be4827c 100644 --- a/buildSrc/src/test/java/org/elasticsearch/gradle/DistributionDownloadPluginTests.java +++ b/buildSrc/src/test/java/org/elasticsearch/gradle/DistributionDownloadPluginTests.java @@ -54,58 +54,58 @@ public class DistributionDownloadPluginTests extends GradleUnitTestCase { new BwcVersions(new TreeSet<>(Arrays.asList(BWC_MAINTENANCE_VERSION, BWC_STAGED_VERSION, BWC_MINOR_VERSION)), BWC_MINOR_VERSION); public void testVersionDefault() { - ElasticsearchDistribution distro = checkDistro(createProject(null), + ElasticsearchDistribution distro = checkDistro(createProject(null, false), "testdistro", null, Type.ARCHIVE, Platform.LINUX, Flavor.OSS, true); - assertEquals(distro.getVersion(), Version.fromString(VersionProperties.getElasticsearch())); + assertEquals(distro.getVersion(), VersionProperties.getElasticsearch()); } public void testBadVersionFormat() { - assertDistroError(createProject(null), "testdistro", "badversion", Type.ARCHIVE, Platform.LINUX, Flavor.OSS, true, + assertDistroError(createProject(null, false), "testdistro", "badversion", Type.ARCHIVE, Platform.LINUX, Flavor.OSS, true, "Invalid version format: 'badversion'"); } public void testTypeDefault() { - ElasticsearchDistribution distro = checkDistro(createProject(null), + ElasticsearchDistribution distro = checkDistro(createProject(null, false), "testdistro", "5.0.0", null, Platform.LINUX, Flavor.OSS, true); assertEquals(distro.getType(), Type.ARCHIVE); } public void testPlatformDefault() { - ElasticsearchDistribution distro = checkDistro(createProject(null), + ElasticsearchDistribution distro = checkDistro(createProject(null, false), "testdistro", "5.0.0", Type.ARCHIVE, null, Flavor.OSS, true); assertEquals(distro.getPlatform(), ElasticsearchDistribution.CURRENT_PLATFORM); } public void testPlatformForIntegTest() { - assertDistroError(createProject(null), "testdistro", "5.0.0", Type.INTEG_TEST_ZIP, Platform.LINUX, null, null, + assertDistroError(createProject(null, false), "testdistro", "5.0.0", Type.INTEG_TEST_ZIP, Platform.LINUX, null, null, "platform not allowed for elasticsearch distribution [testdistro]"); } public void testFlavorDefault() { - ElasticsearchDistribution distro = checkDistro(createProject(null), + ElasticsearchDistribution distro = checkDistro(createProject(null, false), "testdistro", "5.0.0", Type.ARCHIVE, Platform.LINUX, null, true); assertEquals(distro.getFlavor(), Flavor.DEFAULT); } public void testFlavorForIntegTest() { - assertDistroError(createProject(null), + assertDistroError(createProject(null, false), "testdistro", "5.0.0", Type.INTEG_TEST_ZIP, null, Flavor.OSS, null, "flavor [oss] not allowed for elasticsearch distribution [testdistro] of type [integ_test_zip]"); } public void testBundledJdkDefault() { - ElasticsearchDistribution distro = checkDistro(createProject(null), + ElasticsearchDistribution distro = checkDistro(createProject(null, false), "testdistro", "5.0.0", Type.ARCHIVE, Platform.LINUX, null, true); assertTrue(distro.getBundledJdk()); } public void testBundledJdkForIntegTest() { - assertDistroError(createProject(null), "testdistro", "5.0.0", Type.INTEG_TEST_ZIP, null, null, true, + assertDistroError(createProject(null, false), "testdistro", "5.0.0", Type.INTEG_TEST_ZIP, null, null, true, "bundledJdk not allowed for elasticsearch distribution [testdistro]"); } - public void testCurrentVersionIntegTestZip() { - Project project = createProject(null); + public void testLocalCurrentVersionIntegTestZip() { + Project project = createProject(BWC_MINOR, true); Project archiveProject = ProjectBuilder.builder().withParent(archivesProject).withName("integ-test-zip").build(); archiveProject.getConfigurations().create("default"); archiveProject.getArtifacts().add("default", new File("doesnotmatter")); @@ -114,12 +114,12 @@ public void testCurrentVersionIntegTestZip() { checkPlugin(project); } - public void testCurrentVersionArchives() { + public void testLocalCurrentVersionArchives() { for (Platform platform : Platform.values()) { for (Flavor flavor : Flavor.values()) { for (boolean bundledJdk : new boolean[] { true, false}) { // create a new project in each iteration, so that we know we are resolving the only additional project being created - Project project = createProject(null); + Project project = createProject(BWC_MINOR, true); String projectName = projectName(platform.toString(), flavor, bundledJdk); projectName += (platform == Platform.WINDOWS ? "-zip" : "-tar"); Project archiveProject = ProjectBuilder.builder().withParent(archivesProject).withName(projectName).build(); @@ -133,11 +133,11 @@ public void testCurrentVersionArchives() { } } - public void testCurrentVersionPackages() { + public void testLocalCurrentVersionPackages() { for (Type packageType : new Type[] { Type.RPM, Type.DEB }) { for (Flavor flavor : Flavor.values()) { for (boolean bundledJdk : new boolean[] { true, false}) { - Project project = createProject(null); + Project project = createProject(BWC_MINOR, true); String projectName = projectName(packageType.toString(), flavor, bundledJdk); Project packageProject = ProjectBuilder.builder().withParent(packagesProject).withName(projectName).build(); packageProject.getConfigurations().create("default"); @@ -157,10 +157,10 @@ public void testLocalBwcArchives() { String configName = projectName(platform.toString(), flavor, true); configName += (platform == Platform.WINDOWS ? "-zip" : "-tar"); - checkBwc("minor", configName, BWC_MINOR_VERSION, BWC_MINOR, Type.ARCHIVE, platform, flavor); - checkBwc("staged", configName, BWC_STAGED_VERSION, BWC_STAGED, Type.ARCHIVE, platform, flavor); - checkBwc("bugfix", configName, BWC_BUGFIX_VERSION, BWC_BUGFIX, Type.ARCHIVE, platform, flavor); - checkBwc("maintenance", configName, BWC_MAINTENANCE_VERSION, BWC_MAINTENANCE, Type.ARCHIVE, platform, flavor); + checkBwc("minor", configName, BWC_MINOR_VERSION, Type.ARCHIVE, platform, flavor, BWC_MINOR, true); + checkBwc("staged", configName, BWC_STAGED_VERSION, Type.ARCHIVE, platform, flavor, BWC_STAGED, true); + checkBwc("bugfix", configName, BWC_BUGFIX_VERSION, Type.ARCHIVE, platform, flavor, BWC_BUGFIX, true); + checkBwc("maintenance", configName, BWC_MAINTENANCE_VERSION, Type.ARCHIVE, platform, flavor, BWC_MAINTENANCE, true); } } } @@ -171,10 +171,10 @@ public void testLocalBwcPackages() { // note: no non bundled jdk for bwc String configName = projectName(packageType.toString(), flavor, true); - checkBwc("minor", configName, BWC_MINOR_VERSION, BWC_MINOR, packageType, null, flavor); - checkBwc("staged", configName, BWC_STAGED_VERSION, BWC_STAGED, packageType, null, flavor); - checkBwc("bugfix", configName, BWC_BUGFIX_VERSION, BWC_BUGFIX, packageType, null, flavor); - checkBwc("maintenance", configName, BWC_MAINTENANCE_VERSION, BWC_MAINTENANCE, packageType, null, flavor); + checkBwc("minor", configName, BWC_MINOR_VERSION, packageType, null, flavor, BWC_MINOR, true); + checkBwc("staged", configName, BWC_STAGED_VERSION, packageType, null, flavor, BWC_STAGED, true); + checkBwc("bugfix", configName, BWC_BUGFIX_VERSION, packageType, null, flavor, BWC_BUGFIX, true); + checkBwc("maintenance", configName, BWC_MAINTENANCE_VERSION, packageType, null, flavor, BWC_MAINTENANCE, true); } } } @@ -222,9 +222,9 @@ private void checkPlugin(Project project) { plugin.setupDistributions(project); } - private void checkBwc(String projectName, String config, Version version, BwcVersions bwcVersions, - Type type, Platform platform, Flavor flavor) { - Project project = createProject(bwcVersions); + private void checkBwc(String projectName, String config, Version version, + Type type, Platform platform, Flavor flavor, BwcVersions bwcVersions, boolean isInternal) { + Project project = createProject(bwcVersions, isInternal); Project archiveProject = ProjectBuilder.builder().withParent(bwcProject).withName(projectName).build(); archiveProject.getConfigurations().create(config); archiveProject.getArtifacts().add(config, new File("doesnotmatter")); @@ -232,14 +232,18 @@ private void checkBwc(String projectName, String config, Version version, BwcVer checkPlugin(project); } - private Project createProject(BwcVersions bwcVersions) { + private Project createProject(BwcVersions bwcVersions, boolean isInternal) { rootProject = ProjectBuilder.builder().build(); + rootProject.getExtensions().getExtraProperties().set("isInternal", isInternal); Project distributionProject = ProjectBuilder.builder().withParent(rootProject).withName("distribution").build(); archivesProject = ProjectBuilder.builder().withParent(distributionProject).withName("archives").build(); packagesProject = ProjectBuilder.builder().withParent(distributionProject).withName("packages").build(); bwcProject = ProjectBuilder.builder().withParent(distributionProject).withName("bwc").build(); Project project = ProjectBuilder.builder().withParent(rootProject).build(); - project.getExtensions().getExtraProperties().set("bwcVersions", bwcVersions); + if (bwcVersions != null) { + project.getExtensions().getExtraProperties().set("bwcVersions", bwcVersions); + } + project.getExtensions().getExtraProperties().set("isInternal", isInternal); project.getPlugins().apply("elasticsearch.distribution-download"); return project; } diff --git a/buildSrc/src/testKit/distribution-download/build.gradle b/buildSrc/src/testKit/distribution-download/build.gradle index 82f76ff65acb7..fd6c8e12de461 100644 --- a/buildSrc/src/testKit/distribution-download/build.gradle +++ b/buildSrc/src/testKit/distribution-download/build.gradle @@ -19,26 +19,38 @@ import org.elasticsearch.gradle.Version * under the License. */ -// bring in build-tools onto the classpath plugins { - id 'elasticsearch.global-build-info' apply false + id 'elasticsearch.global-build-info' } +boolean internal = Boolean.parseBoolean(System.getProperty("tests.internal", "true")) + project.gradle.projectsEvaluated { // wire the download service url to wiremock String fakeDownloadService = System.getProperty('tests.download_service') if (fakeDownloadService != null) { - println rootProject.repositories.asMap.keySet() IvyArtifactRepository repository = (IvyArtifactRepository) rootProject.repositories.getByName("elasticsearch-downloads") repository.setUrl(fakeDownloadService) repository = (IvyArtifactRepository) project('subproj').repositories.getByName("elasticsearch-downloads") repository.setUrl(fakeDownloadService) + if (internal == false) { + repository = (IvyArtifactRepository) rootProject.repositories.getByName("elasticsearch-snapshots") + repository.setUrl(fakeDownloadService) + repository = (IvyArtifactRepository) project('subproj').repositories.getByName("elasticsearch-snapshots") + repository.setUrl(fakeDownloadService) + } } } -Version currentVersion = Version.fromString("2.0.0") -BwcVersions versions = new BwcVersions(new TreeSet<>( - Arrays.asList(Version.fromString("1.0.0"), Version.fromString("1.0.1"), Version.fromString("1.1.0"), currentVersion)), - currentVersion) allprojects { - ext.bwcVersions = versions -} \ No newline at end of file + ext.isInternal = internal +} + +if (internal) { + Version currentVersion = Version.fromString("9.0.0") + BwcVersions versions = new BwcVersions(new TreeSet<>( + Arrays.asList(Version.fromString("8.0.0"), Version.fromString("8.0.1"), Version.fromString("8.1.0"), currentVersion)), + currentVersion) + allprojects { + ext.bwcVersions = versions + } +} diff --git a/buildSrc/src/testKit/distribution-download/subproj/build.gradle b/buildSrc/src/testKit/distribution-download/subproj/build.gradle index 7584ce9a76d1c..bc7b631d5eb62 100644 --- a/buildSrc/src/testKit/distribution-download/subproj/build.gradle +++ b/buildSrc/src/testKit/distribution-download/subproj/build.gradle @@ -1,4 +1,3 @@ - plugins { id 'elasticsearch.distribution-download' }