Skip to content

Commit

Permalink
Update DistributionDownloader to support fetching arm64 bundles. (#929)
Browse files Browse the repository at this point in the history
Signed-off-by: Nicholas Walter Knize <[email protected]>
  • Loading branch information
mch2 authored and nknize committed Jul 2, 2021
1 parent f652e95 commit 25bbdb7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,16 @@ private String dependencyNotation(OpenSearchDistribution distribution) {
extension = distribution.getPlatform() == Platform.WINDOWS ? "zip" : "tar.gz";

if (distroVersion.onOrAfter("1.0.0")) {
classifier = ":" + distribution.getPlatform() + "-x64";
switch (distribution.getArchitecture()) {
case ARM64:
classifier = ":" + distribution.getPlatform() + "-arm64";
break;
case X64:
classifier = ":" + distribution.getPlatform() + "-x64";
break;
default:
throw new IllegalArgumentException("Unsupported architecture: " + distribution.getArchitecture());
}
} else if (distroVersion.onOrAfter("7.0.0")) {
classifier = ":" + distribution.getPlatform() + "-x86_64";
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,25 @@ public void testLocalCurrentVersionIntegTestZip() {
public void testLocalCurrentVersionArchives() {
for (Platform platform : Platform.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(BWC_MINOR, true);
String projectName = projectName(platform.toString(), bundledJdk);
projectName += (platform == Platform.WINDOWS ? "-zip" : "-tar");
Project archiveProject = ProjectBuilder.builder().withParent(archivesProject).withName(projectName).build();
archiveProject.getConfigurations().create("default");
archiveProject.getArtifacts().add("default", new File("doesnotmatter"));
createDistro(project, "distro", VersionProperties.getOpenSearch(), Type.ARCHIVE, platform, bundledJdk);
checkPlugin(project);
for (Architecture architecture : Architecture.values()) {
// create a new project in each iteration, so that we know we are resolving the only additional project being created
Project project = createProject(BWC_MINOR, true);
String projectName = projectName(platform.toString(), bundledJdk);
projectName += (platform == Platform.WINDOWS ? "-zip" : "-tar");
Project archiveProject = ProjectBuilder.builder().withParent(archivesProject).withName(projectName).build();
archiveProject.getConfigurations().create("default");
archiveProject.getArtifacts().add("default", new File("doesnotmatter"));
final OpenSearchDistribution distro = createDistro(
project,
"distro",
VersionProperties.getOpenSearch(),
Type.ARCHIVE,
platform,
bundledJdk
);
distro.setArchitecture(architecture);
checkPlugin(project);
}
}
}
}
Expand Down

0 comments on commit 25bbdb7

Please sign in to comment.