Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport] [2.x] add support for ppc64le architecture (#5459) #6223

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Adds support for minimum compatible version for extensions ([#6003](https://github.com/opensearch-project/OpenSearch/pull/6003))
- Add a guardrail to limit maximum number of shard on the cluster ([#6143](https://github.com/opensearch-project/OpenSearch/pull/6143))
- Add cancellation of in-flight SearchTasks based on resource consumption ([#5606](https://github.com/opensearch-project/OpenSearch/pull/5605))
- Add support for ppc64le architecture ([#5459](https://github.com/opensearch-project/OpenSearch/pull/5459))

### Dependencies
- Update nebula-publishing-plugin to 19.2.0 ([#5704](https://github.com/opensearch-project/OpenSearch/pull/5704))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public enum Architecture {

X64,
ARM64,
S390X;
S390X,
PPC64LE;

public static Architecture current() {
final String architecture = System.getProperty("os.arch", "");
Expand All @@ -48,6 +49,8 @@ public static Architecture current() {
return ARM64;
case "s390x":
return S390X;
case "ppc64le":
return PPC64LE;
default:
throw new IllegalArgumentException("can not determine architecture from [" + architecture + "]");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ private String dependencyNotation(OpenSearchDistribution distribution) {
case S390X:
classifier = ":" + distribution.getPlatform() + "-s390x";
break;
case PPC64LE:
classifier = ":" + distribution.getPlatform() + "-ppc64le";
break;
default:
throw new IllegalArgumentException("Unsupported architecture: " + distribution.getArchitecture());
}
Expand Down
4 changes: 3 additions & 1 deletion buildSrc/src/main/java/org/opensearch/gradle/Jdk.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@

public class Jdk implements Buildable, Iterable<File> {

private static final List<String> ALLOWED_ARCHITECTURES = Collections.unmodifiableList(Arrays.asList("aarch64", "x64", "s390x"));
private static final List<String> ALLOWED_ARCHITECTURES = Collections.unmodifiableList(
Arrays.asList("aarch64", "x64", "s390x", "ppc64le")
);
private static final List<String> ALLOWED_VENDORS = Collections.unmodifiableList(Arrays.asList("adoptium", "adoptopenjdk", "openjdk"));
private static final List<String> ALLOWED_PLATFORMS = Collections.unmodifiableList(
Arrays.asList("darwin", "freebsd", "linux", "mac", "windows")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public void testCurrentArchitecture() {
assertEquals(Architecture.X64, currentArchitecture("x86_64"));
assertEquals(Architecture.ARM64, currentArchitecture("aarch64"));
assertEquals(Architecture.S390X, currentArchitecture("s390x"));
assertEquals(Architecture.PPC64LE, currentArchitecture("ppc64le"));
}

public void testInvalidCurrentArchitecture() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void testUnknownArchitecture() {
"11.0.2+33",
"linux",
"unknown",
"unknown architecture [unknown] for jdk [testjdk], must be one of [aarch64, x64, s390x]"
"unknown architecture [unknown] for jdk [testjdk], must be one of [aarch64, x64, s390x, ppc64le]"
);
}

Expand Down
9 changes: 9 additions & 0 deletions distribution/archives/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,15 @@ distribution_archives {
}
}

// Should really be `no-jdk-linux-ppc64le` as it ships without a JDK, however it seems that the build can't handle
// the absence of the `linux-ppc64le` target.
linuxPpc64leTar {
archiveClassifier = 'linux-ppc64le'
content {
archiveFiles(modulesFiles('linux-ppc64le'), 'tar', 'linux', 'ppc64le', false)
}
}

windowsZip {
archiveClassifier = 'windows-x64'
content {
Expand Down
4 changes: 2 additions & 2 deletions distribution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
// Setup all required JDKs
project.jdks {
['darwin', 'linux', 'windows'].each { platform ->
(platform == 'linux' || platform == 'darwin' ? ['x64', 'aarch64', 's390x'] : ['x64']).each { architecture ->
(platform == 'linux' || platform == 'darwin' ? ['x64', 'aarch64', 's390x', 'ppc64le'] : ['x64']).each { architecture ->
"bundled_${platform}_${architecture}" {
it.platform = platform
it.version = VersionProperties.getBundledJdk(platform)
Expand Down Expand Up @@ -353,7 +353,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
}
}
def buildModules = buildModulesTaskProvider
List excludePlatforms = ['darwin-x64', 'freebsd-x64', 'linux-x64', 'linux-arm64', 'linux-s390x', 'windows-x64', 'darwin-arm64']
List excludePlatforms = ['darwin-x64', 'freebsd-x64', 'linux-x64', 'linux-arm64', 'linux-s390x', 'linux-ppc64le', 'windows-x64', 'darwin-arm64']
if (platform != null) {
excludePlatforms.remove(excludePlatforms.indexOf(platform))
} else {
Expand Down
8 changes: 8 additions & 0 deletions distribution/docker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ testFixtures.useFixture()
configurations {
arm64DockerSource
s390xDockerSource
ppc64leDockerSource
dockerSource
}

dependencies {
arm64DockerSource project(path: ":distribution:archives:linux-arm64-tar", configuration:"default")
s390xDockerSource project(path: ":distribution:archives:linux-s390x-tar", configuration:"default")
ppc64leDockerSource project(path: ":distribution:archives:linux-ppc64le-tar", configuration:"default")
dockerSource project(path: ":distribution:archives:linux-tar", configuration:"default")
}

Expand All @@ -46,6 +48,8 @@ ext.expansions = { Architecture architecture, DockerBase base, boolean local ->
classifier = "linux-x64"
} else if (architecture == Architecture.S390X) {
classifier = "linux-s390x"
} else if (architecture == Architecture.PPC64LE) {
classifier = "linux-ppc64le"
} else {
throw new IllegalArgumentException("Unsupported architecture [" + architecture + "]")
}
Expand Down Expand Up @@ -90,13 +94,15 @@ private static String buildPath(Architecture architecture, DockerBase base) {
return 'build/' +
(architecture == Architecture.ARM64 ? 'arm64-' : '') +
(architecture == Architecture.S390X ? 's390x-' : '') +
(architecture == Architecture.PPC64LE ? 'ppc64le-' : '') +
'docker'
}

private static String taskName(String prefix, Architecture architecture, DockerBase base, String suffix) {
return prefix +
(architecture == Architecture.ARM64 ? 'Arm64' : '') +
(architecture == Architecture.S390X ? 'S390x' : '') +
(architecture == Architecture.PPC64LE ? 'Ppc64le' : '') +
suffix
}

Expand Down Expand Up @@ -135,6 +141,8 @@ void addCopyDockerContextTask(Architecture architecture, DockerBase base) {
from configurations.arm64DockerSource
} else if (architecture == Architecture.S390X) {
from configurations.s390xDockerSource
} else if (architecture == Architecture.PPC64LE) {
from configurations.ppc64leDockerSource
} else {
from configurations.dockerSource
}
Expand Down
12 changes: 12 additions & 0 deletions distribution/docker/docker-ppc64le-export/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
*/

// This file is intentionally blank. All configuration of the
// export is done in the parent project.
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ static class Arch {
m.put("amd64", new Arch(0xC000003E, 0x3FFFFFFF, 57, 58, 59, 322, 317));
m.put("aarch64", new Arch(0xC00000B7, 0xFFFFFFFF, 1079, 1071, 221, 281, 277));
m.put("s390x", new Arch(0x80000016, 0xFFFFFFFF, 2, 190, 11, 354, 348));
m.put("ppc64le", new Arch(0xC0000015, 0xFFFFFFFF, 2, 189, 11, 362, 358));
ARCHITECTURES = Collections.unmodifiableMap(m);
}

Expand Down
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ List projects = [
'distribution:archives:linux-arm64-tar',
'distribution:archives:no-jdk-linux-arm64-tar',
'distribution:archives:linux-s390x-tar',
'distribution:archives:linux-ppc64le-tar',
'distribution:archives:linux-tar',
'distribution:archives:no-jdk-linux-tar',
'distribution:docker',
'distribution:docker:docker-arm64-build-context',
'distribution:docker:docker-arm64-export',
'distribution:docker:docker-s390x-export',
'distribution:docker:docker-ppc64le-export',
'distribution:docker:docker-build-context',
'distribution:docker:docker-export',
'distribution:packages:arm64-deb',
Expand Down