Add OS/architecture classifier to distributions (#37881)
This commit adds classifiers to the distributions indicating the OS (for archives) and platform. The current OSes are for windows, darwin (ie macos) and linux. This change will allow future OS/architecture specific changes to the distributions. Note the docs using distribution links have been updated, but will be reworked in a followup to make OS specific instructions for the archives.
This commit is contained in:
parent
697b2fbe52
commit
8e5f9c4b14
|
@ -183,8 +183,12 @@ if (project != rootProject) {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
distribution project(':distribution:archives:zip')
|
||||
distribution project(':distribution:archives:oss-zip')
|
||||
distribution project(':distribution:archives:windows-zip')
|
||||
distribution project(':distribution:archives:oss-windows-zip')
|
||||
distribution project(':distribution:archives:darwin-tar')
|
||||
distribution project(':distribution:archives:oss-darwin-tar')
|
||||
distribution project(':distribution:archives:linux-tar')
|
||||
distribution project(':distribution:archives:oss-linux-tar')
|
||||
}
|
||||
|
||||
String localDownloads = "${rootProject.buildDir}/local-downloads"
|
||||
|
|
|
@ -191,13 +191,21 @@ class ClusterFormationTasks {
|
|||
throw new GradleException("Unknown distribution: ${distro} in project ${project.path}")
|
||||
}
|
||||
Version version = Version.fromString(elasticsearchVersion)
|
||||
String group = "downloads.zip" // dummy group, does not matter except for integ-test-zip, it is ignored by the fake ivy repo
|
||||
String os = getOs()
|
||||
String classifier = "${os}-x86_64"
|
||||
String packaging = os.equals('windows') ? 'zip' : 'tar.gz'
|
||||
String artifactName = 'elasticsearch'
|
||||
if (distro.equals('oss') && Version.fromString(elasticsearchVersion).onOrAfter('6.3.0')) {
|
||||
artifactName += '-oss'
|
||||
}
|
||||
String snapshotProject = distro == 'oss' ? 'oss-zip' : 'zip'
|
||||
Object dependency
|
||||
String snapshotProject = "${os}-${os.equals('windows') ? 'zip' : 'tar'}"
|
||||
if (version.before("7.0.0")) {
|
||||
snapshotProject = "zip"
|
||||
}
|
||||
if (distro.equals("oss")) {
|
||||
snapshotProject = "oss-" + snapshotProject
|
||||
}
|
||||
boolean internalBuild = project.hasProperty('bwcVersions')
|
||||
VersionCollection.UnreleasedVersionInfo unreleasedInfo = null
|
||||
if (project.hasProperty('bwcVersions')) {
|
||||
|
@ -205,11 +213,16 @@ class ClusterFormationTasks {
|
|||
unreleasedInfo = project.bwcVersions.unreleasedInfo(version)
|
||||
}
|
||||
if (unreleasedInfo != null) {
|
||||
dependency = project.dependencies.project(path: ":distribution:bwc:${unreleasedInfo.gradleProjectName}", configuration: snapshotProject)
|
||||
dependency = project.dependencies.project(
|
||||
path: ":distribution:bwc:${unreleasedInfo.gradleProjectName}", configuration: snapshotProject)
|
||||
} else if (internalBuild && elasticsearchVersion.equals(VersionProperties.elasticsearch)) {
|
||||
dependency = project.dependencies.project(path: ":distribution:archives:${snapshotProject}")
|
||||
} else {
|
||||
dependency = "${group}:${artifactName}:${elasticsearchVersion}@zip"
|
||||
if (version.before('7.0.0')) {
|
||||
classifier = "" // for bwc, before we had classifiers
|
||||
}
|
||||
// group does not matter as it is not used when we pull from the ivy repo that points to the download service
|
||||
dependency = "dnm:${artifactName}:${elasticsearchVersion}${classifier}@${packaging}"
|
||||
}
|
||||
project.dependencies.add(configuration.name, dependency)
|
||||
}
|
||||
|
@ -335,8 +348,15 @@ class ClusterFormationTasks {
|
|||
the elasticsearch source tree then this should be the version of elasticsearch built by the source tree.
|
||||
If it isn't then Bad Things(TM) will happen. */
|
||||
Task extract = project.tasks.create(name: name, type: Copy, dependsOn: extractDependsOn) {
|
||||
from {
|
||||
project.zipTree(configuration.singleFile)
|
||||
if (getOs().equals("windows")) {
|
||||
from {
|
||||
project.zipTree(configuration.singleFile)
|
||||
}
|
||||
} else {
|
||||
// macos and linux use tar
|
||||
from {
|
||||
project.tarTree(project.resources.gzip(configuration.singleFile))
|
||||
}
|
||||
}
|
||||
into node.baseDir
|
||||
}
|
||||
|
@ -948,4 +968,15 @@ class ClusterFormationTasks {
|
|||
PluginPropertiesExtension extension = pluginProject.extensions.findByName('esplugin')
|
||||
return extension.name
|
||||
}
|
||||
|
||||
/** Find the current OS */
|
||||
static String getOs() {
|
||||
String os = "linux"
|
||||
if (Os.FAMILY_WINDOWS) {
|
||||
os = "windows"
|
||||
} else if (Os.FAMILY_MAC) {
|
||||
os = "darwin"
|
||||
}
|
||||
return os
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,10 +53,10 @@ class VagrantTestPlugin implements Plugin<Project> {
|
|||
|
||||
/** All distributions to bring into test VM, whether or not they are used **/
|
||||
static final List<String> DISTRIBUTIONS = unmodifiableList([
|
||||
'archives:tar',
|
||||
'archives:oss-tar',
|
||||
'archives:zip',
|
||||
'archives:oss-zip',
|
||||
'archives:linux-tar',
|
||||
'archives:oss-linux-tar',
|
||||
'archives:windows-zip',
|
||||
'archives:oss-windows-zip',
|
||||
'packages:rpm',
|
||||
'packages:oss-rpm',
|
||||
'packages:deb',
|
||||
|
|
|
@ -105,13 +105,15 @@ task buildIntegTestZip(type: Zip) {
|
|||
with archiveFiles(transportModulesFiles, 'zip', true)
|
||||
}
|
||||
|
||||
task buildZip(type: Zip) {
|
||||
task buildWindowsZip(type: Zip) {
|
||||
configure(commonZipConfig)
|
||||
archiveClassifier = 'windows-x86_64'
|
||||
with archiveFiles(modulesFiles(false), 'zip', false)
|
||||
}
|
||||
|
||||
task buildOssZip(type: Zip) {
|
||||
task buildOssWindowsZip(type: Zip) {
|
||||
configure(commonZipConfig)
|
||||
archiveClassifier = 'windows-x86_64'
|
||||
with archiveFiles(modulesFiles(true), 'zip', true)
|
||||
}
|
||||
|
||||
|
@ -122,13 +124,27 @@ Closure commonTarConfig = {
|
|||
fileMode 0644
|
||||
}
|
||||
|
||||
task buildTar(type: Tar) {
|
||||
task buildDarwinTar(type: Tar) {
|
||||
configure(commonTarConfig)
|
||||
archiveClassifier = 'darwin-x86_64'
|
||||
with archiveFiles(modulesFiles(false), 'tar', false)
|
||||
}
|
||||
|
||||
task buildOssTar(type: Tar) {
|
||||
task buildOssDarwinTar(type: Tar) {
|
||||
configure(commonTarConfig)
|
||||
archiveClassifier = 'darwin-x86_64'
|
||||
with archiveFiles(modulesFiles(true), 'tar', true)
|
||||
}
|
||||
|
||||
task buildLinuxTar(type: Tar) {
|
||||
configure(commonTarConfig)
|
||||
archiveClassifier = 'linux-x86_64'
|
||||
with archiveFiles(modulesFiles(false), 'tar', false)
|
||||
}
|
||||
|
||||
task buildOssLinuxTar(type: Tar) {
|
||||
configure(commonTarConfig)
|
||||
archiveClassifier = 'linux-x86_64'
|
||||
with archiveFiles(modulesFiles(true), 'tar', true)
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
// This file is intentionally blank. All configuration of the
|
||||
// distribution is done in the parent project.
|
|
@ -0,0 +1,2 @@
|
|||
// This file is intentionally blank. All configuration of the
|
||||
// distribution is done in the parent project.
|
|
@ -122,17 +122,34 @@ bwcVersions.forPreviousUnreleased { VersionCollection.UnreleasedVersionInfo unre
|
|||
|
||||
Map<String, File> artifactFiles = [:]
|
||||
List<String> projectDirs = []
|
||||
List<String> projects = ['zip', 'deb', 'rpm']
|
||||
List<String> projects = ['deb', 'rpm']
|
||||
if (bwcVersion.onOrAfter('7.0.0')) {
|
||||
projects.addAll(['windows-zip', 'darwin-tar', 'linux-tar'])
|
||||
} else {
|
||||
projects.add('zip')
|
||||
}
|
||||
|
||||
for (String projectName : projects) {
|
||||
String baseDir = "distribution"
|
||||
String classifier = ""
|
||||
String extension = projectName
|
||||
if (bwcVersion.onOrAfter('7.0.0') && (projectName.contains('zip') || projectName.contains('tar'))) {
|
||||
int index = projectName.indexOf('-')
|
||||
classifier = "-${projectName.substring(0, index)}-x86_64"
|
||||
extension = projectName.substring(index + 1)
|
||||
if (extension.equals('tar')) {
|
||||
extension += '.gz'
|
||||
}
|
||||
}
|
||||
if (bwcVersion.onOrAfter('6.3.0')) {
|
||||
baseDir += projectName == 'zip' ? '/archives' : '/packages'
|
||||
baseDir += projectName.endsWith('zip') || projectName.endsWith('tar') ? '/archives' : '/packages'
|
||||
// add oss variant first
|
||||
projectDirs.add("${baseDir}/oss-${projectName}")
|
||||
artifactFiles.put("oss-" + projectName, file("${checkoutDir}/${baseDir}/oss-${projectName}/build/distributions/elasticsearch-oss-${bwcVersion}-SNAPSHOT.${projectName}"))
|
||||
artifactFiles.put("oss-" + projectName, file("${checkoutDir}/${baseDir}/oss-${projectName}/build/distributions/elasticsearch-oss-${bwcVersion}-SNAPSHOT${classifier}.${extension}"))
|
||||
}
|
||||
projectDirs.add("${baseDir}/${projectName}")
|
||||
artifactFiles.put(projectName, file("${checkoutDir}/${baseDir}/${projectName}/build/distributions/elasticsearch-${bwcVersion}-SNAPSHOT.${projectName}"))
|
||||
artifactFiles.put(projectName,
|
||||
file("${checkoutDir}/${baseDir}/${projectName}/build/distributions/elasticsearch-${bwcVersion}-SNAPSHOT${classifier}.${extension}"))
|
||||
}
|
||||
|
||||
Closure createRunBwcGradleTask = { name, extraConfig ->
|
||||
|
@ -216,9 +233,15 @@ bwcVersions.forPreviousUnreleased { VersionCollection.UnreleasedVersionInfo unre
|
|||
String artifactFileName = artifactFile.name
|
||||
String artifactName = artifactFileName.contains('oss') ? 'elasticsearch-oss' : 'elasticsearch'
|
||||
String suffix = artifactFile.toString()[-3..-1]
|
||||
int archIndex = artifactFileName.indexOf('x86_64')
|
||||
String classifier = ''
|
||||
if (archIndex != -1) {
|
||||
int osIndex = artifactFileName.lastIndexOf('-', archIndex - 2)
|
||||
classifier = "${artifactFileName.substring(osIndex + 1, archIndex - 1)}-x86_64"
|
||||
}
|
||||
configurations.create(projectName)
|
||||
artifacts {
|
||||
it.add(projectName, [file: artifactFile, name: artifactName, type: suffix, builtBy: buildBwcVersion])
|
||||
it.add(projectName, [file: artifactFile, name: artifactName, classifier: classifier, type: suffix, builtBy: buildBwcVersion])
|
||||
}
|
||||
}
|
||||
// make sure no dependencies were added to assemble; we want it to be a no-op
|
||||
|
|
|
@ -13,8 +13,8 @@ configurations {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
dockerSource project(path: ":distribution:archives:tar")
|
||||
ossDockerSource project(path: ":distribution:archives:oss-tar")
|
||||
dockerSource project(path: ":distribution:archives:linux-tar")
|
||||
ossDockerSource project(path: ":distribution:archives:oss-linux-tar")
|
||||
}
|
||||
|
||||
ext.expansions = { oss ->
|
||||
|
|
|
@ -101,8 +101,9 @@ Closure commonPackageConfig(String type, boolean oss) {
|
|||
return {
|
||||
dependsOn "process${oss ? 'Oss' : ''}${type.capitalize()}Files"
|
||||
packageName "elasticsearch${oss ? '-oss' : ''}"
|
||||
arch (type == 'deb' ? 'amd64' : 'X86_64')
|
||||
// Follow elasticsearch's file naming convention
|
||||
archiveName "${packageName}-${project.version}.${type}"
|
||||
archiveName "${packageName}-${project.version}-${archString}.${type}"
|
||||
|
||||
String prefix = "${oss ? 'oss-' : ''}${type}"
|
||||
destinationDir = file("${prefix}/build/distributions")
|
||||
|
@ -333,7 +334,6 @@ Closure commonRpmConfig(boolean oss) {
|
|||
packager 'Elasticsearch'
|
||||
version = project.version.replace('-', '_')
|
||||
release = '1'
|
||||
arch 'NOARCH'
|
||||
os 'LINUX'
|
||||
distribution 'Elasticsearch'
|
||||
vendor 'Elasticsearch'
|
||||
|
|
|
@ -150,17 +150,17 @@ The Debian package for Elasticsearch v{version} can be downloaded from the websi
|
|||
|
||||
["source","sh",subs="attributes"]
|
||||
--------------------------------------------
|
||||
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.deb
|
||||
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.deb.sha512
|
||||
shasum -a 512 -c elasticsearch-{version}.deb.sha512 <1>
|
||||
sudo dpkg -i elasticsearch-{version}.deb
|
||||
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}-amd64.deb
|
||||
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}-amd64.deb.sha512
|
||||
shasum -a 512 -c elasticsearch-{version}-amd64.deb.sha512 <1>
|
||||
sudo dpkg -i elasticsearch-{version}-amd64.deb
|
||||
--------------------------------------------
|
||||
<1> Compares the SHA of the downloaded Debian package and the published checksum, which should output
|
||||
`elasticsearch-{version}.deb: OK`.
|
||||
`elasticsearch-{version}-amd64.deb: OK`.
|
||||
|
||||
Alternatively, you can download the following package, which contains only
|
||||
features that are available under the Apache 2.0 license:
|
||||
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-{version}.deb
|
||||
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-{version}-amd64.deb
|
||||
|
||||
endif::[]
|
||||
|
||||
|
|
|
@ -135,17 +135,17 @@ The RPM for Elasticsearch v{version} can be downloaded from the website and inst
|
|||
|
||||
["source","sh",subs="attributes"]
|
||||
--------------------------------------------
|
||||
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.rpm
|
||||
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.rpm.sha512
|
||||
shasum -a 512 -c elasticsearch-{version}.rpm.sha512 <1>
|
||||
sudo rpm --install elasticsearch-{version}.rpm
|
||||
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}-x86_64.rpm
|
||||
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}-x86_64.rpm.sha512
|
||||
shasum -a 512 -c elasticsearch-{version}-x86_64.rpm.sha512 <1>
|
||||
sudo rpm --install elasticsearch-{version}-x86_64.rpm
|
||||
--------------------------------------------
|
||||
<1> Compares the SHA of the downloaded RPM and the published checksum, which should output
|
||||
`elasticsearch-{version}.rpm: OK`.
|
||||
`elasticsearch-{version}-x86_64.rpm: OK`.
|
||||
|
||||
Alternatively, you can download the following package, which contains only
|
||||
features that are available under the Apache 2.0 license:
|
||||
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-{version}.rpm
|
||||
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-{version}-x86_64.rpm
|
||||
|
||||
endif::[]
|
||||
|
||||
|
|
|
@ -32,19 +32,19 @@ The `.zip` archive for Elasticsearch v{version} can be downloaded and installed
|
|||
|
||||
["source","sh",subs="attributes"]
|
||||
--------------------------------------------
|
||||
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.zip
|
||||
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.zip.sha512
|
||||
shasum -a 512 -c elasticsearch-{version}.zip.sha512 <1>
|
||||
unzip elasticsearch-{version}.zip
|
||||
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}-windows-x86_64.zip
|
||||
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}-windows-x86_64.zip.sha512
|
||||
shasum -a 512 -c elasticsearch-{version}-windows-x86_64.zip.sha512 <1>
|
||||
unzip elasticsearch-{version}-windows-x86_64.zip
|
||||
cd elasticsearch-{version}/ <2>
|
||||
--------------------------------------------
|
||||
<1> Compares the SHA of the downloaded `.zip` archive and the published checksum, which should output
|
||||
`elasticsearch-{version}.zip: OK`.
|
||||
`elasticsearch-{version}-windows-x86_64.zip: OK`.
|
||||
<2> This directory is known as `$ES_HOME`.
|
||||
|
||||
Alternatively, you can download the following package, which contains only
|
||||
features that are available under the Apache 2.0 license:
|
||||
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-{version}.zip
|
||||
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-{version}-windows-x86_64.zip
|
||||
|
||||
endif::[]
|
||||
|
||||
|
@ -64,19 +64,19 @@ The `.tar.gz` archive for Elasticsearch v{version} can be downloaded and install
|
|||
|
||||
["source","sh",subs="attributes"]
|
||||
--------------------------------------------
|
||||
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.tar.gz
|
||||
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.tar.gz.sha512
|
||||
shasum -a 512 -c elasticsearch-{version}.tar.gz.sha512 <1>
|
||||
tar -xzf elasticsearch-{version}.tar.gz
|
||||
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}-linux-x86_64.tar.gz
|
||||
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}-linux-x86_64.tar.gz.sha512
|
||||
shasum -a 512 -c elasticsearch-{version}-linux-x86_64.tar.gz.sha512 <1>
|
||||
tar -xzf elasticsearch-{version}-linux-x86_64.tar.gz
|
||||
cd elasticsearch-{version}/ <2>
|
||||
--------------------------------------------
|
||||
<1> Compares the SHA of the downloaded `.tar.gz` archive and the published checksum, which should output
|
||||
`elasticsearch-{version}.tar.gz: OK`.
|
||||
`elasticsearch-{version}-linux-x86_64.tar.gz: OK`.
|
||||
<2> This directory is known as `$ES_HOME`.
|
||||
|
||||
Alternatively, you can download the following package, which includes only
|
||||
Apache 2.0 licensed code:
|
||||
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-{version}.tar.gz
|
||||
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-{version}-linux-x86_64.tar.gz
|
||||
|
||||
endif::[]
|
||||
|
||||
|
|
|
@ -31,11 +31,11 @@ endif::[]
|
|||
|
||||
ifeval::["{release-state}"!="unreleased"]
|
||||
|
||||
Download the `.zip` archive for Elasticsearch v{version} from: https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.zip
|
||||
Download the `.zip` archive for Elasticsearch v{version} from: https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}-windows-x86_64.zip
|
||||
|
||||
Alternatively, you can download the following package, which contains only
|
||||
features that are available under the Apache 2.0 license:
|
||||
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-{version}.zip
|
||||
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-{version}-windows-x86_64.zip
|
||||
|
||||
Unzip it with your favourite unzip tool. This will create a folder called
|
||||
+elasticsearch-{version}+, which we will refer to as `%ES_HOME%`. In a terminal
|
||||
|
|
|
@ -285,7 +285,7 @@ public abstract class ArchiveTestCase extends PackagingTestCase {
|
|||
final Installation.Executables bin = installation.executables();
|
||||
final Shell sh = new Shell();
|
||||
|
||||
if (distribution().equals(Distribution.DEFAULT_TAR) || distribution().equals(Distribution.DEFAULT_ZIP)) {
|
||||
if (distribution().equals(Distribution.DEFAULT_LINUX) || distribution().equals(Distribution.DEFAULT_WINDOWS)) {
|
||||
assertTrue(Files.exists(installation.lib.resolve("tools").resolve("security-cli")));
|
||||
Platforms.onLinux(() -> {
|
||||
final Result result = sh.run(bin.elasticsearchCertutil + " help");
|
||||
|
@ -296,7 +296,7 @@ public abstract class ArchiveTestCase extends PackagingTestCase {
|
|||
final Result result = sh.run(bin.elasticsearchCertutil + " help");
|
||||
assertThat(result.stdout, containsString("Simplifies certificate creation for use with the Elastic Stack"));
|
||||
});
|
||||
} else if (distribution().equals(Distribution.OSS_TAR) || distribution().equals(Distribution.OSS_ZIP)) {
|
||||
} else if (distribution().equals(Distribution.OSS_LINUX) || distribution().equals(Distribution.OSS_WINDOWS)) {
|
||||
assertFalse(Files.exists(installation.lib.resolve("tools").resolve("security-cli")));
|
||||
}
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ public abstract class ArchiveTestCase extends PackagingTestCase {
|
|||
assertThat(result.stdout, containsString("A CLI tool to remove corrupted parts of unrecoverable shards"));
|
||||
};
|
||||
|
||||
if (distribution().equals(Distribution.DEFAULT_TAR) || distribution().equals(Distribution.DEFAULT_ZIP)) {
|
||||
if (distribution().equals(Distribution.DEFAULT_LINUX) || distribution().equals(Distribution.DEFAULT_WINDOWS)) {
|
||||
Platforms.onLinux(action);
|
||||
Platforms.onWindows(action);
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ public abstract class ArchiveTestCase extends PackagingTestCase {
|
|||
containsString("A CLI tool to unsafely recover a cluster after the permanent loss of too many master-eligible nodes"));
|
||||
};
|
||||
|
||||
if (distribution().equals(Distribution.DEFAULT_TAR) || distribution().equals(Distribution.DEFAULT_ZIP)) {
|
||||
if (distribution().equals(Distribution.DEFAULT_LINUX) || distribution().equals(Distribution.DEFAULT_WINDOWS)) {
|
||||
Platforms.onLinux(action);
|
||||
Platforms.onWindows(action);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,6 @@ public class DefaultTarTests extends ArchiveTestCase {
|
|||
|
||||
@Override
|
||||
protected Distribution distribution() {
|
||||
return Distribution.DEFAULT_TAR;
|
||||
return Distribution.DEFAULT_LINUX;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,6 @@ public class DefaultWindowsServiceTests extends WindowsServiceTestCase {
|
|||
|
||||
@Override
|
||||
protected Distribution distribution() {
|
||||
return Distribution.DEFAULT_ZIP;
|
||||
return Distribution.DEFAULT_WINDOWS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,6 @@ public class DefaultZipTests extends ArchiveTestCase {
|
|||
|
||||
@Override
|
||||
protected Distribution distribution() {
|
||||
return Distribution.DEFAULT_ZIP;
|
||||
return Distribution.DEFAULT_WINDOWS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,6 @@ public class OssTarTests extends ArchiveTestCase {
|
|||
|
||||
@Override
|
||||
protected Distribution distribution() {
|
||||
return Distribution.OSS_TAR;
|
||||
return Distribution.OSS_LINUX;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,6 @@ public class OssWindowsServiceTests extends WindowsServiceTestCase {
|
|||
|
||||
@Override
|
||||
protected Distribution distribution() {
|
||||
return Distribution.OSS_ZIP;
|
||||
return Distribution.OSS_WINDOWS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,6 @@ public class OssZipTests extends ArchiveTestCase {
|
|||
|
||||
@Override
|
||||
protected Distribution distribution() {
|
||||
return Distribution.OSS_ZIP;
|
||||
return Distribution.OSS_WINDOWS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,10 +43,7 @@ import static org.elasticsearch.packaging.util.Packages.verifyPackageInstallatio
|
|||
import static org.elasticsearch.packaging.util.Platforms.isRPM;
|
||||
import static org.elasticsearch.packaging.util.Platforms.isSystemd;
|
||||
import static org.hamcrest.CoreMatchers.notNullValue;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.core.Is.is;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assume.assumeThat;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ public class Archives {
|
|||
final Path baseInstallPath = fullInstallPath.getParent();
|
||||
final Path extractedPath = baseInstallPath.resolve("elasticsearch-" + version);
|
||||
|
||||
assertThat("distribution file must exist", Files.exists(distributionFile), is(true));
|
||||
assertThat("distribution file must exist: " + distributionFile.toString(), Files.exists(distributionFile), is(true));
|
||||
assertThat("elasticsearch must not already be installed", lsGlob(baseInstallPath, "elasticsearch*"), empty());
|
||||
|
||||
if (distribution.packaging == Distribution.Packaging.TAR) {
|
||||
|
|
|
@ -19,28 +19,46 @@
|
|||
|
||||
package org.elasticsearch.packaging.util;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum Distribution {
|
||||
|
||||
OSS_TAR(Packaging.TAR, Flavor.OSS),
|
||||
OSS_ZIP(Packaging.ZIP, Flavor.OSS),
|
||||
OSS_DEB(Packaging.DEB, Flavor.OSS),
|
||||
OSS_RPM(Packaging.RPM, Flavor.OSS),
|
||||
OSS_LINUX(Packaging.TAR, Platform.LINUX, Flavor.OSS),
|
||||
OSS_WINDOWS(Packaging.ZIP, Platform.WINDOWS, Flavor.OSS),
|
||||
OSS_DARWIN(Packaging.TAR, Platform.DARWIN, Flavor.OSS),
|
||||
OSS_DEB(Packaging.DEB, Platform.LINUX, Flavor.OSS),
|
||||
OSS_RPM(Packaging.RPM, Platform.LINUX, Flavor.OSS),
|
||||
|
||||
DEFAULT_TAR(Packaging.TAR, Flavor.DEFAULT),
|
||||
DEFAULT_ZIP(Packaging.ZIP, Flavor.DEFAULT),
|
||||
DEFAULT_DEB(Packaging.DEB, Flavor.DEFAULT),
|
||||
DEFAULT_RPM(Packaging.RPM, Flavor.DEFAULT);
|
||||
DEFAULT_LINUX(Packaging.TAR, Platform.LINUX, Flavor.DEFAULT),
|
||||
DEFAULT_WINDOWS(Packaging.ZIP, Platform.WINDOWS, Flavor.DEFAULT),
|
||||
DEFAULT_DARWIN(Packaging.TAR, Platform.DARWIN, Flavor.DEFAULT),
|
||||
DEFAULT_DEB(Packaging.DEB, Platform.LINUX, Flavor.DEFAULT),
|
||||
DEFAULT_RPM(Packaging.RPM, Platform.LINUX, Flavor.DEFAULT);
|
||||
|
||||
public final Packaging packaging;
|
||||
public final Platform platform;
|
||||
public final Flavor flavor;
|
||||
|
||||
Distribution(Packaging packaging, Flavor flavor) {
|
||||
Distribution(Packaging packaging, Platform platform, Flavor flavor) {
|
||||
this.packaging = packaging;
|
||||
this.platform = platform;
|
||||
this.flavor = flavor;
|
||||
}
|
||||
|
||||
public String filename(String version) {
|
||||
return flavor.name + "-" + version + packaging.extension;
|
||||
String architecture = "";
|
||||
if (version.startsWith("6.") == false) {
|
||||
|
||||
if (packaging == Packaging.DEB) {
|
||||
architecture = "-amd64";
|
||||
} else {
|
||||
if (packaging != Packaging.RPM) {
|
||||
architecture = "-" + platform.toString();
|
||||
}
|
||||
architecture += "-x86_64";
|
||||
}
|
||||
}
|
||||
return flavor.name + "-" + version + architecture + packaging.extension;
|
||||
}
|
||||
|
||||
public boolean isDefault() {
|
||||
|
@ -53,8 +71,8 @@ public enum Distribution {
|
|||
|
||||
public enum Packaging {
|
||||
|
||||
TAR(".tar.gz", Platforms.LINUX),
|
||||
ZIP(".zip", true),
|
||||
TAR(".tar.gz", Platforms.LINUX || Platforms.DARWIN),
|
||||
ZIP(".zip", Platforms.WINDOWS),
|
||||
DEB(".deb", Platforms.isDPKG()),
|
||||
RPM(".rpm", Platforms.isRPM());
|
||||
|
||||
|
@ -70,6 +88,16 @@ public enum Distribution {
|
|||
}
|
||||
}
|
||||
|
||||
public enum Platform {
|
||||
LINUX,
|
||||
WINDOWS,
|
||||
DARWIN;
|
||||
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
public enum Flavor {
|
||||
|
||||
OSS("elasticsearch-oss"),
|
||||
|
|
|
@ -27,6 +27,7 @@ public class Platforms {
|
|||
public static final String OS_NAME = System.getProperty("os.name");
|
||||
public static final boolean LINUX = OS_NAME.startsWith("Linux");
|
||||
public static final boolean WINDOWS = OS_NAME.startsWith("Windows");
|
||||
public static final boolean DARWIN = OS_NAME.startsWith("Mac OS X");
|
||||
|
||||
public static String getOsRelease() {
|
||||
if (LINUX) {
|
||||
|
|
|
@ -73,10 +73,16 @@ install_package() {
|
|||
;;
|
||||
esac
|
||||
done
|
||||
local rpm_classifier="-x86_64"
|
||||
local deb_classifier="-amd64"
|
||||
if [[ $version == 6* ]]; then
|
||||
rpm_classifier=""
|
||||
deb_classifier=""
|
||||
fi
|
||||
if is_rpm; then
|
||||
rpm $rpmCommand $PACKAGE_NAME-$version.rpm
|
||||
rpm $rpmCommand $PACKAGE_NAME-$version$rpm_classifier.rpm
|
||||
elif is_dpkg; then
|
||||
run dpkg $dpkgCommand -i $PACKAGE_NAME-$version.deb
|
||||
run dpkg $dpkgCommand -i $PACKAGE_NAME-$version$deb_classifier.deb
|
||||
[[ "$status" -eq 0 ]] || {
|
||||
echo "dpkg failed:"
|
||||
echo "$output"
|
||||
|
|
|
@ -40,7 +40,7 @@ install_archive() {
|
|||
echo "Unpacking tarball to $ESHOME"
|
||||
rm -rf /tmp/untar
|
||||
mkdir -p /tmp/untar
|
||||
tar -xzpf "${PACKAGE_NAME}-${version}.tar.gz" -C /tmp/untar
|
||||
tar -xzpf "${PACKAGE_NAME}-${version}-linux-x86_64.tar.gz" -C /tmp/untar
|
||||
|
||||
find /tmp/untar -depth -type d -name 'elasticsearch*' -exec mv {} "$ESHOME" \; > /dev/null
|
||||
|
||||
|
|
|
@ -16,10 +16,12 @@ List projects = [
|
|||
'client:benchmark',
|
||||
'benchmarks',
|
||||
'distribution:archives:integ-test-zip',
|
||||
'distribution:archives:oss-zip',
|
||||
'distribution:archives:zip',
|
||||
'distribution:archives:oss-tar',
|
||||
'distribution:archives:tar',
|
||||
'distribution:archives:oss-windows-zip',
|
||||
'distribution:archives:windows-zip',
|
||||
'distribution:archives:oss-darwin-tar',
|
||||
'distribution:archives:darwin-tar',
|
||||
'distribution:archives:oss-linux-tar',
|
||||
'distribution:archives:linux-tar',
|
||||
'distribution:docker',
|
||||
'distribution:packages:oss-deb',
|
||||
'distribution:packages:deb',
|
||||
|
|
Loading…
Reference in New Issue