From ae8ead02245e18473c1d867f0be7db681f47d9d6 Mon Sep 17 00:00:00 2001 From: Himanshu Setia <58999915+setiah@users.noreply.github.com> Date: Wed, 24 Feb 2021 16:31:10 -0800 Subject: [PATCH] Merge main into oss-docs and fix related bootstrap and test failures (#137) * Remove any non oss from build, package, and distribution (#102) This commit changes the building, packaging, and testing framework to only support OSS on different distributions. Next steps: completely remove -oss flag dependencies in package and build tests move 6.x bwc testing to be an explicit option remove any references to elastic.co download site (or replace with downloads from the OSS website) Co-authored-by: Himanshu Setia Co-authored-by: Rabi Panda Co-authored-by: Himanshu Setia <58999915+setiah@users.noreply.github.com> Co-authored-by: Sarat Vemulapalli * Remove x-pact from RESI API username and password (#117) * Update signoff message (#121) Signed-off-by: Harold Wang * Update CI workflow to work on new infra (#123) * Update CI workflow to work on new infra - Backward compatability tests are disabled during CI by default #113 - Added property to allow for disabling bwc tests - Added agent label to use specific hardware https://www.jenkins.io/doc/book/pipeline/syntax/#agent Signed-off-by: Peter Nied * Disable BWC checks. (#130) As part of this PR, we are disabling the BWC checks. Once we have finalized the versions for the fork, we can re-enable it with right configurations. Relates #105 Signed-off-by: Rabi Panda * Adding test distribution logic to fix failures from main merge Co-authored-by: Nick Knize Co-authored-by: Rabi Panda Co-authored-by: Sarat Vemulapalli Co-authored-by: Harold Wang <74381974+harold-wang@users.noreply.github.com> Co-authored-by: Peter Nied --- CONTRIBUTING.md | 38 ++++ Jenkinsfile | 6 +- build.gradle | 5 +- buildSrc/build.gradle | 4 - .../DistributionDownloadPluginFuncTest.groovy | 4 +- .../fixtures/AbstractGradleFuncTest.groovy | 1 + .../DistributionDownloadFixture.groovy | 2 +- ...tributionArchiveSetupPluginFuncTest.groovy | 16 +- ...lDistributionBwcSetupPluginFuncTest.groovy | 33 ++- ...lDistributionDownloadPluginFuncTest.groovy | 14 +- .../remote/distribution/archives/build.gradle | 2 +- .../internal/fake_git/remote/settings.gradle | 1 - .../gradle/doc/DocsTestPlugin.groovy | 5 +- .../gradle/test/ClusterFormationTasks.groovy | 23 +- .../gradle/DistributionDownloadPlugin.java | 39 +--- .../org/elasticsearch/gradle/DockerBase.java | 4 +- .../gradle/ElasticsearchDistribution.java | 41 +--- .../gradle/RepositoriesSetupPlugin.java | 1 + ...nternalDistributionArchiveSetupPlugin.java | 2 +- .../InternalDistributionBwcSetupPlugin.java | 23 +- .../InternalDistributionDownloadPlugin.java | 11 +- .../gradle/test/DistroTestPlugin.java | 119 +++++------ .../testclusters/ElasticsearchNode.java | 6 - .../DistributionDownloadPluginTests.java | 153 ++++--------- .../client/core/MainResponse.java | 19 +- .../elasticsearch/client/PingAndInfoIT.java | 1 - .../client/RestHighLevelClientTests.java | 3 +- .../client/core/MainResponseTests.java | 3 +- .../MiscellaneousDocumentationIT.java | 2 - distribution/archives/build.gradle | 80 ++----- distribution/archives/darwin-tar/build.gradle | 2 - .../archives/linux-aarch64-tar/build.gradle | 2 - distribution/archives/linux-tar/build.gradle | 2 - .../archives/no-jdk-darwin-tar/build.gradle | 2 - .../archives/no-jdk-linux-tar/build.gradle | 2 - .../archives/no-jdk-windows-zip/build.gradle | 2 - .../archives/windows-zip/build.gradle | 2 - distribution/build.gradle | 77 ++----- distribution/docker/build.gradle | 122 ++++------- .../docker/docker-aarch64-export/build.gradle | 2 - .../docker/docker-build-context/build.gradle | 14 -- .../docker/docker-export/build.gradle | 2 - distribution/docker/docker-test-entrypoint.sh | 2 +- .../oss-docker-build-context/build.gradle | 2 +- distribution/docker/src/docker/Dockerfile | 18 +- .../docker/test/DockerYmlTestSuiteIT.java | 61 +----- .../ubi-docker-aarch64-export/build.gradle | 2 - .../ubi-docker-build-context/build.gradle | 13 -- .../docker/ubi-docker-export/build.gradle | 2 - .../packages/aarch64-deb/build.gradle | 2 - .../packages/aarch64-rpm/build.gradle | 2 - distribution/packages/build.gradle | 110 +++------- distribution/packages/deb/build.gradle | 2 - distribution/packages/no-jdk-deb/build.gradle | 2 - distribution/packages/no-jdk-rpm/build.gradle | 2 - .../src/main/resources/logo/elastic.gif | Bin 1865 -> 0 bytes distribution/packages/rpm/build.gradle | 2 - .../rpm/src/main/resources/logo/elastic.gif | Bin 1865 -> 0 bytes distribution/src/bin/elasticsearch | 2 - distribution/src/bin/elasticsearch-cli | 1 - distribution/src/bin/elasticsearch-cli.bat | 1 - distribution/src/bin/elasticsearch-env | 1 - distribution/src/bin/elasticsearch-env.bat | 1 - .../src/bin/elasticsearch-service.bat | 2 +- distribution/src/bin/elasticsearch.bat | 1 - docs/plugins/discovery-azure-classic.asciidoc | 1 - docs/reference/cluster/nodes-info.asciidoc | 2 - .../setup/install/check-running.asciidoc | 1 - gradle/local-distribution.gradle | 1 - .../packaging/test/ArchiveTests.java | 12 -- .../packaging/test/DebMetadataTests.java | 7 - .../packaging/test/DebPreservationTests.java | 31 --- .../packaging/test/DockerTests.java | 201 +----------------- .../test/KeystoreManagementTests.java | 1 - .../packaging/test/PackagingTestCase.java | 4 - .../packaging/test/RpmMetadataTests.java | 7 - .../packaging/test/RpmPreservationTests.java | 9 - .../packaging/util/Distribution.java | 29 +-- .../elasticsearch/packaging/util/Docker.java | 2 +- .../packaging/util/Packages.java | 6 +- qa/remote-clusters/build.gradle | 7 +- qa/remote-clusters/docker-compose.yml | 4 +- qa/remote-clusters/docker-test-entrypoint.sh | 2 +- .../AbstractMultiClusterRemoteTestCase.java | 60 +----- .../cluster/remote/test/RemoteClustersIT.java | 4 +- qa/smoke-test-multinode/build.gradle | 7 - qa/translog-policy/build.gradle | 3 +- qa/wildfly/build.gradle | 7 +- .../main/java/org/elasticsearch/Build.java | 75 ++----- .../main/java/org/elasticsearch/Version.java | 1 - .../cluster/node/info/NodesInfoResponse.java | 1 - .../cluster/stats/ClusterStatsNodes.java | 13 +- .../action/main/MainResponse.java | 3 - .../bootstrap/Elasticsearch.java | 3 +- .../java/org/elasticsearch/node/Node.java | 3 +- .../rest/action/cat/RestNodesAction.java | 2 - .../java/org/elasticsearch/BuildTests.java | 80 ++----- .../action/main/MainResponseTests.java | 7 +- .../bootstrap/ElasticsearchCliTests.java | 3 +- settings.gradle | 20 -- .../junit/listeners/ReproduceInfoPrinter.java | 1 - 101 files changed, 375 insertions(+), 1368 deletions(-) delete mode 100644 distribution/archives/darwin-tar/build.gradle delete mode 100644 distribution/archives/linux-aarch64-tar/build.gradle delete mode 100644 distribution/archives/linux-tar/build.gradle delete mode 100644 distribution/archives/no-jdk-darwin-tar/build.gradle delete mode 100644 distribution/archives/no-jdk-linux-tar/build.gradle delete mode 100644 distribution/archives/no-jdk-windows-zip/build.gradle delete mode 100644 distribution/archives/windows-zip/build.gradle delete mode 100644 distribution/docker/docker-aarch64-export/build.gradle delete mode 100644 distribution/docker/docker-build-context/build.gradle delete mode 100644 distribution/docker/docker-export/build.gradle delete mode 100644 distribution/docker/ubi-docker-aarch64-export/build.gradle delete mode 100644 distribution/docker/ubi-docker-build-context/build.gradle delete mode 100644 distribution/docker/ubi-docker-export/build.gradle delete mode 100644 distribution/packages/aarch64-deb/build.gradle delete mode 100644 distribution/packages/aarch64-rpm/build.gradle delete mode 100644 distribution/packages/deb/build.gradle delete mode 100644 distribution/packages/no-jdk-deb/build.gradle delete mode 100644 distribution/packages/no-jdk-rpm/build.gradle delete mode 100755 distribution/packages/no-jdk-rpm/src/main/resources/logo/elastic.gif delete mode 100644 distribution/packages/rpm/build.gradle delete mode 100755 distribution/packages/rpm/src/main/resources/logo/elastic.gif diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e8f83791cd2b2..58d2b02f0d1ec 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,6 +34,44 @@ Feature requests If you find yourself wishing for a feature that doesn't exist in Elasticsearch, you are probably not alone. There are bound to be others out there with similar needs. Many of the features that Elasticsearch has today have been added because our users saw the need. Open an issue on our [issues list](https://github.com/elastic/elasticsearch/issues) on GitHub which describes the feature you would like to see, why you need it, and how it should work. + +## Sign your work +The sign-off is a simple line at the end of each commit, which certifies that you wrote it or otherwise have the right to pass it on as an open-source patch. if you can certify the below +``` +By making a contribution to this project, I certify that: +(a) The contribution was created in whole or in part by me and I +have the right to submit it under the open source license +indicated in the file; or +(b) The contribution is based upon previous work that, to the best +of my knowledge, is covered under an appropriate open source +license and I have the right under that license to submit that +work with modifications, whether created in whole or in part +by me, under the same open source license (unless I am +permitted to submit under a different license), as indicated +in the file; or +(c) The contribution was provided directly to me by some other +person who certified (a), (b) or (c) and I have not modified +it. +(d) I understand and agree that this project and the contribution +are public and that a record of the contribution (including all +personal information I submit with it, including my sign-off) is +maintained indefinitely and may be redistributed consistent with +this project or the open source license(s) involved. +``` +then you just add a line to every git commit message: +``` +Signed-off-by: Bob Sanders +``` +You can sign off your work easily by adding the configuration in github +``` +git config user.name "Bob Sanders" +git config user.email "bob.sanders@email.com" +``` +Then, you could sign off commits automatically by adding `-s` or `-=signoff` parameter to your usual git commits commands. e.g. +``` +git commit -s -m "my first commit" +``` + Contributing code and documentation changes ------------------------------------------- diff --git a/Jenkinsfile b/Jenkinsfile index 4277a82f250f2..db69bc15e4a37 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,11 +1,13 @@ pipeline { - agent any + agent { label 'search-cloud-ec2-c518xlarge' } + stages { stage('Build') { steps { echo 'Building..' - sh './gradlew check --no-daemon' + // Disable backward compability tasks + sh './gradlew check --no-daemon --no-scan -Pbwc_tests_enabled=false' } } stage('Test') { diff --git a/build.gradle b/build.gradle index 913af689268f1..3acbb9c60fe19 100644 --- a/build.gradle +++ b/build.gradle @@ -170,8 +170,9 @@ tasks.register("verifyVersions") { * after the backport of the backcompat code is complete. */ -boolean bwc_tests_enabled = true -final String bwc_tests_disabled_issue = "" /* place a PR link here when committing bwc changes */ +boolean bwc_tests_enabled = false +/* place a PR link here when committing bwc changes */ +final String bwc_tests_disabled_issue = "https://github.com/opendistro-for-elasticsearch/search/issues/105" if (bwc_tests_enabled == false) { if (bwc_tests_disabled_issue.isEmpty()) { throw new GradleException("bwc_tests_disabled_issue must be set when bwc_tests_enabled == false") diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 4bae2afd18a8d..2163ed1512cbe 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -171,12 +171,8 @@ if (project != rootProject) { dependencies { reaper project('reaper') - 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-aarch64-tar') - distribution project(':distribution:archives:linux-tar') distribution project(':distribution:archives:oss-linux-tar') distribution project(':distribution:archives:oss-linux-aarch64-tar') diff --git a/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/DistributionDownloadPluginFuncTest.groovy b/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/DistributionDownloadPluginFuncTest.groovy index c4c803787c5be..e24c66f196bf7 100644 --- a/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/DistributionDownloadPluginFuncTest.groovy +++ b/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/DistributionDownloadPluginFuncTest.groovy @@ -108,7 +108,7 @@ class DistributionDownloadPluginFuncTest extends AbstractGradleFuncTest { then: result.tasks.size() == 3 - result.output.count("Unpacking elasticsearch-${version}-linux-x86_64.tar.gz " + + result.output.count("Unpacking elasticsearch-oss-${version}-linux-x86_64.tar.gz " + "using SymbolicLinkPreservingUntarTransform.") == 1 } @@ -155,4 +155,4 @@ class DistributionDownloadPluginFuncTest extends AbstractGradleFuncTest { } """ } -} \ No newline at end of file +} diff --git a/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/fixtures/AbstractGradleFuncTest.groovy b/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/fixtures/AbstractGradleFuncTest.groovy index 6965833012751..da938853df495 100644 --- a/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/fixtures/AbstractGradleFuncTest.groovy +++ b/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/fixtures/AbstractGradleFuncTest.groovy @@ -112,6 +112,7 @@ abstract class AbstractGradleFuncTest extends Specification { } void setupLocalGitRepo() { + //TODO: cleanup execute("git init") execute('git config user.email "build-tool@elastic.co"') execute('git config user.name "Build tool"') diff --git a/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/fixtures/DistributionDownloadFixture.groovy b/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/fixtures/DistributionDownloadFixture.groovy index e053d51cd6825..45f25dd085692 100644 --- a/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/fixtures/DistributionDownloadFixture.groovy +++ b/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/fixtures/DistributionDownloadFixture.groovy @@ -54,7 +54,7 @@ class DistributionDownloadFixture { private static String urlPath(String version,ElasticsearchDistribution.Platform platform) { String fileType = ((platform == ElasticsearchDistribution.Platform.LINUX || platform == ElasticsearchDistribution.Platform.DARWIN)) ? "tar.gz" : "zip" - "/downloads/elasticsearch/elasticsearch-${version}-${platform}-x86_64.$fileType" + "/downloads/elasticsearch/elasticsearch-oss-${version}-${platform}-x86_64.$fileType" } private static byte[] filebytes(String urlPath) throws IOException { diff --git a/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/internal/InternalDistributionArchiveSetupPluginFuncTest.groovy b/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/internal/InternalDistributionArchiveSetupPluginFuncTest.groovy index e67e0d59f88c5..fc1e12c06f217 100644 --- a/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/internal/InternalDistributionArchiveSetupPluginFuncTest.groovy +++ b/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/internal/InternalDistributionArchiveSetupPluginFuncTest.groovy @@ -33,7 +33,7 @@ class InternalDistributionArchiveSetupPluginFuncTest extends AbstractGradleFuncT def setup() { buildFile << """ import org.elasticsearch.gradle.tar.SymbolicLinkPreservingTar - + plugins { id 'elasticsearch.internal-distribution-archive-setup' } @@ -60,7 +60,6 @@ class InternalDistributionArchiveSetupPluginFuncTest extends AbstractGradleFuncT where: buildTaskName | expectedOutputArchivePath - "buildDarwinTar" | "darwin-tar/build/distributions/elasticsearch.tar.gz" "buildOssDarwinTar" | "oss-darwin-tar/build/distributions/elasticsearch-oss.tar.gz" } @@ -82,7 +81,6 @@ class InternalDistributionArchiveSetupPluginFuncTest extends AbstractGradleFuncT where: buildTaskName | expectedOutputArchivePath - "buildDarwinZip" | "darwin-zip/build/distributions/elasticsearch.zip" "buildOssDarwinZip" | "oss-darwin-zip/build/distributions/elasticsearch-oss.zip" } @@ -111,23 +109,23 @@ class InternalDistributionArchiveSetupPluginFuncTest extends AbstractGradleFuncT } } } - + project('consumer') { p -> configurations { consumeArchive {} consumeDir {} } - + dependencies { consumeDir project(path: ':producer-tar', configuration:'extracted') consumeArchive project(path: ':producer-tar', configuration:'default' ) } - + tasks.register("copyDir", Copy) { from(configurations.consumeDir) into('build/dir') } - + tasks.register("copyArchive", Copy) { from(configurations.consumeArchive) into('build/archives') @@ -140,8 +138,8 @@ class InternalDistributionArchiveSetupPluginFuncTest extends AbstractGradleFuncT then: "tar task executed and target folder contains plain tar" result.task(':buildProducerTar').outcome == TaskOutcome.SUCCESS result.task(':consumer:copyArchive').outcome == TaskOutcome.SUCCESS - file("producer-tar/build/distributions/elasticsearch.tar.gz").exists() - file("consumer/build/archives/elasticsearch.tar.gz").exists() + file("producer-tar/build/distributions/elasticsearch-oss.tar.gz").exists() + file("consumer/build/archives/elasticsearch-oss.tar.gz").exists() when: result = gradleRunner("copyDir", "-Pversion=1.0").build() diff --git a/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/internal/InternalDistributionBwcSetupPluginFuncTest.groovy b/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/internal/InternalDistributionBwcSetupPluginFuncTest.groovy index 3b4132eaec512..432c6f977220e 100644 --- a/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/internal/InternalDistributionBwcSetupPluginFuncTest.groovy +++ b/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/internal/InternalDistributionBwcSetupPluginFuncTest.groovy @@ -46,32 +46,29 @@ class InternalDistributionBwcSetupPluginFuncTest extends AbstractGradleFuncTest def "builds distribution from branches via archives assemble"() { when: def result = gradleRunner(new File(testProjectDir.root, "remote"), - ":distribution:bwc:bugfix:buildBwcDarwinTar", ":distribution:bwc:bugfix:buildBwcOssDarwinTar", "-DtestRemoteRepo=" + remoteGitRepo, "-Dbwc.remote=origin") .build() then: - result.task(":distribution:bwc:bugfix:buildBwcDarwinTar").outcome == TaskOutcome.SUCCESS result.task(":distribution:bwc:bugfix:buildBwcOssDarwinTar").outcome == TaskOutcome.SUCCESS and: "assemble task triggered" - result.output.contains("[8.0.1] > Task :distribution:archives:darwin-tar:assemble") result.output.contains("[8.0.1] > Task :distribution:archives:oss-darwin-tar:assemble") } def "bwc distribution archives can be resolved as bwc project artifact"() { setup: new File(testProjectDir.root, 'remote/build.gradle') << """ - + configurations { dists } - + dependencies { - dists project(path: ":distribution:bwc:bugfix", configuration:"darwin-tar") + dists project(path: ":distribution:bwc:bugfix", configuration:"oss-darwin-tar") } - + tasks.register("resolveDistributionArchive") { inputs.files(configurations.dists) doLast { @@ -89,27 +86,27 @@ class InternalDistributionBwcSetupPluginFuncTest extends AbstractGradleFuncTest .build() then: result.task(":resolveDistributionArchive").outcome == TaskOutcome.SUCCESS - result.task(":distribution:bwc:bugfix:buildBwcDarwinTar").outcome == TaskOutcome.SUCCESS + result.task(":distribution:bwc:bugfix:buildBwcOssDarwinTar").outcome == TaskOutcome.SUCCESS and: "assemble task triggered" - result.output.contains("[8.0.1] > Task :distribution:archives:darwin-tar:assemble") + result.output.contains("[8.0.1] > Task :distribution:archives:oss-darwin-tar:assemble") normalizedOutput(result.output) - .contains("distfile /distribution/bwc/bugfix/build/bwc/checkout-8.0/distribution/archives/darwin-tar/" + - "build/distributions/elasticsearch-8.0.1-SNAPSHOT-darwin-x86_64.tar.gz") + .contains("distfile /distribution/bwc/bugfix/build/bwc/checkout-8.0/distribution/archives/oss-darwin-tar/" + + "build/distributions/elasticsearch-oss-8.0.1-SNAPSHOT-darwin-x86_64.tar.gz") } def "bwc expanded distribution folder can be resolved as bwc project artifact"() { setup: new File(testProjectDir.root, 'remote/build.gradle') << """ - + configurations { expandedDist } - + dependencies { - expandedDist project(path: ":distribution:bwc:bugfix", configuration:"expanded-darwin-tar") + expandedDist project(path: ":distribution:bwc:bugfix", configuration:"expanded-oss-darwin-tar") } - + tasks.register("resolveExpandedDistribution") { inputs.files(configurations.expandedDist) doLast { @@ -127,13 +124,13 @@ class InternalDistributionBwcSetupPluginFuncTest extends AbstractGradleFuncTest .build() then: result.task(":resolveExpandedDistribution").outcome == TaskOutcome.SUCCESS - result.task(":distribution:bwc:bugfix:buildBwcDarwinTar").outcome == TaskOutcome.SUCCESS + result.task(":distribution:bwc:bugfix:buildBwcOssDarwinTar").outcome == TaskOutcome.SUCCESS and: "assemble task triggered" - result.output.contains("[8.0.1] > Task :distribution:archives:darwin-tar:assemble") + result.output.contains("[8.0.1] > Task :distribution:archives:oss-darwin-tar:assemble") normalizedOutput(result.output) .contains("distfile /distribution/bwc/bugfix/build/bwc/checkout-8.0/" + - "distribution/archives/darwin-tar/build/install") + "distribution/archives/oss-darwin-tar/build/install") } File setupGitRemote() { diff --git a/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/internal/InternalDistributionDownloadPluginFuncTest.groovy b/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/internal/InternalDistributionDownloadPluginFuncTest.groovy index 823ef7496969b..1c33b173d2d8d 100644 --- a/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/internal/InternalDistributionDownloadPluginFuncTest.groovy +++ b/buildSrc/src/integTest/groovy/org/elasticsearch/gradle/internal/InternalDistributionDownloadPluginFuncTest.groovy @@ -72,7 +72,7 @@ class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest def result = gradleRunner("setupDistro", '-g', testProjectDir.newFolder('GUH').path).build() then: - result.task(":distribution:archives:linux-tar:buildExpanded").outcome == TaskOutcome.SUCCESS + result.task(":distribution:archives:oss-linux-tar:buildExpanded").outcome == TaskOutcome.SUCCESS result.task(":setupDistro").outcome == TaskOutcome.SUCCESS assertExtractedDistroIsCreated("build/distro", 'current-marker.txt') } @@ -144,24 +144,24 @@ class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest apply plugin:'base' // packed distro - configurations.create("linux-tar") + configurations.create("oss-linux-tar") tasks.register("buildBwcTask", Tar) { from('bwc-marker.txt') archiveExtension = "tar.gz" compression = Compression.GZIP } artifacts { - it.add("linux-tar", buildBwcTask) + it.add("oss-linux-tar", buildBwcTask) } // expanded distro - configurations.create("expanded-linux-tar") + configurations.create("expanded-oss-linux-tar") def expandedTask = tasks.register("buildBwcExpandedTask", Copy) { from('bwc-marker.txt') into('build/install/elastic-distro') } artifacts { - it.add("expanded-linux-tar", file('build/install')) { + it.add("expanded-oss-linux-tar", file('build/install')) { builtBy expandedTask type = 'directory' } @@ -171,9 +171,9 @@ class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest private void localDistroSetup() { settingsFile << """ - include ":distribution:archives:linux-tar" + include ":distribution:archives:oss-linux-tar" """ - def bwcSubProjectFolder = testProjectDir.newFolder("distribution", "archives", "linux-tar") + def bwcSubProjectFolder = testProjectDir.newFolder("distribution", "archives", "oss-linux-tar") new File(bwcSubProjectFolder, 'current-marker.txt') << "current" new File(bwcSubProjectFolder, 'build.gradle') << """ import org.gradle.api.internal.artifacts.ArtifactAttributes; diff --git a/buildSrc/src/integTest/resources/org/elasticsearch/gradle/internal/fake_git/remote/distribution/archives/build.gradle b/buildSrc/src/integTest/resources/org/elasticsearch/gradle/internal/fake_git/remote/distribution/archives/build.gradle index d73e32b6b12ee..704bec6492501 100644 --- a/buildSrc/src/integTest/resources/org/elasticsearch/gradle/internal/fake_git/remote/distribution/archives/build.gradle +++ b/buildSrc/src/integTest/resources/org/elasticsearch/gradle/internal/fake_git/remote/distribution/archives/build.gradle @@ -23,7 +23,7 @@ subprojects { tasks.register('tar', Tar) { from('.') destinationDirectory.set(file('build/distributions')) - archiveBaseName.set("elasticsearch${project.name.startsWith('oss')?'-oss':''}") + archiveBaseName.set("elasticsearch-oss") archiveVersion.set("8.0.1-SNAPSHOT") archiveClassifier.set("darwin-x86_64") archiveExtension.set('tar.gz') diff --git a/buildSrc/src/integTest/resources/org/elasticsearch/gradle/internal/fake_git/remote/settings.gradle b/buildSrc/src/integTest/resources/org/elasticsearch/gradle/internal/fake_git/remote/settings.gradle index 24d616238212c..0309a95d705dd 100644 --- a/buildSrc/src/integTest/resources/org/elasticsearch/gradle/internal/fake_git/remote/settings.gradle +++ b/buildSrc/src/integTest/resources/org/elasticsearch/gradle/internal/fake_git/remote/settings.gradle @@ -19,5 +19,4 @@ include ":distribution:bwc:bugfix" include ":distribution:bwc:minor" -include ":distribution:archives:darwin-tar" include ":distribution:archives:oss-darwin-tar" diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/DocsTestPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/DocsTestPlugin.groovy index 5e36d34424cd0..22f66111aec7d 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/DocsTestPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/DocsTestPlugin.groovy @@ -23,8 +23,6 @@ import org.elasticsearch.gradle.Version import org.elasticsearch.gradle.VersionProperties import org.gradle.api.Plugin import org.gradle.api.Project -import org.gradle.api.Task -import org.gradle.api.tasks.TaskProvider /** * Sets up tests for documentation. @@ -37,7 +35,7 @@ class DocsTestPlugin implements Plugin { project.pluginManager.apply('elasticsearch.standalone-rest-test') project.pluginManager.apply('elasticsearch.rest-test') - String distribution = System.getProperty('tests.distribution', 'default') + String distribution = System.getProperty('tests.distribution', 'oss') // The distribution can be configured with -Dtests.distribution on the command line project.testClusters.integTest.testDistribution = distribution.toUpperCase() project.testClusters.integTest.nameCustomization = { it.replace("integTest", "node") } @@ -51,7 +49,6 @@ class DocsTestPlugin implements Plugin { '\\{version\\}': Version.fromString(VersionProperties.elasticsearch).toString(), '\\{version_qualified\\}': VersionProperties.elasticsearch, '\\{lucene_version\\}' : VersionProperties.lucene.replaceAll('-snapshot-\\w+$', ''), - '\\{build_flavor\\}' : distribution, '\\{build_type\\}' : OS.conditionalString().onWindows({"zip"}).onUnix({"tar"}).supply(), ] project.tasks.register('listSnippets', SnippetsTask) { diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy index 330e112c3b2b1..7df8a5ddbe4a6 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy @@ -193,35 +193,20 @@ class ClusterFormationTasks { } return } - // TEMP HACK - // The oss docs CI build overrides the distro on the command line. This hack handles backcompat until CI is updated. - if (distro.equals('oss-zip')) { - distro = 'oss' - } - if (distro.equals('zip')) { - distro = 'default' - } - // END TEMP HACK - if (['oss', 'default'].contains(distro) == false) { - throw new GradleException("Unknown distribution: ${distro} in project ${project.path}") - } + distro = 'oss' + Version version = Version.fromString(elasticsearchVersion) 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 artifactName = 'elasticsearch-oss' Object dependency String snapshotProject = "${os}-${os.equals('windows') ? 'zip' : 'tar'}" if (version.before("7.0.0")) { snapshotProject = "zip" packaging = "zip" } - if (distro.equals("oss")) { - snapshotProject = "oss-" + snapshotProject - } + snapshotProject = "oss-" + snapshotProject BwcVersions.UnreleasedVersionInfo unreleasedInfo = null diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/DistributionDownloadPlugin.java b/buildSrc/src/main/java/org/elasticsearch/gradle/DistributionDownloadPlugin.java index dbf2da9e5d378..82fb148f32817 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/DistributionDownloadPlugin.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/DistributionDownloadPlugin.java @@ -19,7 +19,6 @@ package org.elasticsearch.gradle; -import org.elasticsearch.gradle.ElasticsearchDistribution.Flavor; import org.elasticsearch.gradle.ElasticsearchDistribution.Platform; import org.elasticsearch.gradle.ElasticsearchDistribution.Type; import org.elasticsearch.gradle.docker.DockerSupportPlugin; @@ -38,7 +37,6 @@ import org.gradle.api.provider.Provider; import java.util.Comparator; -import static org.elasticsearch.gradle.util.Util.capitalize; /** * A plugin to manage getting and extracting distributions of Elasticsearch. @@ -193,43 +191,8 @@ private String dependencyNotation(ElasticsearchDistribution distribution) { } else if (distribution.getType() == Type.RPM && distroVersion.before("7.0.0")) { classifier = ""; } - String flavor = ""; - if (distribution.getFlavor() == Flavor.OSS && distroVersion.onOrAfter("6.3.0")) { - flavor = "-oss"; - } String group = distribution.getVersion().endsWith("-SNAPSHOT") ? FAKE_SNAPSHOT_IVY_GROUP : FAKE_IVY_GROUP; - return group + ":elasticsearch" + flavor + ":" + distribution.getVersion() + classifier + "@" + extension; - } - - private static String configName(String prefix, ElasticsearchDistribution distribution) { - return String.format( - "%s_%s_%s_%s%s%s", - prefix, - distribution.getVersion(), - distribution.getType(), - distribution.getPlatform() == null ? "" : distribution.getPlatform() + "_", - distribution.getFlavor(), - distribution.getBundledJdk() ? "" : "_nojdk" - ); - } - - private static String extractTaskName(ElasticsearchDistribution distribution) { - String taskName = "extractElasticsearch"; - if (distribution.getType() != Type.INTEG_TEST_ZIP) { - if (distribution.getFlavor() == Flavor.OSS) { - taskName += "Oss"; - } - if (distribution.getBundledJdk() == false) { - taskName += "NoJdk"; - } - } - if (distribution.getType() == Type.ARCHIVE) { - taskName += capitalize(distribution.getPlatform().toString()); - } else if (distribution.getType() != Type.INTEG_TEST_ZIP) { - taskName += capitalize(distribution.getType().toString()); - } - taskName += distribution.getVersion(); - return taskName; + return group + ":elasticsearch-oss" + ":" + distribution.getVersion() + classifier + "@" + extension; } } diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/DockerBase.java b/buildSrc/src/main/java/org/elasticsearch/gradle/DockerBase.java index cab250e3417b4..13dd3108f4de3 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/DockerBase.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/DockerBase.java @@ -23,9 +23,7 @@ * This class models the different Docker base images that are used to build Docker distributions of Elasticsearch. */ public enum DockerBase { - CENTOS("centos:8"), - // "latest" here is intentional, since the image name specifies "8" - UBI("docker.elastic.co/ubi8/ubi-minimal:latest"); + CENTOS("centos:8"); private final String image; diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/ElasticsearchDistribution.java b/buildSrc/src/main/java/org/elasticsearch/gradle/ElasticsearchDistribution.java index 90136c0bd6c4b..4ae1f9098b2e6 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/ElasticsearchDistribution.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/ElasticsearchDistribution.java @@ -50,9 +50,7 @@ public enum Type { ARCHIVE, RPM, DEB, - DOCKER, - // This is a different flavour of Docker image - DOCKER_UBI; + DOCKER; @Override public String toString() { @@ -63,7 +61,6 @@ public boolean shouldExtract() { switch (this) { case DEB: case DOCKER: - case DOCKER_UBI: case RPM: return false; @@ -73,16 +70,6 @@ public boolean shouldExtract() { } } - public enum Flavor { - DEFAULT, - OSS; - - @Override - public String toString() { - return super.toString().toLowerCase(Locale.ROOT); - } - } - // package private to tests can use public static final Platform CURRENT_PLATFORM = OS.conditional() .onLinux(() -> Platform.LINUX) @@ -99,7 +86,6 @@ public String toString() { private final Property version; private final Property type; private final Property platform; - private final Property flavor; private final Property bundledJdk; private final Property failIfUnavailable; private final Configuration extracted; @@ -119,7 +105,6 @@ public String toString() { this.type = objectFactory.property(Type.class); this.type.convention(Type.ARCHIVE); this.platform = objectFactory.property(Platform.class); - this.flavor = objectFactory.property(Flavor.class); this.bundledJdk = objectFactory.property(Boolean.class); this.failIfUnavailable = objectFactory.property(Boolean.class).convention(true); this.extracted = extractedConfiguration; @@ -154,21 +139,13 @@ public void setType(Type type) { this.type.set(type); } - public Flavor getFlavor() { - return flavor.getOrNull(); - } - - public void setFlavor(Flavor flavor) { - this.flavor.set(flavor); - } - public boolean getBundledJdk() { return bundledJdk.getOrElse(true); } public boolean isDocker() { final Type type = this.type.get(); - return type == Type.DOCKER || type == Type.DOCKER_UBI; + return type == Type.DOCKER; } public void setBundledJdk(Boolean bundledJdk) { @@ -204,7 +181,6 @@ public Configuration getExtracted() { switch (getType()) { case DEB: case DOCKER: - case DOCKER_UBI: case RPM: throw new UnsupportedOperationException( "distribution type [" + getType() + "] for " + "elasticsearch distribution [" + name + "] cannot be extracted" @@ -239,11 +215,7 @@ void finalizeValues() { "platform cannot be set on elasticsearch distribution [" + name + "] of type [integ_test_zip]" ); } - if (flavor.getOrNull() != null) { - throw new IllegalArgumentException( - "flavor [" + flavor.get() + "] not allowed for elasticsearch distribution [" + name + "] of type [integ_test_zip]" - ); - } + if (bundledJdk.getOrNull() != null) { throw new IllegalArgumentException( "bundledJdk cannot be set on elasticsearch distribution [" + name + "] of type [integ_test_zip]" @@ -275,15 +247,9 @@ void finalizeValues() { "bundledJdk cannot be set on elasticsearch distribution [" + name + "] of type " + "[docker]" ); } - if (flavor.get() == Flavor.OSS && type.get() == Type.DOCKER_UBI) { - throw new IllegalArgumentException("Cannot build a UBI docker image for the OSS distribution"); - } } } - if (flavor.isPresent() == false) { - flavor.set(Flavor.DEFAULT); - } if (bundledJdk.isPresent() == false) { bundledJdk.set(true); } @@ -291,7 +257,6 @@ void finalizeValues() { version.finalizeValue(); platform.finalizeValue(); type.finalizeValue(); - flavor.finalizeValue(); bundledJdk.finalizeValue(); } } diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/RepositoriesSetupPlugin.java b/buildSrc/src/main/java/org/elasticsearch/gradle/RepositoriesSetupPlugin.java index 3ea2fee7d1483..bdcfc580d9939 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/RepositoriesSetupPlugin.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/RepositoriesSetupPlugin.java @@ -79,6 +79,7 @@ public static void configureRepositories(Project project) { throw new GradleException("Malformed lucene snapshot version: " + luceneVersion); } String revision = matcher.group(1); + // TODO(cleanup) - Setup own lucene snapshot repo MavenArtifactRepository luceneRepo = repos.maven(repo -> { repo.setName("lucene-snapshots"); repo.setUrl("https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/" + revision); diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionArchiveSetupPlugin.java b/buildSrc/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionArchiveSetupPlugin.java index 8a4d61c2653f4..33daf47cc95b4 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionArchiveSetupPlugin.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionArchiveSetupPlugin.java @@ -108,7 +108,7 @@ private void configureGeneralTaskDefaults(Project project) { project.getTasks().withType(AbstractArchiveTask.class).configureEach(t -> { String subdir = archiveTaskToSubprojectName(t.getName()); t.getDestinationDirectory().set(project.file(subdir + "/build/distributions")); - t.getArchiveBaseName().set(subdir.contains("oss") ? "elasticsearch-oss" : "elasticsearch"); + t.getArchiveBaseName().set("elasticsearch-oss"); }); } diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionBwcSetupPlugin.java b/buildSrc/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionBwcSetupPlugin.java index 4362312549fb4..a9944d38a91d3 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionBwcSetupPlugin.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionBwcSetupPlugin.java @@ -119,7 +119,7 @@ private void registerBwcArtifacts(Project bwcProject, DistributionProject distri private void registerDistributionArchiveArtifact(Project bwcProject, DistributionProject distributionProject, String buildBwcTask) { String artifactFileName = distributionProject.getDistFile().getName(); - String artifactName = artifactFileName.contains("oss") ? "elasticsearch-oss" : "elasticsearch"; + String artifactName = "elasticsearch-oss"; String suffix = artifactFileName.endsWith("tar.gz") ? "tar.gz" : artifactFileName.substring(artifactFileName.length() - 3); int archIndex = artifactFileName.indexOf("x86_64"); @@ -142,12 +142,12 @@ private void registerDistributionArchiveArtifact(Project bwcProject, Distributio private static List resolveArchiveProjects(File checkoutDir, Version bwcVersion) { List projects = new ArrayList<>(); // All active BWC branches publish default and oss variants of rpm and deb packages - projects.addAll(asList("deb", "rpm", "oss-deb", "oss-rpm")); + projects.addAll(asList("oss-deb", "oss-rpm")); if (bwcVersion.onOrAfter("7.0.0")) { // starting with 7.0 we bundle a jdk which means we have platform-specific archives - projects.addAll(asList("oss-windows-zip", "windows-zip", "oss-darwin-tar", "darwin-tar", "oss-linux-tar", "linux-tar")); + projects.addAll(asList("oss-windows-zip", "oss-darwin-tar", "oss-linux-tar")); } else { // prior to 7.0 we published only a single zip and tar archives for oss and default distributions - projects.addAll(asList("oss-zip", "zip", "tar", "oss-tar")); + projects.addAll(asList("oss-zip", "oss-tar")); } return projects.stream().map(name -> { @@ -157,7 +157,7 @@ private static List resolveArchiveProjects(File checkoutDir if (bwcVersion.onOrAfter("7.0.0")) { if (name.contains("zip") || name.contains("tar")) { int index = name.lastIndexOf('-'); - String baseName = name.startsWith("oss-") ? name.substring(4, index) : name.substring(0, index); + String baseName = name.substring(4, index); // oss- classifier = "-" + baseName + "-x86_64"; extension = name.substring(index + 1); if (extension.equals("tar")) { @@ -168,7 +168,7 @@ private static List resolveArchiveProjects(File checkoutDir } else if (name.contains("rpm")) { classifier = "-x86_64"; } - } else if (name.contains("oss-")) { + } else { extension = name.substring(4); } return new DistributionProject(name, baseDir, bwcVersion, classifier, extension, checkoutDir); @@ -228,16 +228,7 @@ private static class DistributionProject { this.projectPath = baseDir + "/" + name; this.distFile = new File( checkoutDir, - baseDir - + "/" - + name - + "/build/distributions/elasticsearch-" - + (name.startsWith("oss") ? "oss-" : "") - + version - + "-SNAPSHOT" - + classifier - + "." - + extension + baseDir + "/" + name + "/build/distributions/elasticsearch-oss-" + version + "-SNAPSHOT" + classifier + "." + extension ); // we only ported this down to the 7.x branch. if (version.onOrAfter("7.10.0") && (name.endsWith("zip") || name.endsWith("tar"))) { diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionDownloadPlugin.java b/buildSrc/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionDownloadPlugin.java index d75aaa9ac0cce..531b9a4067f56 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionDownloadPlugin.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionDownloadPlugin.java @@ -127,7 +127,6 @@ private static String distributionProjectPath(ElasticsearchDistribution distribu break; case DOCKER: - case DOCKER_UBI: projectPath += ":docker:"; projectPath += distributionProjectName(distribution); break; @@ -155,9 +154,7 @@ private static String distributionProjectName(ElasticsearchDistribution distribu ? "" : "-" + architecture.toString().toLowerCase(); - if (distribution.getFlavor() == ElasticsearchDistribution.Flavor.OSS) { - projectName += "oss-"; - } + projectName += "oss-"; if (distribution.getBundledJdk() == false) { projectName += "no-jdk-"; @@ -169,7 +166,7 @@ private static String distributionProjectName(ElasticsearchDistribution distribu ? "-zip" : "-tar"); } else { - projectName = distribution.getFlavor().equals(ElasticsearchDistribution.Flavor.DEFAULT) ? "zip" : "oss-zip"; + projectName = "oss-zip"; } break; @@ -177,10 +174,6 @@ private static String distributionProjectName(ElasticsearchDistribution distribu projectName += "docker" + archString + "-export"; break; - case DOCKER_UBI: - projectName += "ubi-docker" + archString + "-export"; - break; - default: projectName += distribution.getType(); break; diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/test/DistroTestPlugin.java b/buildSrc/src/main/java/org/elasticsearch/gradle/test/DistroTestPlugin.java index 7c8f174840c56..656a9914e2119 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/test/DistroTestPlugin.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/test/DistroTestPlugin.java @@ -22,7 +22,6 @@ import org.elasticsearch.gradle.Architecture; import org.elasticsearch.gradle.DistributionDownloadPlugin; import org.elasticsearch.gradle.ElasticsearchDistribution; -import org.elasticsearch.gradle.ElasticsearchDistribution.Flavor; import org.elasticsearch.gradle.ElasticsearchDistribution.Platform; import org.elasticsearch.gradle.ElasticsearchDistribution.Type; import org.elasticsearch.gradle.Jdk; @@ -110,24 +109,28 @@ public void apply(Project project) { TaskProvider depsTask = project.getTasks().register(taskname + "#deps"); depsTask.configure(t -> t.dependsOn(distribution, examplePlugin)); depsTasks.put(taskname, depsTask); - TaskProvider destructiveTask = configureTestTask(project, taskname, distribution, t -> { - t.onlyIf(t2 -> distribution.isDocker() == false || dockerSupport.get().getDockerAvailability().isAvailable); - addSysprop(t, DISTRIBUTION_SYSPROP, distribution::getFilepath); - addSysprop(t, EXAMPLE_PLUGIN_SYSPROP, () -> examplePlugin.getSingleFile().toString()); - t.exclude("**/PackageUpgradeTests.class"); - }, depsTask); - - if (distribution.getPlatform() == Platform.WINDOWS) { - windowsTestTasks.add(destructiveTask); - } else { - linuxTestTasks.computeIfAbsent(distribution.getType(), k -> new ArrayList<>()).add(destructiveTask); + // TODO - suppressing failure temporarily where duplicate tasks are created for docker. + try { + TaskProvider destructiveTask = configureTestTask(project, taskname, distribution, t -> { + t.onlyIf(t2 -> distribution.isDocker() == false || dockerSupport.get().getDockerAvailability().isAvailable); + addSysprop(t, DISTRIBUTION_SYSPROP, distribution::getFilepath); + addSysprop(t, EXAMPLE_PLUGIN_SYSPROP, () -> examplePlugin.getSingleFile().toString()); + t.exclude("**/PackageUpgradeTests.class"); + }, depsTask); + if (distribution.getPlatform() == Platform.WINDOWS) { + windowsTestTasks.add(destructiveTask); + } else { + linuxTestTasks.computeIfAbsent(distribution.getType(), k -> new ArrayList<>()).add(destructiveTask); + } + destructiveDistroTest.configure(t -> t.dependsOn(destructiveTask)); + lifecycleTasks.get(distribution.getType()).configure(t -> t.dependsOn(destructiveTask)); + } catch (Exception ex) { + System.out.println(ex.getMessage()); } - destructiveDistroTest.configure(t -> t.dependsOn(destructiveTask)); - lifecycleTasks.get(distribution.getType()).configure(t -> t.dependsOn(destructiveTask)); if ((distribution.getType() == Type.DEB || distribution.getType() == Type.RPM) && distribution.getBundledJdk()) { for (Version version : BuildParams.getBwcVersions().getIndexCompatible()) { - if (distribution.getFlavor() == Flavor.OSS && version.before("6.3.0")) { + if (version.before("6.3.0")) { continue; // before opening xpack } final ElasticsearchDistribution bwcDistro; @@ -140,7 +143,6 @@ public void apply(Project project) { distribution.getArchitecture(), distribution.getType(), distribution.getPlatform(), - distribution.getFlavor(), distribution.getBundledJdk(), version.toString() ); @@ -206,8 +208,7 @@ public void apply(Project project) { // auto-detection doesn't work. // // The shouldTestDocker property could be null, hence we use Boolean.TRUE.equals() - boolean shouldExecute = (type != Type.DOCKER && type != Type.DOCKER_UBI) - || Boolean.TRUE.equals(vmProject.findProperty("shouldTestDocker")); + boolean shouldExecute = (type != Type.DOCKER) || Boolean.TRUE.equals(vmProject.findProperty("shouldTestDocker")); if (shouldExecute) { distroTest.configure(t -> t.dependsOn(wrapperTask)); @@ -234,7 +235,6 @@ private static Map> lifecycleTas Map> lifecyleTasks = new HashMap<>(); lifecyleTasks.put(Type.DOCKER, project.getTasks().register(taskPrefix + ".docker")); - lifecyleTasks.put(Type.DOCKER_UBI, project.getTasks().register(taskPrefix + ".ubi")); lifecyleTasks.put(Type.ARCHIVE, project.getTasks().register(taskPrefix + ".archives")); lifecyleTasks.put(Type.DEB, project.getTasks().register(taskPrefix + ".packages")); lifecyleTasks.put(Type.RPM, lifecyleTasks.get(Type.DEB)); @@ -363,55 +363,38 @@ private List configureDistributions(Project project) List currentDistros = new ArrayList<>(); for (Architecture architecture : Architecture.values()) { - for (Type type : Arrays.asList(Type.DEB, Type.RPM, Type.DOCKER, Type.DOCKER_UBI)) { - for (Flavor flavor : Flavor.values()) { - for (boolean bundledJdk : Arrays.asList(true, false)) { - if (bundledJdk == false) { - // We'll never publish an ARM (aarch64) build without a bundled JDK. - if (architecture == Architecture.AARCH64) { - continue; - } - // All our Docker images include a bundled JDK so it doesn't make sense to test without one. - if (type == Type.DOCKER || type == Type.DOCKER_UBI) { - continue; - } + for (Type type : Arrays.asList(Type.DEB, Type.RPM, Type.DOCKER)) { + for (boolean bundledJdk : Arrays.asList(true, false)) { + if (bundledJdk == false) { + // We'll never publish an ARM (aarch64) build without a bundled JDK. + if (architecture == Architecture.AARCH64) { + continue; } - - // We don't publish the OSS distribution on UBI - if (type == Type.DOCKER_UBI && flavor == Flavor.OSS) { + // All our Docker images include a bundled JDK so it doesn't make sense to test without one. + if (type == Type.DOCKER) { continue; } - - currentDistros.add( - createDistro(distributions, architecture, type, null, flavor, bundledJdk, VersionProperties.getElasticsearch()) - ); } + + currentDistros.add( + createDistro(distributions, architecture, type, null, bundledJdk, VersionProperties.getElasticsearch()) + ); } } } for (Architecture architecture : Architecture.values()) { for (Platform platform : Arrays.asList(Platform.LINUX, Platform.WINDOWS)) { - for (Flavor flavor : Flavor.values()) { - for (boolean bundledJdk : Arrays.asList(true, false)) { - if (bundledJdk == false && architecture != Architecture.X64) { - // We will never publish distributions for non-x86 (amd64) platforms - // without a bundled JDK - continue; - } - - currentDistros.add( - createDistro( - distributions, - architecture, - Type.ARCHIVE, - platform, - flavor, - bundledJdk, - VersionProperties.getElasticsearch() - ) - ); + for (boolean bundledJdk : Arrays.asList(true, false)) { + if (bundledJdk == false && architecture != Architecture.X64) { + // We will never publish distributions for non-x86 (amd64) platforms + // without a bundled JDK + continue; } + + currentDistros.add( + createDistro(distributions, architecture, Type.ARCHIVE, platform, bundledJdk, VersionProperties.getElasticsearch()) + ); } } } @@ -424,15 +407,13 @@ private static ElasticsearchDistribution createDistro( Architecture architecture, Type type, Platform platform, - Flavor flavor, boolean bundledJdk, String version ) { - String name = distroId(type, platform, flavor, bundledJdk, architecture) + "-" + version; - boolean isDocker = type == Type.DOCKER || type == Type.DOCKER_UBI; + String name = distroId(type, platform, bundledJdk, architecture) + "-" + version; + boolean isDocker = type == Type.DOCKER; ElasticsearchDistribution distro = distributions.create(name, d -> { d.setArchitecture(architecture); - d.setFlavor(flavor); d.setType(type); if (type == Type.ARCHIVE) { d.setPlatform(platform); @@ -457,19 +438,15 @@ private static boolean isWindows(Project project) { return project.getName().contains("windows"); } - private static String distroId(Type type, Platform platform, Flavor flavor, boolean bundledJdk, Architecture architecture) { - return flavor - + "-" - + (type == Type.ARCHIVE ? platform + "-" : "") - + type - + (bundledJdk ? "" : "-no-jdk") - + (architecture == Architecture.X64 ? "" : "-" + architecture.toString().toLowerCase()); + private static String distroId(Type type, Platform platform, boolean bundledJdk, Architecture architecture) { + return (type == Type.ARCHIVE ? platform + "-" : "") + type + (bundledJdk ? "" : "-no-jdk") + (architecture == Architecture.X64 + ? "" + : "-" + architecture.toString().toLowerCase()); } private static String destructiveDistroTestTaskName(ElasticsearchDistribution distro) { Type type = distro.getType(); - return "destructiveDistroTest." - + distroId(type, distro.getPlatform(), distro.getFlavor(), distro.getBundledJdk(), distro.getArchitecture()); + return "destructiveDistroTest." + distroId(type, distro.getPlatform(), distro.getBundledJdk(), distro.getArchitecture()); } private static String destructiveDistroUpgradeTestTaskName(ElasticsearchDistribution distro, String bwcVersion) { @@ -477,7 +454,7 @@ private static String destructiveDistroUpgradeTestTaskName(ElasticsearchDistribu return "destructiveDistroUpgradeTest.v" + bwcVersion + "." - + distroId(type, distro.getPlatform(), distro.getFlavor(), distro.getBundledJdk(), distro.getArchitecture()); + + distroId(type, distro.getPlatform(), distro.getBundledJdk(), distro.getArchitecture()); } private static void addSysprop(Test task, String sysprop, Supplier valueSupplier) { 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 bfd4986b4db81..c57805f206ff3 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java @@ -267,16 +267,10 @@ private void setDistributionType(ElasticsearchDistribution distribution, TestDis if (testDistribution == TestDistribution.INTEG_TEST) { distribution.setType(ElasticsearchDistribution.Type.INTEG_TEST_ZIP); // we change the underlying distribution when changing the test distribution of the cluster. - distribution.setFlavor(null); distribution.setPlatform(null); distribution.setBundledJdk(null); } else { distribution.setType(ElasticsearchDistribution.Type.ARCHIVE); - if (testDistribution == TestDistribution.DEFAULT) { - distribution.setFlavor(ElasticsearchDistribution.Flavor.DEFAULT); - } else { - distribution.setFlavor(ElasticsearchDistribution.Flavor.OSS); - } } } diff --git a/buildSrc/src/test/java/org/elasticsearch/gradle/DistributionDownloadPluginTests.java b/buildSrc/src/test/java/org/elasticsearch/gradle/DistributionDownloadPluginTests.java index 6ab3bb775392a..02c1182257ea5 100644 --- a/buildSrc/src/test/java/org/elasticsearch/gradle/DistributionDownloadPluginTests.java +++ b/buildSrc/src/test/java/org/elasticsearch/gradle/DistributionDownloadPluginTests.java @@ -19,7 +19,6 @@ package org.elasticsearch.gradle; -import org.elasticsearch.gradle.ElasticsearchDistribution.Flavor; import org.elasticsearch.gradle.ElasticsearchDistribution.Platform; import org.elasticsearch.gradle.ElasticsearchDistribution.Type; import org.elasticsearch.gradle.info.BuildParams; @@ -63,15 +62,7 @@ public class DistributionDownloadPluginTests extends GradleUnitTestCase { ); public void testVersionDefault() { - ElasticsearchDistribution distro = checkDistro( - createProject(null, false), - "testdistro", - null, - Type.ARCHIVE, - Platform.LINUX, - Flavor.OSS, - true - ); + ElasticsearchDistribution distro = checkDistro(createProject(null, false), "testdistro", null, Type.ARCHIVE, Platform.LINUX, true); assertEquals(distro.getVersion(), VersionProperties.getElasticsearch()); } @@ -82,35 +73,18 @@ public void testBadVersionFormat() { "badversion", Type.ARCHIVE, Platform.LINUX, - Flavor.OSS, true, "Invalid version format: 'badversion'" ); } public void testTypeDefault() { - ElasticsearchDistribution distro = checkDistro( - createProject(null, false), - "testdistro", - "5.0.0", - null, - Platform.LINUX, - Flavor.OSS, - true - ); + ElasticsearchDistribution distro = checkDistro(createProject(null, false), "testdistro", "5.0.0", null, Platform.LINUX, true); assertEquals(distro.getType(), Type.ARCHIVE); } public void testPlatformDefault() { - ElasticsearchDistribution distro = checkDistro( - createProject(null, false), - "testdistro", - "5.0.0", - Type.ARCHIVE, - null, - Flavor.OSS, - true - ); + ElasticsearchDistribution distro = checkDistro(createProject(null, false), "testdistro", "5.0.0", Type.ARCHIVE, null, true); assertEquals(distro.getPlatform(), ElasticsearchDistribution.CURRENT_PLATFORM); } @@ -122,37 +96,10 @@ public void testPlatformForIntegTest() { Type.INTEG_TEST_ZIP, Platform.LINUX, null, - null, "platform cannot be set on elasticsearch distribution [testdistro]" ); } - public void testFlavorDefault() { - 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, 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, false), @@ -160,7 +107,6 @@ public void testBundledJdkDefault() { "5.0.0", Type.ARCHIVE, Platform.LINUX, - null, true ); assertTrue(distro.getBundledJdk()); @@ -173,7 +119,6 @@ public void testBundledJdkForIntegTest() { "5.0.0", Type.INTEG_TEST_ZIP, null, - null, true, "bundledJdk cannot be set on elasticsearch distribution [testdistro]" ); @@ -184,70 +129,62 @@ public void testLocalCurrentVersionIntegTestZip() { Project archiveProject = ProjectBuilder.builder().withParent(archivesProject).withName("integ-test-zip").build(); archiveProject.getConfigurations().create("default"); archiveProject.getArtifacts().add("default", new File("doesnotmatter")); - createDistro(project, "distro", VersionProperties.getElasticsearch(), Type.INTEG_TEST_ZIP, null, null, null); + createDistro(project, "distro", VersionProperties.getElasticsearch(), Type.INTEG_TEST_ZIP, null, null); checkPlugin(project); } 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(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(); - archiveProject.getConfigurations().create("default"); - archiveProject.getArtifacts().add("default", new File("doesnotmatter")); - createDistro(project, "distro", VersionProperties.getElasticsearch(), Type.ARCHIVE, platform, flavor, bundledJdk); - checkPlugin(project); - } + 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.getElasticsearch(), Type.ARCHIVE, platform, bundledJdk); + checkPlugin(project); } } } 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(BWC_MINOR, true); - String projectName = projectName(packageType.toString(), flavor, bundledJdk); - Project packageProject = ProjectBuilder.builder().withParent(packagesProject).withName(projectName).build(); - packageProject.getConfigurations().create("default"); - packageProject.getArtifacts().add("default", new File("doesnotmatter")); - createDistro(project, "distro", VersionProperties.getElasticsearch(), packageType, null, flavor, bundledJdk); - checkPlugin(project); - } + for (boolean bundledJdk : new boolean[] { true, false }) { + Project project = createProject(BWC_MINOR, true); + String projectName = projectName(packageType.toString(), bundledJdk); + Project packageProject = ProjectBuilder.builder().withParent(packagesProject).withName(projectName).build(); + packageProject.getConfigurations().create("default"); + packageProject.getArtifacts().add("default", new File("doesnotmatter")); + createDistro(project, "distro", VersionProperties.getElasticsearch(), packageType, null, bundledJdk); + checkPlugin(project); } } } public void testLocalBwcArchives() { for (Platform platform : Platform.values()) { - for (Flavor flavor : Flavor.values()) { - // note: no non bundled jdk for bwc - String configName = projectName(platform.toString(), flavor, true); - configName += (platform == Platform.WINDOWS ? "-zip" : "-tar"); + // note: no non bundled jdk for bwc + String configName = projectName(platform.toString(), true); + configName += (platform == Platform.WINDOWS ? "-zip" : "-tar"); - 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); - } + checkBwc("minor", configName, BWC_MINOR_VERSION, Type.ARCHIVE, platform, BWC_MINOR, true); + checkBwc("staged", configName, BWC_STAGED_VERSION, Type.ARCHIVE, platform, BWC_STAGED, true); + checkBwc("bugfix", configName, BWC_BUGFIX_VERSION, Type.ARCHIVE, platform, BWC_BUGFIX, true); + checkBwc("maintenance", configName, BWC_MAINTENANCE_VERSION, Type.ARCHIVE, platform, BWC_MAINTENANCE, true); } } public void testLocalBwcPackages() { for (Type packageType : new Type[] { Type.RPM, Type.DEB }) { - for (Flavor flavor : Flavor.values()) { - // note: no non bundled jdk for bwc - String configName = projectName(packageType.toString(), flavor, true); + // note: no non bundled jdk for bwc + String configName = projectName(packageType.toString(), true); - 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); - } + checkBwc("minor", configName, BWC_MINOR_VERSION, packageType, null, BWC_MINOR, true); + checkBwc("staged", configName, BWC_STAGED_VERSION, packageType, null, BWC_STAGED, true); + checkBwc("bugfix", configName, BWC_BUGFIX_VERSION, packageType, null, BWC_BUGFIX, true); + checkBwc("maintenance", configName, BWC_MAINTENANCE_VERSION, packageType, null, BWC_MAINTENANCE, true); } } @@ -257,13 +194,12 @@ private void assertDistroError( String version, Type type, Platform platform, - Flavor flavor, Boolean bundledJdk, String message ) { IllegalArgumentException e = expectThrows( IllegalArgumentException.class, - () -> checkDistro(project, name, version, type, platform, flavor, bundledJdk) + () -> checkDistro(project, name, version, type, platform, bundledJdk) ); assertThat(e.getMessage(), containsString(message)); } @@ -274,7 +210,6 @@ private ElasticsearchDistribution createDistro( String version, Type type, Platform platform, - Flavor flavor, Boolean bundledJdk ) { NamedDomainObjectContainer distros = DistributionDownloadPlugin.getContainer(project); @@ -288,9 +223,6 @@ private ElasticsearchDistribution createDistro( if (platform != null) { distro.setPlatform(platform); } - if (flavor != null) { - distro.setFlavor(flavor); - } if (bundledJdk != null) { distro.setBundledJdk(bundledJdk); } @@ -304,10 +236,9 @@ private ElasticsearchDistribution checkDistro( String version, Type type, Platform platform, - Flavor flavor, Boolean bundledJdk ) { - ElasticsearchDistribution distribution = createDistro(project, name, version, type, platform, flavor, bundledJdk); + ElasticsearchDistribution distribution = createDistro(project, name, version, type, platform, bundledJdk); distribution.finalizeValues(); return distribution; } @@ -324,7 +255,6 @@ private void checkBwc( Version version, Type type, Platform platform, - Flavor flavor, BwcVersions bwcVersions, boolean isInternal ) { @@ -332,7 +262,7 @@ private void checkBwc( Project archiveProject = ProjectBuilder.builder().withParent(bwcProject).withName(projectName).build(); archiveProject.getConfigurations().create(config); archiveProject.getArtifacts().add(config, new File("doesnotmatter")); - createDistro(project, "distro", version.toString(), type, platform, flavor, true); + createDistro(project, "distro", version.toString(), type, platform, true); checkPlugin(project); } @@ -351,11 +281,8 @@ private Project createProject(BwcVersions bwcVersions, boolean isInternal) { return project; } - private static String projectName(String base, Flavor flavor, boolean bundledJdk) { - String prefix = ""; - if (flavor == Flavor.OSS) { - prefix += "oss-"; - } + private static String projectName(String base, boolean bundledJdk) { + String prefix = "oss-"; if (bundledJdk == false) { prefix += "no-jdk-"; } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/core/MainResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/core/MainResponse.java index 5fa0120611fa6..6a7f6b7dd9c8b 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/core/MainResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/core/MainResponse.java @@ -102,14 +102,13 @@ public static class Version { private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>(Version.class.getName(), true, args -> { - return new Version((String) args[0], (String) args[1], (String) args[2], (String) args[3], (String) args[4], - (Boolean) args[5], (String) args[6], (String) args[7], (String) args[8]); + return new Version((String) args[0], (String) args[1], (String) args[2], (String) args[3], + (Boolean) args[4], (String) args[5], (String) args[6], (String) args[7]); } ); static { PARSER.declareString(ConstructingObjectParser.constructorArg(), new ParseField("number")); - PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), new ParseField("build_flavor")); PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), new ParseField("build_type")); PARSER.declareString(ConstructingObjectParser.constructorArg(), new ParseField("build_hash")); PARSER.declareString(ConstructingObjectParser.constructorArg(), new ParseField("build_date")); @@ -118,8 +117,8 @@ public static class Version { PARSER.declareString(ConstructingObjectParser.constructorArg(), new ParseField("minimum_wire_compatibility_version")); PARSER.declareString(ConstructingObjectParser.constructorArg(), new ParseField("minimum_index_compatibility_version")); } + private final String number; - private final String buildFlavor; private final String buildType; private final String buildHash; private final String buildDate; @@ -128,10 +127,9 @@ public static class Version { private final String minimumWireCompatibilityVersion; private final String minimumIndexCompatibilityVersion; - public Version(String number, String buildFlavor, String buildType, String buildHash, String buildDate, boolean isSnapshot, - String luceneVersion, String minimumWireCompatibilityVersion, String minimumIndexCompatibilityVersion) { + public Version(String number, String buildType, String buildHash, String buildDate, boolean isSnapshot, + String luceneVersion, String minimumWireCompatibilityVersion, String minimumIndexCompatibilityVersion) { this.number = number; - this.buildFlavor = buildFlavor; this.buildType = buildType; this.buildHash = buildHash; this.buildDate = buildDate; @@ -145,10 +143,6 @@ public String getNumber() { return number; } - public String getBuildFlavor() { - return buildFlavor; - } - public String getBuildType() { return buildType; } @@ -184,7 +178,6 @@ public boolean equals(Object o) { Version version = (Version) o; return isSnapshot == version.isSnapshot && number.equals(version.number) && - Objects.equals(buildFlavor, version.buildFlavor) && Objects.equals(buildType, version.buildType) && buildHash.equals(version.buildHash) && buildDate.equals(version.buildDate) && @@ -195,7 +188,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(number, buildFlavor, buildType, buildHash, buildDate, isSnapshot, luceneVersion, + return Objects.hash(number, buildType, buildHash, buildDate, isSnapshot, luceneVersion, minimumWireCompatibilityVersion, minimumIndexCompatibilityVersion); } } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/PingAndInfoIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/PingAndInfoIT.java index 5425a4cf7e558..eb6912220d194 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/PingAndInfoIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/PingAndInfoIT.java @@ -42,7 +42,6 @@ public void testInfo() throws IOException { assertNotNull(info.getNodeName()); @SuppressWarnings("unchecked") Map versionMap = (Map) infoAsMap.get("version"); - assertEquals(versionMap.get("build_flavor"), info.getVersion().getBuildFlavor()); assertEquals(versionMap.get("build_type"), info.getVersion().getBuildType()); assertEquals(versionMap.get("build_hash"), info.getVersion().getBuildHash()); assertEquals(versionMap.get("build_date"), info.getVersion().getBuildDate()); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/RestHighLevelClientTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/RestHighLevelClientTests.java index 5749831c075ac..4bea540a7ce6d 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/RestHighLevelClientTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/RestHighLevelClientTests.java @@ -165,7 +165,7 @@ public void testPingSocketTimeout() throws IOException { } public void testInfo() throws IOException { - MainResponse testInfo = new MainResponse("nodeName", new MainResponse.Version("number", "buildFlavor", "buildType", "buildHash", + MainResponse testInfo = new MainResponse("nodeName", new MainResponse.Version("number", "buildType", "buildHash", "buildDate", true, "luceneVersion", "minimumWireCompatibilityVersion", "minimumIndexCompatibilityVersion"), "clusterName", "clusterUuid", "You Know, for Search"); mockResponse((ToXContentFragment) (builder, params) -> { @@ -175,7 +175,6 @@ public void testInfo() throws IOException { builder.field("cluster_uuid", testInfo.getClusterUuid()); builder.startObject("version") .field("number", testInfo.getVersion().getNumber()) - .field("build_flavor", testInfo.getVersion().getBuildFlavor()) .field("build_type", testInfo.getVersion().getBuildType()) .field("build_hash", testInfo.getVersion().getBuildHash()) .field("build_date", testInfo.getVersion().getBuildDate()) diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/core/MainResponseTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/core/MainResponseTests.java index 9823a55fef04f..508441fec06e5 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/core/MainResponseTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/core/MainResponseTests.java @@ -41,7 +41,7 @@ protected org.elasticsearch.action.main.MainResponse createServerTestInstance(XC final String date = new Date(randomNonNegativeLong()).toString(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_0_1, Version.CURRENT); Build build = new Build( - Build.Flavor.UNKNOWN, Build.Type.UNKNOWN, randomAlphaOfLength(8), date, randomBoolean(), + Build.Type.UNKNOWN, randomAlphaOfLength(8), date, randomBoolean(), version.toString() ); return new org.elasticsearch.action.main.MainResponse(nodeName, version, clusterName, clusterUuid , build); @@ -62,7 +62,6 @@ protected void assertInstances(org.elasticsearch.action.main.MainResponse server assertThat(serverTestInstance.getBuild().hash(), equalTo(clientInstance.getVersion().getBuildHash())); assertThat(serverTestInstance.getVersion().toString(), equalTo(clientInstance.getVersion().getNumber())); assertThat(serverTestInstance.getBuild().date(), equalTo(clientInstance.getVersion().getBuildDate())); - assertThat(serverTestInstance.getBuild().flavor().displayName(), equalTo(clientInstance.getVersion().getBuildFlavor())); assertThat(serverTestInstance.getBuild().type().displayName(), equalTo(clientInstance.getVersion().getBuildType())); assertThat(serverTestInstance.getVersion().luceneVersion.toString(), equalTo(clientInstance.getVersion().getLuceneVersion())); assertThat(serverTestInstance.getVersion().minimumIndexCompatibilityVersion().toString(), diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/MiscellaneousDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/MiscellaneousDocumentationIT.java index 126d7353a7aca..31a67752a9c27 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/MiscellaneousDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/MiscellaneousDocumentationIT.java @@ -46,7 +46,6 @@ public void testMain() throws IOException { String nodeName = response.getNodeName(); MainResponse.Version version = response.getVersion(); String buildDate = version.getBuildDate(); - String buildFlavor = version.getBuildFlavor(); String buildHash = version.getBuildHash(); String buildType = version.getBuildType(); String luceneVersion = version.getLuceneVersion(); @@ -59,7 +58,6 @@ public void testMain() throws IOException { assertNotNull(nodeName); assertNotNull(version); assertNotNull(buildDate); - assertNotNull(buildFlavor); assertNotNull(buildHash); assertNotNull(buildType); assertNotNull(luceneVersion); diff --git a/distribution/archives/build.gradle b/distribution/archives/build.gradle index 573183784b711..c33aef826aaed 100644 --- a/distribution/archives/build.gradle +++ b/distribution/archives/build.gradle @@ -17,28 +17,25 @@ * under the License. */ -import java.nio.file.Files -import java.nio.file.Path - apply plugin: 'elasticsearch.internal-distribution-archive-setup' -CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String platform, String architecture, boolean oss, boolean jdk) { +CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String platform, String architecture, boolean jdk) { return copySpec { into("elasticsearch-${version}") { into('lib') { - with libFiles(oss) + with libFiles() } into('config') { dirMode 0750 fileMode 0660 - with configFiles(distributionType, oss, jdk) + with configFiles(distributionType, jdk) from { dirMode 0750 jvmOptionsDir.getParent() } } into('bin') { - with binFiles(distributionType, oss, jdk) + with binFiles(distributionType, jdk) } if (jdk) { into("darwin".equals(platform) ? 'jdk.app' : 'jdk') { @@ -65,7 +62,7 @@ CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String pla rename { 'LICENSE.txt' } } - with noticeFile(oss, jdk) + with noticeFile(jdk) into('modules') { with modulesFiles } @@ -76,105 +73,56 @@ CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String pla distribution_archives { integTestZip { content { - archiveFiles(transportModulesFiles, 'zip', null, 'x64', true, false) - } - } - - windowsZip { - archiveClassifier = 'windows-x86_64' - content { - archiveFiles(modulesFiles(false, 'windows-x86_64'), 'zip', 'windows', 'x64', false, true) + archiveFiles(transportModulesFiles, 'zip', null, 'x64', false) } } ossWindowsZip { archiveClassifier = 'windows-x86_64' content { - archiveFiles(modulesFiles(true, 'windows-x86_64'), 'zip', 'windows', 'x64', true, true) - } - } - - noJdkWindowsZip { - archiveClassifier = 'no-jdk-windows-x86_64' - content { - archiveFiles(modulesFiles(false, 'windows-x86_64'), 'zip', 'windows', 'x64', false, false) + archiveFiles(modulesFiles('windows-x86_64'), 'zip', 'windows', 'x64', true) } } ossNoJdkWindowsZip { archiveClassifier = 'no-jdk-windows-x86_64' content { - archiveFiles(modulesFiles(true, 'windows-x86_64'), 'zip', 'windows', 'x64', true, false) - } - } - - darwinTar { - archiveClassifier = 'darwin-x86_64' - content { - archiveFiles(modulesFiles(false, 'darwin-x86_64'), 'tar', 'darwin', 'x64', false, true) + archiveFiles(modulesFiles('windows-x86_64'), 'zip', 'windows', 'x64', false) } } ossDarwinTar { archiveClassifier = 'darwin-x86_64' content { - archiveFiles(modulesFiles(true, 'darwin-x86_64'), 'tar', 'darwin', 'x64', true, true) - } - } - - noJdkDarwinTar { - archiveClassifier = 'no-jdk-darwin-x86_64' - content { - archiveFiles(modulesFiles(false, 'darwin-x86_64'), 'tar', 'darwin', 'x64', false, false) + archiveFiles(modulesFiles('darwin-x86_64'), 'tar', 'darwin', 'x64', true) } } ossNoJdkDarwinTar { archiveClassifier = 'no-jdk-darwin-x86_64' content { - archiveFiles(modulesFiles(true, 'darwin-x86_64'), 'tar', 'darwin', 'x64', true, false) - } - } - - linuxAarch64Tar { - archiveClassifier = 'linux-aarch64' - content { - archiveFiles(modulesFiles(false, 'linux-aarch64'), 'tar', 'linux', 'aarch64', false, true) - } - } - - linuxTar { - archiveClassifier = 'linux-x86_64' - content { - archiveFiles(modulesFiles(false, 'linux-x86_64'), 'tar', 'linux', 'x64', false, true) + archiveFiles(modulesFiles('darwin-x86_64'), 'tar', 'darwin', 'x64', false) } } ossLinuxAarch64Tar { archiveClassifier = 'linux-aarch64' content { - archiveFiles(modulesFiles(true, 'linux-aarch64'), 'tar', 'linux', 'aarch64', true, true) + archiveFiles(modulesFiles('linux-aarch64'), 'tar', 'linux', 'aarch64', true) } } ossLinuxTar { archiveClassifier = 'linux-x86_64' content { - archiveFiles(modulesFiles(true, 'linux-x86_64'), 'tar', 'linux', 'x64', true, true) - } - } - - noJdkLinuxTar { - archiveClassifier = 'no-jdk-linux-x86_64' - content { - archiveFiles(modulesFiles(false, 'linux-x86_64'), 'tar', 'linux', 'x64', false, false) + archiveFiles(modulesFiles('linux-x86_64'), 'tar', 'linux', 'x64', true) } } ossNoJdkLinuxTar { archiveClassifier = 'no-jdk-linux-x86_64' content { - archiveFiles(modulesFiles(true, 'linux-x86_64'), 'tar', 'linux', 'x64', true, false) + archiveFiles(modulesFiles('linux-x86_64'), 'tar', 'linux', 'x64', false) } } } @@ -183,5 +131,5 @@ subprojects { apply plugin: 'distribution' apply plugin: 'elasticsearch.internal-distribution-archive-check' - group = "org.elasticsearch.distribution.${name.startsWith("oss-") ? "oss" : "default"}" + group = "org.elasticsearch.distribution.oss" } diff --git a/distribution/archives/darwin-tar/build.gradle b/distribution/archives/darwin-tar/build.gradle deleted file mode 100644 index 4a6dde5fc0c92..0000000000000 --- a/distribution/archives/darwin-tar/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -// This file is intentionally blank. All configuration of the -// distribution is done in the parent project. diff --git a/distribution/archives/linux-aarch64-tar/build.gradle b/distribution/archives/linux-aarch64-tar/build.gradle deleted file mode 100644 index 4a6dde5fc0c92..0000000000000 --- a/distribution/archives/linux-aarch64-tar/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -// This file is intentionally blank. All configuration of the -// distribution is done in the parent project. diff --git a/distribution/archives/linux-tar/build.gradle b/distribution/archives/linux-tar/build.gradle deleted file mode 100644 index 4a6dde5fc0c92..0000000000000 --- a/distribution/archives/linux-tar/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -// This file is intentionally blank. All configuration of the -// distribution is done in the parent project. diff --git a/distribution/archives/no-jdk-darwin-tar/build.gradle b/distribution/archives/no-jdk-darwin-tar/build.gradle deleted file mode 100644 index 4a6dde5fc0c92..0000000000000 --- a/distribution/archives/no-jdk-darwin-tar/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -// This file is intentionally blank. All configuration of the -// distribution is done in the parent project. diff --git a/distribution/archives/no-jdk-linux-tar/build.gradle b/distribution/archives/no-jdk-linux-tar/build.gradle deleted file mode 100644 index 4a6dde5fc0c92..0000000000000 --- a/distribution/archives/no-jdk-linux-tar/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -// This file is intentionally blank. All configuration of the -// distribution is done in the parent project. diff --git a/distribution/archives/no-jdk-windows-zip/build.gradle b/distribution/archives/no-jdk-windows-zip/build.gradle deleted file mode 100644 index 4a6dde5fc0c92..0000000000000 --- a/distribution/archives/no-jdk-windows-zip/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -// This file is intentionally blank. All configuration of the -// distribution is done in the parent project. diff --git a/distribution/archives/windows-zip/build.gradle b/distribution/archives/windows-zip/build.gradle deleted file mode 100644 index 4a6dde5fc0c92..0000000000000 --- a/distribution/archives/windows-zip/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -// This file is intentionally blank. All configuration of the -// distribution is done in the parent project. diff --git a/distribution/build.gradle b/distribution/build.gradle index 3f3f924e16e70..19cc6ddfd2714 100644 --- a/distribution/build.gradle +++ b/distribution/build.gradle @@ -49,15 +49,6 @@ tasks.register("generateDependenciesReport", ConcatFilesTask) { String sourceUrl = "https://hg.openjdk.java.net/jdk-updates/jdk${jdkMajorVersion}u/archive/jdk-${jdkVersion}.tar.gz" additionalLines << "OpenJDK,${jdkVersion},https://openjdk.java.net/,GPL-2.0-with-classpath-exception,${sourceUrl}".toString() - // Explicitly add the dependency on the RHEL UBI Docker base image - String[] rhelUbiFields = [ - 'Red Hat Universal Base Image minimal', - '8', - 'https://catalog.redhat.com/software/containers/ubi8/ubi-minimal/5c359a62bed8bd75a2c3fba8', - 'Custom;https://www.redhat.com/licenses/EULA_Red_Hat_Universal_Base_Image_English_20190422.pdf', - 'https://oss-dependencies.elastic.co/redhat/ubi/ubi-minimal-8-source.tar.gz' - ] - additionalLines << rhelUbiFields.join(',') } /***************************************************************************** @@ -334,7 +325,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { /***************************************************************************** * Common files in all distributions * *****************************************************************************/ - libFiles = { oss -> + libFiles = { copySpec { // delay by using closures, since they have not yet been configured, so no jar task exists yet from(configurations.libs) @@ -344,15 +335,10 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { into('tools/keystore-cli') { from(configurations.libsKeystoreCli) } - if (oss == false) { - into('tools/security-cli') { - from(configurations.libsSecurityCli) - } - } } } - modulesFiles = { oss, platform -> + modulesFiles = { platform -> copySpec { eachFile { if (it.relativePath.segments[-2] == 'bin' || (platform == 'darwin-x86_64' && it.relativePath.segments[-2] == 'MacOS')) { @@ -363,12 +349,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { it.mode = 0644 } } - def buildModules - if (oss) { - buildModules = buildOssModulesTaskProvider - } else { - buildModules = buildDefaultModulesTaskProvider - } + def buildModules = buildOssModulesTaskProvider List excludePlatforms = ['linux-x86_64', 'linux-aarch64', 'windows-x86_64', 'darwin-x86_64'] if (platform != null) { excludePlatforms.remove(excludePlatforms.indexOf(platform)) @@ -393,25 +374,20 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { from buildTransportModulesTaskProvider } - configFiles = { distributionType, oss, jdk -> + configFiles = { distributionType, jdk -> copySpec { with copySpec { // main config files, processed with distribution specific substitutions from '../src/config' exclude 'log4j2.properties' // this is handled separately below - MavenFilteringHack.filter(it, expansionsForDistribution(distributionType, oss, jdk)) - } - if (oss) { - from project(':distribution').buildOssLog4jConfig - from project(':distribution').buildOssConfig - } else { - from project(':distribution').buildDefaultLog4jConfig - from project(':distribution').buildDefaultConfig + MavenFilteringHack.filter(it, expansionsForDistribution(distributionType, jdk)) } + from project(':distribution').buildOssLog4jConfig + from project(':distribution').buildOssConfig } } - binFiles = { distributionType, oss, jdk -> + binFiles = { distributionType, jdk -> copySpec { // non-windows files, for all distributions with copySpec { @@ -419,7 +395,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { exclude '*.exe' exclude '*.bat' eachFile { it.setMode(0755) } - MavenFilteringHack.filter(it, expansionsForDistribution(distributionType, oss, jdk)) + MavenFilteringHack.filter(it, expansionsForDistribution(distributionType, jdk)) } // windows files, only for zip if (distributionType == 'zip') { @@ -427,7 +403,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { from '../src/bin' include '*.bat' filter(FixCrLfFilter, eol: FixCrLfFilter.CrLf.newInstance('crlf')) - MavenFilteringHack.filter(it, expansionsForDistribution(distributionType, oss, jdk)) + MavenFilteringHack.filter(it, expansionsForDistribution(distributionType, jdk)) } with copySpec { from '../src/bin' @@ -437,11 +413,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { // module provided bin files with copySpec { eachFile { it.setMode(0755) } - if (oss) { - from project(':distribution').buildOssBin - } else { - from project(':distribution').buildDefaultBin - } + from project(':distribution').buildOssBin if (distributionType != 'zip') { exclude '*.bat' } @@ -449,19 +421,15 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { } } - noticeFile = { oss, jdk -> + noticeFile = { jdk -> copySpec { if (project.name == 'integ-test-zip') { from buildServerNoticeTaskProvider } else { - if (oss && jdk) { + if (jdk) { from buildOssNoticeTaskProvider - } else if (oss) { - from buildOssNoJdkNoticeTaskProvider - } else if (jdk) { - from buildDefaultNoticeTaskProvider } else { - from buildDefaultNoJdkNoticeTaskProvider + from buildOssNoJdkNoticeTaskProvider } } } @@ -522,7 +490,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { * */ subprojects { - ext.expansionsForDistribution = { distributionType, oss, jdk -> + ext.expansionsForDistribution = { distributionType, jdk -> final String defaultHeapSize = "1g" final String packagingPathData = "path.data: /var/lib/elasticsearch" final String pathLogs = "/var/log/elasticsearch" @@ -598,11 +566,6 @@ subprojects { 'def': footer ], - 'es.distribution.flavor': [ - 'def': oss ? 'oss' : 'default' - ], - - 'es.distribution.type': [ 'deb': 'deb', 'rpm': 'rpm', @@ -649,13 +612,11 @@ subprojects { } } -['archives:windows-zip', 'archives:oss-windows-zip', - 'archives:darwin-tar', 'archives:oss-darwin-tar', - 'archives:linux-aarch64-tar', 'archives:oss-linux-aarch64-tar', - 'archives:linux-tar', 'archives:oss-linux-tar', +['archives:oss-windows-zip', + 'archives:oss-darwin-tar', + 'archives:oss-linux-aarch64-tar', + 'archives:oss-linux-tar', 'archives:integ-test-zip', - 'packages:rpm', 'packages:deb', - 'packages:aarch64-rpm', 'packages:aarch64-deb', 'packages:oss-rpm', 'packages:oss-deb', 'packages:aarch64-oss-rpm', 'packages:aarch64-oss-deb' ].forEach { subName -> diff --git a/distribution/docker/build.gradle b/distribution/docker/build.gradle index 86ad0958cab15..237c99070d2f6 100644 --- a/distribution/docker/build.gradle +++ b/distribution/docker/build.gradle @@ -1,6 +1,5 @@ import org.elasticsearch.gradle.Architecture import org.elasticsearch.gradle.DockerBase -import org.elasticsearch.gradle.ElasticsearchDistribution.Flavor import org.elasticsearch.gradle.LoggedExec import org.elasticsearch.gradle.VersionProperties import org.elasticsearch.gradle.docker.DockerBuildTask @@ -14,20 +13,16 @@ apply plugin: 'elasticsearch.rest-resources' testFixtures.useFixture() configurations { - aarch64DockerSource - dockerSource aarch64OssDockerSource ossDockerSource } dependencies { - aarch64DockerSource project(path: ":distribution:archives:linux-aarch64-tar", configuration:"default") - dockerSource project(path: ":distribution:archives:linux-tar", configuration:"default") aarch64OssDockerSource project(path: ":distribution:archives:oss-linux-aarch64-tar", configuration:"default") ossDockerSource project(path: ":distribution:archives:oss-linux-tar", configuration:"default") } -ext.expansions = { Architecture architecture, boolean oss, DockerBase base, boolean local -> +ext.expansions = { Architecture architecture, DockerBase base, boolean local -> String classifier if (local) { if (architecture == Architecture.AARCH64) { @@ -44,7 +39,7 @@ ext.expansions = { Architecture architecture, boolean oss, DockerBase base, bool classifier = "linux-\$(arch)" } - final String elasticsearch = "elasticsearch-${oss ? 'oss-' : ''}${VersionProperties.elasticsearch}-${classifier}.tar.gz" + final String elasticsearch = "elasticsearch-oss-${VersionProperties.elasticsearch}-${classifier}.tar.gz" /* Both the following Dockerfile commands put the resulting artifact at * the same location, regardless of classifier, so that the commands that @@ -66,83 +61,62 @@ RUN curl --retry 8 -S -L \\ 'build_date' : BuildParams.buildDate, 'git_revision' : BuildParams.gitRevision, 'license' : 'Apache-2.0', - 'package_manager' : base == DockerBase.UBI ? 'microdnf' : 'yum', + 'package_manager' : 'yum', 'source_elasticsearch': sourceElasticsearch, 'docker_base' : base.name().toLowerCase(), 'version' : VersionProperties.elasticsearch ] } -private static String buildPath(Architecture architecture, boolean oss, DockerBase base) { +private static String buildPath(Architecture architecture, DockerBase base) { return 'build/' + (architecture == Architecture.AARCH64 ? 'aarch64-' : '') + - (oss ? 'oss-' : '') + - (base == DockerBase.UBI ? 'ubi-' : '') + + 'oss-' + 'docker' } -private static String taskName(String prefix, Architecture architecture, boolean oss, DockerBase base, String suffix) { +private static String taskName(String prefix, Architecture architecture, DockerBase base, String suffix) { return prefix + (architecture == Architecture.AARCH64 ? 'Aarch64' : '') + - (oss ? 'Oss' : '') + - (base == DockerBase.UBI ? 'Ubi' : '') + + 'Oss' + suffix } project.ext { - dockerBuildContext = { Architecture architecture, boolean oss, DockerBase base, boolean local -> + dockerBuildContext = { Architecture architecture, DockerBase base, boolean local -> copySpec { into('bin') { from project.projectDir.toPath().resolve("src/docker/bin") } into('config') { - /* - * The OSS and default distributions have different configurations, therefore we want to allow overriding the default configuration - * from files in the 'oss' sub-directory. We don't want the 'oss' sub-directory to appear in the final build context, however. - */ - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - from(project.projectDir.toPath().resolve("src/docker/config")) { - exclude 'oss' - } - if (oss) { - // Overlay the config file - from project.projectDir.toPath().resolve("src/docker/config/oss") - } + from project.projectDir.toPath().resolve("src/docker/config") } from(project.projectDir.toPath().resolve("src/docker/Dockerfile")) { - expand(expansions(architecture, oss, base, local)) + expand(expansions(architecture, base, local)) } } } } -void addCopyDockerContextTask(Architecture architecture, boolean oss, DockerBase base) { - if (oss && base != DockerBase.CENTOS) { +void addCopyDockerContextTask(Architecture architecture, DockerBase base) { + if (base != DockerBase.CENTOS) { throw new GradleException("The only allowed docker base image for OSS builds is CENTOS") } - tasks.register(taskName("copy", architecture, oss, base, "DockerContext"), Sync) { - expansions(architecture, oss, base, true).findAll { it.key != 'build_date' }.each { k, v -> + tasks.register(taskName("copy", architecture, base, "DockerContext"), Sync) { + expansions(architecture, base, true).findAll { it.key != 'build_date' }.each { k, v -> inputs.property(k, { v.toString() }) } - into buildPath(architecture, oss, base) + into buildPath(architecture, base) - with dockerBuildContext(architecture, oss, base, true) + with dockerBuildContext(architecture, base, true) if (architecture == Architecture.AARCH64) { - if (oss) { - from configurations.aarch64OssDockerSource - } else { - from configurations.aarch64DockerSource - } + from configurations.aarch64OssDockerSource } else { - if (oss) { - from configurations.ossDockerSource - } else { - from configurations.dockerSource - } + from configurations.ossDockerSource } } } @@ -157,31 +131,24 @@ def createAndSetWritable(Object... locations) { elasticsearch_distributions { Architecture.values().each { eachArchitecture -> - Flavor.values().each { distroFlavor -> - "docker_$distroFlavor${ eachArchitecture == Architecture.AARCH64 ? '_aarch64' : '' }" { - architecture = eachArchitecture - flavor = distroFlavor - type = 'docker' - version = VersionProperties.getElasticsearch() - failIfUnavailable = false // This ensures we don't attempt to build images if docker is unavailable - } + "docker${ eachArchitecture == Architecture.AARCH64 ? '_aarch64' : '' }" { + architecture = eachArchitecture + type = 'docker' + version = VersionProperties.getElasticsearch() + failIfUnavailable = false // This ensures we don't attempt to build images if docker is unavailable } } } tasks.named("preProcessFixture").configure { - dependsOn elasticsearch_distributions.docker_default, elasticsearch_distributions.docker_oss + dependsOn elasticsearch_distributions.docker doLast { // tests expect to have an empty repo project.delete( - "${buildDir}/repo", "${buildDir}/oss-repo" ) createAndSetWritable( - "${buildDir}/repo", "${buildDir}/oss-repo", - "${buildDir}/logs/default-1", - "${buildDir}/logs/default-2", "${buildDir}/logs/oss-1", "${buildDir}/logs/oss-2" ) @@ -198,34 +165,24 @@ tasks.named("check").configure { dependsOn "integTest" } -void addBuildDockerImage(Architecture architecture, boolean oss, DockerBase base) { - if (oss && base != DockerBase.CENTOS) { +void addBuildDockerImage(Architecture architecture, DockerBase base) { + if (base != DockerBase.CENTOS) { throw new GradleException("The only allowed docker base image for OSS builds is CENTOS") } final TaskProvider buildDockerImageTask = - tasks.register(taskName("build", architecture, oss, base, "DockerImage"), DockerBuildTask) { + tasks.register(taskName("build", architecture, base, "DockerImage"), DockerBuildTask) { onlyIf { Architecture.current() == architecture } - TaskProvider copyContextTask = tasks.named(taskName("copy", architecture, oss, base, "DockerContext")) + TaskProvider copyContextTask = tasks.named(taskName("copy", architecture, base, "DockerContext")) dependsOn(copyContextTask) dockerContext.fileProvider(copyContextTask.map { it.destinationDir }) baseImages = [ base.getImage() ] String version = VersionProperties.elasticsearch - if (oss) { tags = [ "docker.elastic.co/elasticsearch/elasticsearch-oss:${version}", "elasticsearch-oss:test" ] - } else { - String suffix = base == DockerBase.UBI ? '-ubi8' : '' - tags = [ - "elasticsearch${suffix}:${version}", - "docker.elastic.co/elasticsearch/elasticsearch${suffix}:${version}", - "docker.elastic.co/elasticsearch/elasticsearch-full${suffix}:${version}", - "elasticsearch${suffix}:test", - ] - } } tasks.named("assemble").configure { dependsOn(buildDockerImageTask) @@ -233,15 +190,11 @@ void addBuildDockerImage(Architecture architecture, boolean oss, DockerBase base } for (final Architecture architecture : Architecture.values()) { + // We only create Docker images for the OSS distribution on CentOS. for (final DockerBase base : DockerBase.values()) { - for (final boolean oss : [false, true]) { - if (oss && base != DockerBase.CENTOS) { - // We only create Docker images for the OSS distribution on CentOS. - // Other bases only use the default distribution. - continue - } - addCopyDockerContextTask(architecture, oss, base) - addBuildDockerImage(architecture, oss, base) + if (base == DockerBase.CENTOS) { + addCopyDockerContextTask(architecture, base) + addBuildDockerImage(architecture, base) } } } @@ -262,16 +215,15 @@ subprojects { Project subProject -> apply plugin: 'distribution' final Architecture architecture = subProject.name.contains('aarch64-') ? Architecture.AARCH64 : Architecture.X64 - final boolean oss = subProject.name.contains('oss-') - final DockerBase base = subProject.name.contains('ubi-') ? DockerBase.UBI : DockerBase.CENTOS + final DockerBase base = DockerBase.CENTOS final String arch = architecture == Architecture.AARCH64 ? '-aarch64' : '' - final String suffix = oss ? '-oss' : base == DockerBase.UBI ? '-ubi8' : '' - final String extension = base == DockerBase.UBI ? 'ubi.tar' : 'docker.tar' + final String suffix = '-oss' + final String extension = 'docker.tar' final String artifactName = "elasticsearch${arch}${suffix}_test" - final String exportTaskName = taskName("export", architecture, oss, base, "DockerImage") - final String buildTaskName = taskName("build", architecture, oss, base, "DockerImage") + final String exportTaskName = taskName("export", architecture, base, "DockerImage") + final String buildTaskName = taskName("build", architecture, base, "DockerImage") final String tarFile = "${parent.projectDir}/build/${artifactName}_${VersionProperties.elasticsearch}.${extension}" tasks.register(exportTaskName, LoggedExec) { diff --git a/distribution/docker/docker-aarch64-export/build.gradle b/distribution/docker/docker-aarch64-export/build.gradle deleted file mode 100644 index 537b5a093683e..0000000000000 --- a/distribution/docker/docker-aarch64-export/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -// This file is intentionally blank. All configuration of the -// export is done in the parent project. diff --git a/distribution/docker/docker-build-context/build.gradle b/distribution/docker/docker-build-context/build.gradle deleted file mode 100644 index 0f5a9e5d6773f..0000000000000 --- a/distribution/docker/docker-build-context/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -import org.elasticsearch.gradle.DockerBase - -apply plugin: 'base' - -tasks.register("buildDockerBuildContext", Tar) { - archiveExtension = 'tar.gz' - compression = Compression.GZIP - archiveClassifier = "docker-build-context" - archiveBaseName = "elasticsearch" - // Non-local builds don't need to specify an architecture. - with dockerBuildContext(null, false, DockerBase.CENTOS, false) -} - -tasks.named("assemble").configure {dependsOn "buildDockerBuildContext"} diff --git a/distribution/docker/docker-export/build.gradle b/distribution/docker/docker-export/build.gradle deleted file mode 100644 index 537b5a093683e..0000000000000 --- a/distribution/docker/docker-export/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -// This file is intentionally blank. All configuration of the -// export is done in the parent project. diff --git a/distribution/docker/docker-test-entrypoint.sh b/distribution/docker/docker-test-entrypoint.sh index b98d4a1a148a9..4c5003664eabd 100755 --- a/distribution/docker/docker-test-entrypoint.sh +++ b/distribution/docker/docker-test-entrypoint.sh @@ -1,5 +1,5 @@ #!/bin/bash cd /usr/share/elasticsearch/bin/ -./elasticsearch-users useradd x_pack_rest_user -p x-pack-test-password -r superuser || true +./elasticsearch-users useradd rest_user -p test-password -r superuser || true echo "testnode" > /tmp/password /usr/local/bin/docker-entrypoint.sh | tee > /usr/share/elasticsearch/logs/console.log diff --git a/distribution/docker/oss-docker-build-context/build.gradle b/distribution/docker/oss-docker-build-context/build.gradle index 54fa932652d27..82967f56dced7 100644 --- a/distribution/docker/oss-docker-build-context/build.gradle +++ b/distribution/docker/oss-docker-build-context/build.gradle @@ -8,7 +8,7 @@ tasks.register("buildOssDockerBuildContext", Tar) { archiveClassifier = "docker-build-context" archiveBaseName = "elasticsearch-oss" // Non-local builds don't need to specify an architecture. - with dockerBuildContext(null, true, DockerBase.CENTOS, false) + with dockerBuildContext(null, DockerBase.CENTOS, false) } tasks.named("assemble").configure { dependsOn "buildOssDockerBuildContext" } diff --git a/distribution/docker/src/docker/Dockerfile b/distribution/docker/src/docker/Dockerfile index e671d39a4d84c..e8caea39dd926 100644 --- a/distribution/docker/src/docker/Dockerfile +++ b/distribution/docker/src/docker/Dockerfile @@ -20,10 +20,6 @@ ################################################################################ FROM ${base_image} AS builder -<% if (docker_base == 'ubi') { %> -# Install required packages to extract the Elasticsearch distribution -RUN ${package_manager} install -y tar gzip -<% } %> # `tini` is a tiny but valid init for containers. This is used to cleanly # control how ES and any child processes are shut down. # @@ -70,7 +66,7 @@ ENV ELASTIC_CONTAINER true RUN for iter in {1..10}; do \\ ${package_manager} update --setopt=tsflags=nodocs -y && \\ ${package_manager} install --setopt=tsflags=nodocs -y \\ - nc shadow-utils zip unzip <%= docker_base == 'ubi' ? 'findutils procps-ng' : '' %> && \\ + nc shadow-utils zip unzip && \\ ${package_manager} clean all && exit_code=0 && break || exit_code=\$? && echo "${package_manager} error: retry \$iter in 10s" && \\ sleep 10; \\ done; \\ @@ -124,18 +120,6 @@ LABEL org.label-schema.build-date="${build_date}" \\ org.opencontainers.image.url="https://www.elastic.co/products/elasticsearch" \\ org.opencontainers.image.vendor="Elastic" \\ org.opencontainers.image.version="${version}" -<% if (docker_base == 'ubi') { %> -LABEL name="Elasticsearch" \\ - maintainer="infra@elastic.co" \\ - vendor="Elastic" \\ - version="${version}" \\ - release="1" \\ - summary="Elasticsearch" \\ - description="You know, for search." - -RUN mkdir /licenses && \\ - cp LICENSE.txt /licenses/LICENSE -<% } %> ENTRYPOINT ["/tini", "--", "/usr/local/bin/docker-entrypoint.sh"] # Dummy overridable parameter parsed by entrypoint diff --git a/distribution/docker/src/test/java/org/elasticsearch/docker/test/DockerYmlTestSuiteIT.java b/distribution/docker/src/test/java/org/elasticsearch/docker/test/DockerYmlTestSuiteIT.java index 3a88301828096..26cfffa534e9b 100644 --- a/distribution/docker/src/test/java/org/elasticsearch/docker/test/DockerYmlTestSuiteIT.java +++ b/distribution/docker/src/test/java/org/elasticsearch/docker/test/DockerYmlTestSuiteIT.java @@ -21,12 +21,8 @@ import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.client.Request; -import org.elasticsearch.common.CharArrays; import org.elasticsearch.common.io.PathUtils; -import org.elasticsearch.common.settings.SecureString; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.test.rest.ESRestTestCase; import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate; import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase; import org.junit.AfterClass; @@ -35,16 +31,13 @@ import java.io.IOException; import java.net.URISyntaxException; -import java.nio.CharBuffer; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Arrays; -import java.util.Base64; public class DockerYmlTestSuiteIT extends ESClientYamlSuiteTestCase { - private static final String USER = "x_pack_rest_user"; - private static final String PASS = "x-pack-test-password"; + private static final String USER = "rest_user"; + private static final String PASS = "test-password"; private static final String KEYSTORE_PASS = "testnode"; public DockerYmlTestSuiteIT(ClientYamlTestCandidate testCandidate) { @@ -58,13 +51,12 @@ public static Iterable parameters() throws Exception { @Override protected String getTestRestCluster() { - String distribution = getDistribution(); return new StringBuilder() .append("localhost:") - .append(getProperty("test.fixtures.elasticsearch-" + distribution + "-1.tcp.9200")) + .append(getProperty("test.fixtures.elasticsearch-oss-1.tcp.9200")) .append(",") .append("localhost:") - .append(getProperty("test.fixtures.elasticsearch-" + distribution + "-2.tcp.9200")) + .append(getProperty("test.fixtures.elasticsearch-oss-2.tcp.9200")) .toString(); } @@ -73,18 +65,6 @@ protected boolean randomizeContentType() { return false; } - private String getDistribution() { - String distribution = System.getProperty("tests.distribution", "default"); - if (distribution.equals("oss") == false && distribution.equals("default") == false) { - throw new IllegalArgumentException("supported values for tests.distribution are oss or default but it was " + distribution); - } - return distribution; - } - - private boolean isOss() { - return getDistribution().equals("oss"); - } - private String getProperty(String key) { String value = System.getProperty(key); if (value == null) { @@ -124,40 +104,11 @@ public static void clearKeyStore() { @Override protected Settings restClientSettings() { - if (isOss()) { - return super.restClientSettings(); - } - String token = basicAuthHeaderValue(USER, new SecureString(PASS.toCharArray())); - return Settings.builder() - .put(ThreadContext.PREFIX + ".Authorization", token) - .put(ESRestTestCase.TRUSTSTORE_PATH, keyStore) - .put(ESRestTestCase.TRUSTSTORE_PASSWORD, KEYSTORE_PASS) - .build(); + return super.restClientSettings(); } @Override protected String getProtocol() { - if (isOss()) { - return "http"; - } - return "https"; - } - - private static String basicAuthHeaderValue(String username, SecureString passwd) { - CharBuffer chars = CharBuffer.allocate(username.length() + passwd.length() + 1); - byte[] charBytes = null; - try { - chars.put(username).put(':').put(passwd.getChars()); - charBytes = CharArrays.toUtf8Bytes(chars.array()); - - //TODO we still have passwords in Strings in headers. Maybe we can look into using a CharSequence? - String basicToken = Base64.getEncoder().encodeToString(charBytes); - return "Basic " + basicToken; - } finally { - Arrays.fill(chars.array(), (char) 0); - if (charBytes != null) { - Arrays.fill(charBytes, (byte) 0); - } - } + return "http"; } } diff --git a/distribution/docker/ubi-docker-aarch64-export/build.gradle b/distribution/docker/ubi-docker-aarch64-export/build.gradle deleted file mode 100644 index 537b5a093683e..0000000000000 --- a/distribution/docker/ubi-docker-aarch64-export/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -// This file is intentionally blank. All configuration of the -// export is done in the parent project. diff --git a/distribution/docker/ubi-docker-build-context/build.gradle b/distribution/docker/ubi-docker-build-context/build.gradle deleted file mode 100644 index 3fb9ba3a2b42f..0000000000000 --- a/distribution/docker/ubi-docker-build-context/build.gradle +++ /dev/null @@ -1,13 +0,0 @@ -import org.elasticsearch.gradle.DockerBase - -apply plugin: 'base' - -task buildUbiDockerBuildContext(type: Tar) { - archiveExtension = 'tar.gz' - compression = Compression.GZIP - archiveClassifier = "docker-build-context" - archiveBaseName = "elasticsearch-ubi8" - with dockerBuildContext(null, false, DockerBase.UBI, false) -} - -assemble.dependsOn buildUbiDockerBuildContext diff --git a/distribution/docker/ubi-docker-export/build.gradle b/distribution/docker/ubi-docker-export/build.gradle deleted file mode 100644 index 537b5a093683e..0000000000000 --- a/distribution/docker/ubi-docker-export/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -// This file is intentionally blank. All configuration of the -// export is done in the parent project. diff --git a/distribution/packages/aarch64-deb/build.gradle b/distribution/packages/aarch64-deb/build.gradle deleted file mode 100644 index 4a6dde5fc0c92..0000000000000 --- a/distribution/packages/aarch64-deb/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -// This file is intentionally blank. All configuration of the -// distribution is done in the parent project. diff --git a/distribution/packages/aarch64-rpm/build.gradle b/distribution/packages/aarch64-rpm/build.gradle deleted file mode 100644 index 4a6dde5fc0c92..0000000000000 --- a/distribution/packages/aarch64-rpm/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -// This file is intentionally blank. All configuration of the -// distribution is done in the parent project. diff --git a/distribution/packages/build.gradle b/distribution/packages/build.gradle index f599792cd08e7..b97e6ffc5f215 100644 --- a/distribution/packages/build.gradle +++ b/distribution/packages/build.gradle @@ -55,23 +55,23 @@ plugins { id "nebula.ospackage-base" version "8.3.0" } -void addProcessFilesTask(String type, boolean oss, boolean jdk) { - String packagingFiles = "build/packaging/${oss ? 'oss-' : ''}${jdk ? '' : 'no-jdk-'}${type}" +void addProcessFilesTask(String type, boolean jdk) { + String packagingFiles = "build/packaging/oss-${jdk ? '' : 'no-jdk-'}${type}" - String taskName = "process${oss ? 'Oss' : ''}${jdk ? '' : 'NoJdk'}${type.capitalize()}Files" + String taskName = "processOss'${jdk ? '' : 'NoJdk'}${type.capitalize()}Files" tasks.register(taskName, Copy) { into packagingFiles with copySpec { from 'src/common' from "src/${type}" - MavenFilteringHack.filter(it, expansionsForDistribution(type, oss, jdk)) + MavenFilteringHack.filter(it, expansionsForDistribution(type, jdk)) } into('etc/elasticsearch') { - with configFiles(type, oss, jdk) + with configFiles(type, jdk) } - MavenFilteringHack.filter(it, expansionsForDistribution(type, oss, jdk)) + MavenFilteringHack.filter(it, expansionsForDistribution(type, jdk)) doLast { // create empty dirs, we set the permissions when configuring the packages @@ -86,25 +86,21 @@ void addProcessFilesTask(String type, boolean oss, boolean jdk) { } } -addProcessFilesTask('deb', true, true) -addProcessFilesTask('deb', true, false) -addProcessFilesTask('deb', false, true) -addProcessFilesTask('deb', false, false) -addProcessFilesTask('rpm', true, true) -addProcessFilesTask('rpm', true, false) -addProcessFilesTask('rpm', false, true) -addProcessFilesTask('rpm', false, false) +addProcessFilesTask('deb', true) +addProcessFilesTask('deb', false) +addProcessFilesTask('rpm', true) +addProcessFilesTask('rpm', false) // Common configuration that is package dependent. This can't go in ospackage // since we have different templated files that need to be consumed, but the structure // is the same -Closure commonPackageConfig(String type, boolean oss, boolean jdk, String architecture) { +Closure commonPackageConfig(String type, boolean jdk, String architecture) { return { onlyIf { OS.current().equals(OS.WINDOWS) == false } - dependsOn "process${oss ? 'Oss' : ''}${jdk ? '' : 'NoJdk'}${type.capitalize()}Files" - packageName "elasticsearch${oss ? '-oss' : ''}" + dependsOn "processOss'${jdk ? '' : 'NoJdk'}${type.capitalize()}Files" + packageName "elasticsearch-oss" if (type == 'deb') { if (architecture == 'x64') { arch('amd64') @@ -123,13 +119,13 @@ Closure commonPackageConfig(String type, boolean oss, boolean jdk, String archit } // Follow elasticsearch's file naming convention String jdkString = jdk ? "" : "no-jdk-" - String prefix = "${architecture == 'aarch64' ? 'aarch64-' : ''}${oss ? 'oss-' : ''}${jdk ? '' : 'no-jdk-'}${type}" + String prefix = "${architecture == 'aarch64' ? 'aarch64-' : ''}oss-${jdk ? '' : 'no-jdk-'}${type}" destinationDirectory = file("${prefix}/build/distributions") // SystemPackagingTask overrides default archive task convention mappings, but doesn't provide a setter so we have to override the convention mapping itself conventionMapping.archiveFile = { objects.fileProperty().fileValue(file("${destinationDirectory.get()}/${packageName}-${project.version}-${jdkString}${archString}.${type}")) } - String packagingFiles = "build/packaging/${oss ? 'oss-' : ''}${jdk ? '' : 'no-jdk-'}${type}" + String packagingFiles = "build/packaging/oss-${jdk ? '' : 'no-jdk-'}${type}" String scripts = "${packagingFiles}/scripts" preInstall file("${scripts}/preinst") @@ -144,17 +140,17 @@ Closure commonPackageConfig(String type, boolean oss, boolean jdk, String archit // specify it again explicitly for copying common files into('/usr/share/elasticsearch') { into('bin') { - with binFiles(type, oss, jdk) + with binFiles(type, jdk) } from(rootProject.projectDir) { include 'README.asciidoc' fileMode 0644 } into('lib') { - with libFiles(oss) + with libFiles() } into('modules') { - with modulesFiles(oss, 'linux-' + ((architecture == 'x64') ? 'x86_64' : architecture)) + with modulesFiles('linux-' + ((architecture == 'x64') ? 'x86_64' : architecture)) } if (jdk) { into('jdk') { @@ -200,12 +196,6 @@ Closure commonPackageConfig(String type, boolean oss, boolean jdk, String archit configurationFile '/etc/elasticsearch/elasticsearch.yml' configurationFile '/etc/elasticsearch/jvm.options' configurationFile '/etc/elasticsearch/log4j2.properties' - if (oss == false) { - configurationFile '/etc/elasticsearch/role_mapping.yml' - configurationFile '/etc/elasticsearch/roles.yml' - configurationFile '/etc/elasticsearch/users' - configurationFile '/etc/elasticsearch/users_roles' - } from("${packagingFiles}") { dirMode 02750 into('/etc') @@ -224,7 +214,7 @@ Closure commonPackageConfig(String type, boolean oss, boolean jdk, String archit createDirectoryEntry true fileType CONFIG | NOREPLACE } - String envFile = expansionsForDistribution(type, oss, jdk)['path.env'] + String envFile = expansionsForDistribution(type, jdk)['path.env'] configurationFile envFile into(new File(envFile).getParent()) { fileType CONFIG | NOREPLACE @@ -279,11 +269,8 @@ Closure commonPackageConfig(String type, boolean oss, boolean jdk, String archit copyEmptyDir('/var/lib/elasticsearch', 'elasticsearch', 'elasticsearch', 02750) copyEmptyDir('/usr/share/elasticsearch/plugins', 'root', 'root', 0755) - // the oss package conflicts with the default distribution and vice versa - conflicts('elasticsearch' + (oss ? '' : '-oss')) - into '/usr/share/elasticsearch' - with noticeFile(oss, jdk) + with noticeFile(jdk) } } @@ -321,9 +308,9 @@ ospackage { into '/usr/share/elasticsearch' } -Closure commonDebConfig(boolean oss, boolean jdk, String architecture) { +Closure commonDebConfig(boolean jdk, String architecture) { return { - configure(commonPackageConfig('deb', oss, jdk, architecture)) + configure(commonPackageConfig('deb', jdk, architecture)) // jdeb does not provide a way to set the License control attribute, and ospackage // silently ignores setting it. Instead, we set the license as "custom field" @@ -340,40 +327,26 @@ Closure commonDebConfig(boolean oss, boolean jdk, String architecture) { into('/usr/share/lintian/overrides') { from('src/deb/lintian/elasticsearch') - if (oss) { - rename('elasticsearch', 'elasticsearch-oss') - } + rename('elasticsearch', 'elasticsearch-oss') } } } -tasks.register('buildAarch64Deb', Deb) { - configure(commonDebConfig(false, true, 'aarch64')) -} - -tasks.register('buildDeb', Deb) { - configure(commonDebConfig(false, true, 'x64')) -} - tasks.register('buildAarch64OssDeb', Deb) { - configure(commonDebConfig(true, true, 'aarch64')) + configure(commonDebConfig(true, 'aarch64')) } tasks.register('buildOssDeb', Deb) { - configure(commonDebConfig(true, true, 'x64')) -} - -tasks.register('buildNoJdkDeb', Deb) { - configure(commonDebConfig(false, false, 'x64')) + configure(commonDebConfig(true, 'x64')) } tasks.register('buildOssNoJdkDeb', Deb) { - configure(commonDebConfig(true, false, 'x64')) + configure(commonDebConfig(true, 'x64')) } -Closure commonRpmConfig(boolean oss, boolean jdk, String architecture) { +Closure commonRpmConfig(boolean jdk, String architecture) { return { - configure(commonPackageConfig('rpm', oss, jdk, architecture)) + configure(commonPackageConfig('rpm', jdk, architecture)) license 'ASL 2.0' @@ -396,28 +369,16 @@ Closure commonRpmConfig(boolean oss, boolean jdk, String architecture) { } } -tasks.register('buildAarch64Rpm', Rpm) { - configure(commonRpmConfig(false, true, 'aarch64')) -} - -tasks.register('buildRpm', Rpm) { - configure(commonRpmConfig(false, true, 'x64')) -} - tasks.register('buildAarch64OssRpm', Rpm) { - configure(commonRpmConfig(true, true, 'aarch64')) + configure(commonRpmConfig(true, 'aarch64')) } tasks.register('buildOssRpm', Rpm) { - configure(commonRpmConfig(true, true, 'x64')) -} - -tasks.register('buildNoJdkRpm', Rpm) { - configure(commonRpmConfig(false, false, 'x64')) + configure(commonRpmConfig(true, 'x64')) } tasks.register('buildOssNoJdkRpm', Rpm) { - configure(commonRpmConfig(true, false, 'x64')) + configure(commonRpmConfig(true, 'x64')) } Closure dpkgExists = { it -> new File('/bin/dpkg-deb').exists() || new File('/usr/bin/dpkg-deb').exists() || new File('/usr/local/bin/dpkg-deb').exists() } @@ -494,14 +455,7 @@ subprojects { Path copyrightPath String expectedLicense String licenseFilename - if (project.name.contains('oss-')) { - copyrightPath = packageExtractionDir.toPath().resolve("usr/share/doc/elasticsearch-oss/copyright") - } - // TODO - remove this block and only check for the OSS distribution - // https://github.com/opendistro-for-elasticsearch/search/issues/50 - else { - copyrightPath = packageExtractionDir.toPath().resolve("usr/share/doc/elasticsearch/copyright") - } + copyrightPath = packageExtractionDir.toPath().resolve("usr/share/doc/elasticsearch-oss/copyright") expectedLicense = "ASL-2.0" licenseFilename = "APACHE-LICENSE-2.0.txt" final List header = Arrays.asList("Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/", diff --git a/distribution/packages/deb/build.gradle b/distribution/packages/deb/build.gradle deleted file mode 100644 index 4a6dde5fc0c92..0000000000000 --- a/distribution/packages/deb/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -// This file is intentionally blank. All configuration of the -// distribution is done in the parent project. diff --git a/distribution/packages/no-jdk-deb/build.gradle b/distribution/packages/no-jdk-deb/build.gradle deleted file mode 100644 index 4a6dde5fc0c92..0000000000000 --- a/distribution/packages/no-jdk-deb/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -// This file is intentionally blank. All configuration of the -// distribution is done in the parent project. diff --git a/distribution/packages/no-jdk-rpm/build.gradle b/distribution/packages/no-jdk-rpm/build.gradle deleted file mode 100644 index 4a6dde5fc0c92..0000000000000 --- a/distribution/packages/no-jdk-rpm/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -// This file is intentionally blank. All configuration of the -// distribution is done in the parent project. diff --git a/distribution/packages/no-jdk-rpm/src/main/resources/logo/elastic.gif b/distribution/packages/no-jdk-rpm/src/main/resources/logo/elastic.gif deleted file mode 100755 index e3b20998d5300fdb08716ab6ac8005d3e1b41e33..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1865 zcmV-P2e$Y}Nk%w1VL1Rf0O$VzEk%zmMvyN@kugb=HB6Q+PnbGUmOE0H6K7Z)W>OVs zSwL2s7;0NXS)N2%pB!yoA8%kGabinip(k}_O=P1gcxhB@rZ9bO>qCoNY^YXlsp?CO zL4$PePLM-|c4v97M~QlAd$H_SnM#a(Zh*H~kc04JpmT`0UY3Y=jJ)w{q+ywiVw#Qb zaHfHgylE*!R8za?{NA zt<3ko9IDV(s9`?f@f7Q>p!`}DAA*|+S8@v+tSwN_}Fd7 z+}rutZur@CuI1g-+3C#Vp!wQ%$===0-`KI|-_GTtx#r;c-G$BPs@dJ`y6EBj--p%c zti0;v`{0lH*yY*d-qq=}zU=1K>b2YD;QQmA#_Z?E?dbjGpycK6$nNR>=AruG>;31b z{O7LV>gCGt>*wh5{p0S^@a_KUvD5MH$vLc_W$j=*7WiJ?!oBt?C$UR<@MYC z@X6ry^#1Ji^YHcX^6&og(e3u#;`jFQ^zr-g_x1Dl{`A@E_xSVm^5psW@b>ug_vZfd z`uO$w>-qWe_xbhr^#Anx?E3rj`1}9${Pg*j2b+R5-W;C`0!pbN^QQVRCz{FFpwi-3e=eF&dQrN+u*wAPo_wJ_blNY zdecwFo<3*#llSc#KBWIN>LE&1WgBw$l142jjSUhcbF_UcIkjrlHt+EH#22r~1`Kd9 zY`B7Pli9m|c*gV>uSMLyD$4mgbN8;ScO(6k1M>GTkZ-#w$ZqQ7Nt8^d*jFPP-J zwX#;M7e;ejTlYeJHmfIN#czyFZ>aZ9(CVsUDo=!M8iR>={!-qiN)2kmdR%(z(DrV4 z)t8pFWr5M5ahQ6=oKwYRe4)Q~=9vEC;}vFx2n?zGq0&y&S9g->+Ev*x3H&yEPM67h z*NFX4XYU#0PdIxx0KkC*Xdpu#-Nb{9RQ}yWhi)W=vqS&~W|(0B6u2OaKe$Awl2Puc zLt#PTq=BJ^EFPG`Ho-+m$vx^Av%(0<%myd%q%pPf;Rkz^>~rI#<91C>9! znCYVg%xLruDr!j91~oJWG3TM3IOz`|da`H%Htn>dk2@LNLWfy&taFb$FC2O(3f>^) zPachC_(6Q!FwsLF>A3UIF#cuXWYj$8l;G*149p|yD5U~$LOl9FLqrY4;sD1r?EvMB zZ7V@SV>2Aw>ZvNCwj)5JF|=b3F+C9LZ4EbcL5w{bk#mU{p%|G<1=4yth^XO&U}gYE zq+<^)Iee>c4Nt_Pk3H`M98M(=wCiakP~F3blmd8RjyhQsU!JYzh zXE-OcNWdQ9%!A0pC=)vbG4m+G@u3q?s8|LX9*{{m`qYu~&Q#c=&Im7i`9n7b-4hN8 z2R1Ov!)Wa6v@Y{-5_AF)SQDT=>BK?8G3eNXh0{(q;j^tABOu2)4n^8dI!}NNHZ1q# z^1=n}A~1!W-nCbMh$5L=WO zpn#q@?sOmaAOnRKf2@*?Kf0ddDn%!vX5nki9jWsC)VVANA1SDosRTc!oG2>#E^{ zO6}Py>fB*nH Dw&FU# diff --git a/distribution/packages/rpm/build.gradle b/distribution/packages/rpm/build.gradle deleted file mode 100644 index 4a6dde5fc0c92..0000000000000 --- a/distribution/packages/rpm/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -// This file is intentionally blank. All configuration of the -// distribution is done in the parent project. diff --git a/distribution/packages/rpm/src/main/resources/logo/elastic.gif b/distribution/packages/rpm/src/main/resources/logo/elastic.gif deleted file mode 100755 index e3b20998d5300fdb08716ab6ac8005d3e1b41e33..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1865 zcmV-P2e$Y}Nk%w1VL1Rf0O$VzEk%zmMvyN@kugb=HB6Q+PnbGUmOE0H6K7Z)W>OVs zSwL2s7;0NXS)N2%pB!yoA8%kGabinip(k}_O=P1gcxhB@rZ9bO>qCoNY^YXlsp?CO zL4$PePLM-|c4v97M~QlAd$H_SnM#a(Zh*H~kc04JpmT`0UY3Y=jJ)w{q+ywiVw#Qb zaHfHgylE*!R8za?{NA zt<3ko9IDV(s9`?f@f7Q>p!`}DAA*|+S8@v+tSwN_}Fd7 z+}rutZur@CuI1g-+3C#Vp!wQ%$===0-`KI|-_GTtx#r;c-G$BPs@dJ`y6EBj--p%c zti0;v`{0lH*yY*d-qq=}zU=1K>b2YD;QQmA#_Z?E?dbjGpycK6$nNR>=AruG>;31b z{O7LV>gCGt>*wh5{p0S^@a_KUvD5MH$vLc_W$j=*7WiJ?!oBt?C$UR<@MYC z@X6ry^#1Ji^YHcX^6&og(e3u#;`jFQ^zr-g_x1Dl{`A@E_xSVm^5psW@b>ug_vZfd z`uO$w>-qWe_xbhr^#Anx?E3rj`1}9${Pg*j2b+R5-W;C`0!pbN^QQVRCz{FFpwi-3e=eF&dQrN+u*wAPo_wJ_blNY zdecwFo<3*#llSc#KBWIN>LE&1WgBw$l142jjSUhcbF_UcIkjrlHt+EH#22r~1`Kd9 zY`B7Pli9m|c*gV>uSMLyD$4mgbN8;ScO(6k1M>GTkZ-#w$ZqQ7Nt8^d*jFPP-J zwX#;M7e;ejTlYeJHmfIN#czyFZ>aZ9(CVsUDo=!M8iR>={!-qiN)2kmdR%(z(DrV4 z)t8pFWr5M5ahQ6=oKwYRe4)Q~=9vEC;}vFx2n?zGq0&y&S9g->+Ev*x3H&yEPM67h z*NFX4XYU#0PdIxx0KkC*Xdpu#-Nb{9RQ}yWhi)W=vqS&~W|(0B6u2OaKe$Awl2Puc zLt#PTq=BJ^EFPG`Ho-+m$vx^Av%(0<%myd%q%pPf;Rkz^>~rI#<91C>9! znCYVg%xLruDr!j91~oJWG3TM3IOz`|da`H%Htn>dk2@LNLWfy&taFb$FC2O(3f>^) zPachC_(6Q!FwsLF>A3UIF#cuXWYj$8l;G*149p|yD5U~$LOl9FLqrY4;sD1r?EvMB zZ7V@SV>2Aw>ZvNCwj)5JF|=b3F+C9LZ4EbcL5w{bk#mU{p%|G<1=4yth^XO&U}gYE zq+<^)Iee>c4Nt_Pk3H`M98M(=wCiakP~F3blmd8RjyhQsU!JYzh zXE-OcNWdQ9%!A0pC=)vbG4m+G@u3q?s8|LX9*{{m`qYu~&Q#c=&Im7i`9n7b-4hN8 z2R1Ov!)Wa6v@Y{-5_AF)SQDT=>BK?8G3eNXh0{(q;j^tABOu2)4n^8dI!}NNHZ1q# z^1=n}A~1!W-nCbMh$5L=WO zpn#q@?sOmaAOnRKf2@*?Kf0ddDn%!vX5nki9jWsC)VVANA1SDosRTc!oG2>#E^{ zO6}Py>fB*nH Dw&FU# diff --git a/distribution/src/bin/elasticsearch b/distribution/src/bin/elasticsearch index e2c2288cb664c..9fed34c506fbe 100755 --- a/distribution/src/bin/elasticsearch +++ b/distribution/src/bin/elasticsearch @@ -62,7 +62,6 @@ if [[ $DAEMONIZE = false ]]; then $ES_JAVA_OPTS \ -Des.path.home="$ES_HOME" \ -Des.path.conf="$ES_PATH_CONF" \ - -Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \ -Des.distribution.type="$ES_DISTRIBUTION_TYPE" \ -Des.bundled_jdk="$ES_BUNDLED_JDK" \ -cp "$ES_CLASSPATH" \ @@ -75,7 +74,6 @@ else $ES_JAVA_OPTS \ -Des.path.home="$ES_HOME" \ -Des.path.conf="$ES_PATH_CONF" \ - -Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \ -Des.distribution.type="$ES_DISTRIBUTION_TYPE" \ -Des.bundled_jdk="$ES_BUNDLED_JDK" \ -cp "$ES_CLASSPATH" \ diff --git a/distribution/src/bin/elasticsearch-cli b/distribution/src/bin/elasticsearch-cli index 6f03456eb0122..ce951398cb81b 100644 --- a/distribution/src/bin/elasticsearch-cli +++ b/distribution/src/bin/elasticsearch-cli @@ -26,7 +26,6 @@ exec \ $ES_JAVA_OPTS \ -Des.path.home="$ES_HOME" \ -Des.path.conf="$ES_PATH_CONF" \ - -Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \ -Des.distribution.type="$ES_DISTRIBUTION_TYPE" \ -cp "$ES_CLASSPATH" \ "$ES_MAIN_CLASS" \ diff --git a/distribution/src/bin/elasticsearch-cli.bat b/distribution/src/bin/elasticsearch-cli.bat index 866e8efc6689b..a69a02da2b8a0 100644 --- a/distribution/src/bin/elasticsearch-cli.bat +++ b/distribution/src/bin/elasticsearch-cli.bat @@ -20,7 +20,6 @@ set ES_JAVA_OPTS=-Xms4m -Xmx64m -XX:+UseSerialGC %ES_JAVA_OPTS% %ES_JAVA_OPTS% ^ -Des.path.home="%ES_HOME%" ^ -Des.path.conf="%ES_PATH_CONF%" ^ - -Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^ -Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^ -cp "%ES_CLASSPATH%" ^ "%ES_MAIN_CLASS%" ^ diff --git a/distribution/src/bin/elasticsearch-env b/distribution/src/bin/elasticsearch-env index 6938f0e0a7aee..43952fabc6ded 100644 --- a/distribution/src/bin/elasticsearch-env +++ b/distribution/src/bin/elasticsearch-env @@ -88,7 +88,6 @@ fi # now make ES_PATH_CONF absolute ES_PATH_CONF=`cd "$ES_PATH_CONF"; pwd` -ES_DISTRIBUTION_FLAVOR=${es.distribution.flavor} ES_DISTRIBUTION_TYPE=${es.distribution.type} ES_BUNDLED_JDK=${es.bundled_jdk} diff --git a/distribution/src/bin/elasticsearch-env.bat b/distribution/src/bin/elasticsearch-env.bat index 14e2a4e164b49..c9a67b0f8a25d 100644 --- a/distribution/src/bin/elasticsearch-env.bat +++ b/distribution/src/bin/elasticsearch-env.bat @@ -25,7 +25,6 @@ if not defined ES_PATH_CONF ( rem now make ES_PATH_CONF absolute for %%I in ("%ES_PATH_CONF%..") do set ES_PATH_CONF=%%~dpfI -set ES_DISTRIBUTION_FLAVOR=${es.distribution.flavor} set ES_DISTRIBUTION_TYPE=${es.distribution.type} set ES_BUNDLED_JDK=${es.bundled_jdk} diff --git a/distribution/src/bin/elasticsearch-service.bat b/distribution/src/bin/elasticsearch-service.bat index c85de5317c63c..0b9300e9de660 100644 --- a/distribution/src/bin/elasticsearch-service.bat +++ b/distribution/src/bin/elasticsearch-service.bat @@ -194,7 +194,7 @@ if "%JVM_SS%" == "" ( set OTHER_JAVA_OPTS=%OTHER_JAVA_OPTS:"=% set OTHER_JAVA_OPTS=%OTHER_JAVA_OPTS:~1% -set ES_PARAMS=-Delasticsearch;-Des.path.home="%ES_HOME%";-Des.path.conf="%ES_PATH_CONF%";-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%";-Des.distribution.type="%ES_DISTRIBUTION_TYPE%";-Des.bundled_jdk="%ES_BUNDLED_JDK%" +set ES_PARAMS=-Delasticsearch;-Des.path.home="%ES_HOME%";-Des.path.conf="%ES_PATH_CONF%";-Des.distribution.type="%ES_DISTRIBUTION_TYPE%";-Des.bundled_jdk="%ES_BUNDLED_JDK%" if "%ES_START_TYPE%" == "" set ES_START_TYPE=manual if "%ES_STOP_TIMEOUT%" == "" set ES_STOP_TIMEOUT=0 diff --git a/distribution/src/bin/elasticsearch.bat b/distribution/src/bin/elasticsearch.bat index 13f6b59ffda8d..eff3646445e36 100644 --- a/distribution/src/bin/elasticsearch.bat +++ b/distribution/src/bin/elasticsearch.bat @@ -99,7 +99,6 @@ SET KEYSTORE_PASSWORD=!KEYSTORE_PASSWORD:^\=^^^\! ECHO.!KEYSTORE_PASSWORD!| %JAVA% %ES_JAVA_OPTS% -Delasticsearch ^ -Des.path.home="%ES_HOME%" -Des.path.conf="%ES_PATH_CONF%" ^ - -Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^ -Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^ -Des.bundled_jdk="%ES_BUNDLED_JDK%" ^ -cp "%ES_CLASSPATH%" "org.elasticsearch.bootstrap.Elasticsearch" !newparams! diff --git a/docs/plugins/discovery-azure-classic.asciidoc b/docs/plugins/discovery-azure-classic.asciidoc index b7a94ea60e274..f928f78aacdbf 100644 --- a/docs/plugins/discovery-azure-classic.asciidoc +++ b/docs/plugins/discovery-azure-classic.asciidoc @@ -350,7 +350,6 @@ This command should give you a JSON result: "cluster_uuid" : "AT69_T_DTp-1qgIJlatQqA", "version" : { "number" : "{version_qualified}", - "build_flavor" : "{build_flavor}", "build_type" : "{build_type}", "build_hash" : "f27399d", "build_date" : "2016-03-30T09:51:41.449Z", diff --git a/docs/reference/cluster/nodes-info.asciidoc b/docs/reference/cluster/nodes-info.asciidoc index 9b1677bedb5db..93cc28dfabee7 100644 --- a/docs/reference/cluster/nodes-info.asciidoc +++ b/docs/reference/cluster/nodes-info.asciidoc @@ -209,7 +209,6 @@ The API returns the following response: "host": "node-0.elastic.co", "ip": "192.168.17", "version": "{version}", - "build_flavor": "{build_flavor}", "build_type": "{build_type}", "build_hash": "587409e", "roles": [ @@ -280,7 +279,6 @@ The API returns the following response: "host": "node-0.elastic.co", "ip": "192.168.17", "version": "{version}", - "build_flavor": "{build_flavor}", "build_type": "{build_type}", "build_hash": "587409e", "roles": [], diff --git a/docs/reference/setup/install/check-running.asciidoc b/docs/reference/setup/install/check-running.asciidoc index e25d9f6a35fbc..87be229ac0fa5 100644 --- a/docs/reference/setup/install/check-running.asciidoc +++ b/docs/reference/setup/install/check-running.asciidoc @@ -18,7 +18,6 @@ which should give you a response something like this: "cluster_uuid" : "AT69_T_DTp-1qgIJlatQqA", "version" : { "number" : "{version_qualified}", - "build_flavor" : "{build_flavor}", "build_type" : "{build_type}", "build_hash" : "f27399d", "build_date" : "2016-03-30T09:51:41.449Z", diff --git a/gradle/local-distribution.gradle b/gradle/local-distribution.gradle index ffd19d66192dc..d9e7efffba35d 100644 --- a/gradle/local-distribution.gradle +++ b/gradle/local-distribution.gradle @@ -29,7 +29,6 @@ apply plugin:'elasticsearch.internal-distribution-download' elasticsearch_distributions { local { - flavor = 'default' type = 'archive' architecture = Architecture.current() } diff --git a/qa/os/src/test/java/org/elasticsearch/packaging/test/ArchiveTests.java b/qa/os/src/test/java/org/elasticsearch/packaging/test/ArchiveTests.java index fb684ab40595c..8196b2162b2ce 100644 --- a/qa/os/src/test/java/org/elasticsearch/packaging/test/ArchiveTests.java +++ b/qa/os/src/test/java/org/elasticsearch/packaging/test/ArchiveTests.java @@ -339,12 +339,6 @@ public void test91ElasticsearchShardCliPackaging() throws Exception { final Result result = sh.run(bin.shardTool + " -h"); assertThat(result.stdout, containsString("A CLI tool to remove corrupted parts of unrecoverable shards")); }; - - // TODO: this should be checked on all distributions - if (distribution().isDefault()) { - Platforms.onLinux(action); - Platforms.onWindows(action); - } } public void test92ElasticsearchNodeCliPackaging() throws Exception { @@ -354,12 +348,6 @@ public void test92ElasticsearchNodeCliPackaging() throws Exception { final Result result = sh.run(bin.nodeTool + " -h"); assertThat(result.stdout, containsString("A CLI tool to do unsafe cluster and index manipulations on current node")); }; - - // TODO: this should be checked on all distributions - if (distribution().isDefault()) { - Platforms.onLinux(action); - Platforms.onWindows(action); - } } public void test93ElasticsearchNodeCustomDataPathAndNotEsHomeWorkDir() throws Exception { diff --git a/qa/os/src/test/java/org/elasticsearch/packaging/test/DebMetadataTests.java b/qa/os/src/test/java/org/elasticsearch/packaging/test/DebMetadataTests.java index c42806140fedc..fb4b1b1494f4a 100644 --- a/qa/os/src/test/java/org/elasticsearch/packaging/test/DebMetadataTests.java +++ b/qa/os/src/test/java/org/elasticsearch/packaging/test/DebMetadataTests.java @@ -52,12 +52,5 @@ public void test06Dependencies() { final Shell.Result result = sh.run("dpkg -I " + getDistributionFile(distribution())); TestCase.assertTrue(Pattern.compile("(?m)^ Depends:.*bash.*").matcher(result.stdout).find()); - - String oppositePackageName = "elasticsearch"; - if (distribution().isDefault()) { - oppositePackageName += "-oss"; - } - - TestCase.assertTrue(Pattern.compile("(?m)^ Conflicts: " + oppositePackageName + "$").matcher(result.stdout).find()); } } diff --git a/qa/os/src/test/java/org/elasticsearch/packaging/test/DebPreservationTests.java b/qa/os/src/test/java/org/elasticsearch/packaging/test/DebPreservationTests.java index 2c0faa1dc33c9..c65dbeb1e4b73 100644 --- a/qa/os/src/test/java/org/elasticsearch/packaging/test/DebPreservationTests.java +++ b/qa/os/src/test/java/org/elasticsearch/packaging/test/DebPreservationTests.java @@ -32,10 +32,8 @@ import static org.elasticsearch.packaging.util.Packages.assertInstalled; import static org.elasticsearch.packaging.util.Packages.assertRemoved; import static org.elasticsearch.packaging.util.Packages.installPackage; -import static org.elasticsearch.packaging.util.Packages.packageStatus; import static org.elasticsearch.packaging.util.Packages.remove; import static org.elasticsearch.packaging.util.Packages.verifyPackageInstallation; -import static org.hamcrest.core.Is.is; import static org.junit.Assume.assumeTrue; public class DebPreservationTests extends PackagingTestCase { @@ -67,43 +65,14 @@ public void test20Remove() throws Exception { installation.config(Paths.get("jvm.options.d", "heap.options")) ); - if (distribution().isDefault()) { - assertPathsExist( - installation.config, - installation.config("role_mapping.yml"), - installation.config("roles.yml"), - installation.config("users"), - installation.config("users_roles") - ); - } - // keystore was removed assertPathsDoNotExist(installation.config("elasticsearch.keystore"), installation.config(".elasticsearch.keystore.initial_md5sum")); - // doc files were removed - - assertPathsDoNotExist( - Paths.get("/usr/share/doc/" + distribution().flavor.name), - Paths.get("/usr/share/doc/" + distribution().flavor.name + "/copyright") - ); - // sysvinit service file was not removed assertThat(SYSVINIT_SCRIPT, fileExists()); // defaults file was not removed assertThat(installation.envFile, fileExists()); } - - public void test30Purge() throws Exception { - append(installation.config(Paths.get("jvm.options.d", "heap.options")), "# foo"); - - sh.run("dpkg --purge " + distribution().flavor.name); - - assertRemoved(distribution()); - - assertPathsDoNotExist(installation.config, installation.envFile, SYSVINIT_SCRIPT); - - assertThat(packageStatus(distribution()).exitCode, is(1)); - } } diff --git a/qa/os/src/test/java/org/elasticsearch/packaging/test/DockerTests.java b/qa/os/src/test/java/org/elasticsearch/packaging/test/DockerTests.java index deaf896314bb7..2f57f65e29ebe 100644 --- a/qa/os/src/test/java/org/elasticsearch/packaging/test/DockerTests.java +++ b/qa/os/src/test/java/org/elasticsearch/packaging/test/DockerTests.java @@ -20,8 +20,6 @@ package org.elasticsearch.packaging.test; import com.fasterxml.jackson.databind.JsonNode; -import org.apache.http.client.fluent.Request; -import org.elasticsearch.packaging.util.Distribution; import org.elasticsearch.packaging.util.Installation; import org.elasticsearch.packaging.util.Platforms; import org.elasticsearch.packaging.util.ServerUtils; @@ -59,10 +57,8 @@ import static org.elasticsearch.packaging.util.FileMatcher.p600; import static org.elasticsearch.packaging.util.FileMatcher.p644; import static org.elasticsearch.packaging.util.FileMatcher.p660; -import static org.elasticsearch.packaging.util.FileMatcher.p775; import static org.elasticsearch.packaging.util.FileUtils.append; import static org.elasticsearch.packaging.util.FileUtils.rm; -import static org.hamcrest.Matchers.arrayContaining; import static org.hamcrest.Matchers.arrayWithSize; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.emptyString; @@ -253,85 +249,6 @@ public void test072RunEsAsDifferentUserAndGroup() throws Exception { waitForElasticsearch(installation); } - /** - * Check that the elastic user's password can be configured via a file and the ELASTIC_PASSWORD_FILE environment variable. - */ - public void test080ConfigurePasswordThroughEnvironmentVariableFile() throws Exception { - // Test relies on configuring security - assumeTrue(distribution.isDefault()); - - final String xpackPassword = "hunter2"; - final String passwordFilename = "password.txt"; - - append(tempDir.resolve(passwordFilename), xpackPassword + "\n"); - - Map envVars = new HashMap<>(); - envVars.put("ELASTIC_PASSWORD_FILE", "/run/secrets/" + passwordFilename); - - // File permissions need to be secured in order for the ES wrapper to accept - // them for populating env var values - Files.setPosixFilePermissions(tempDir.resolve(passwordFilename), p600); - // But when running in Vagrant, also ensure ES can actually access the file - chownWithPrivilegeEscalation(tempDir.resolve(passwordFilename), "1000:0"); - - final Map volumes = singletonMap(tempDir, Paths.get("/run/secrets")); - - // Restart the container - runContainer(distribution(), volumes, envVars); - - // If we configured security correctly, then this call will only work if we specify the correct credentials. - try { - waitForElasticsearch("green", null, installation, "elastic", "hunter2"); - } catch (Exception e) { - throw new AssertionError( - "Failed to check whether Elasticsearch had started. This could be because " - + "authentication isn't working properly. Check the container logs", - e - ); - } - - // Also check that an unauthenticated call fails - final int statusCode = Request.Get("http://localhost:9200/_nodes").execute().returnResponse().getStatusLine().getStatusCode(); - assertThat("Expected server to require authentication", statusCode, equalTo(401)); - } - - /** - * Check that when verifying the file permissions of _FILE environment variables, symlinks - * are followed. - */ - public void test081SymlinksAreFollowedWithEnvironmentVariableFiles() throws Exception { - // Test relies on configuring security - assumeTrue(distribution.isDefault()); - // Test relies on symlinks - assumeFalse(Platforms.WINDOWS); - - final String xpackPassword = "hunter2"; - final String passwordFilename = "password.txt"; - final String symlinkFilename = "password_symlink"; - - // ELASTIC_PASSWORD_FILE - Files.write(tempDir.resolve(passwordFilename), (xpackPassword + "\n").getBytes(StandardCharsets.UTF_8)); - - // Link to the password file. We can't use an absolute path for the target, because - // it won't resolve inside the container. - Files.createSymbolicLink(tempDir.resolve(symlinkFilename), Paths.get(passwordFilename)); - - // Enable security so that we can test that the password has been used - Map envVars = new HashMap<>(); - envVars.put("ELASTIC_PASSWORD_FILE", "/run/secrets/" + symlinkFilename); - - // File permissions need to be secured in order for the ES wrapper to accept - // them for populating env var values. The wrapper will resolve the symlink - // and check the target's permissions. - Files.setPosixFilePermissions(tempDir.resolve(passwordFilename), p600); - - final Map volumes = singletonMap(tempDir, Paths.get("/run/secrets")); - - // Restart the container - this will check that Elasticsearch started correctly, - // and didn't fail to follow the symlink and check the file permissions - runContainer(distribution(), volumes, envVars); - } - /** * Check that environment variables cannot be used with _FILE environment variables. */ @@ -385,70 +302,6 @@ public void test083EnvironmentVariablesUsingFilesHaveCorrectPermissions() throws ); } - /** - * Check that when verifying the file permissions of _FILE environment variables, symlinks - * are followed, and that invalid target permissions are detected. - */ - public void test084SymlinkToFileWithInvalidPermissionsIsRejected() throws Exception { - // Test relies on configuring security - assumeTrue(distribution.isDefault()); - // Test relies on symlinks - assumeFalse(Platforms.WINDOWS); - - final String xpackPassword = "hunter2"; - final String passwordFilename = "password.txt"; - final String symlinkFilename = "password_symlink"; - - // ELASTIC_PASSWORD_FILE - Files.write(tempDir.resolve(passwordFilename), (xpackPassword + "\n").getBytes(StandardCharsets.UTF_8)); - - // Link to the password file. We can't use an absolute path for the target, because - // it won't resolve inside the container. - Files.createSymbolicLink(tempDir.resolve(symlinkFilename), Paths.get(passwordFilename)); - - // Enable security so that we can test that the password has been used - Map envVars = new HashMap<>(); - envVars.put("ELASTIC_PASSWORD_FILE", "/run/secrets/" + symlinkFilename); - - // Set invalid permissions on the file that the symlink targets - Files.setPosixFilePermissions(tempDir.resolve(passwordFilename), p775); - - final Map volumes = singletonMap(tempDir, Paths.get("/run/secrets")); - - // Restart the container - final Result dockerLogs = runContainerExpectingFailure(distribution(), volumes, envVars); - - assertThat( - dockerLogs.stderr, - containsString( - "ERROR: File " - + passwordFilename - + " (target of symlink /run/secrets/" - + symlinkFilename - + " from ELASTIC_PASSWORD_FILE) must have file permissions 400 or 600, but actually has: 775" - ) - ); - } - - /** - * Check that environment variables are translated to -E options even for commands invoked under - * `docker exec`, where the Docker image's entrypoint is not executed. - */ - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/67097") - public void test085EnvironmentVariablesAreRespectedUnderDockerExec() { - // This test relies on a CLI tool attempting to connect to Elasticsearch, and the - // tool in question is only in the default distribution. - assumeTrue(distribution.isDefault()); - - runContainer(distribution(), null, singletonMap("http.host", "this.is.not.valid")); - - // This will fail if the env var above is passed as a -E argument - final Result result = sh.runIgnoreExitCode("elasticsearch-setup-passwords auto"); - - assertFalse("elasticsearch-setup-passwords command should have failed", result.isSuccess()); - assertThat(result.stdout, containsString("java.net.UnknownHostException: this.is.not.valid: Name or service not known")); - } - /** * Check that the elasticsearch-shard tool is shipped in the Docker image and is executable. */ @@ -513,11 +366,7 @@ public void test110OrgLabelSchemaLabels() throws Exception { staticLabels.put("vcs-url", "https://github.com/elastic/elasticsearch"); staticLabels.put("vendor", "Elastic"); - if (distribution.isOSS()) { - staticLabels.put("license", "Apache-2.0"); - } else { - staticLabels.put("license", "Elastic-License"); - } + staticLabels.put("license", "Apache-2.0"); // TODO: we should check the actual version value final Set dynamicLabels = new HashSet<>(); @@ -553,11 +402,7 @@ public void test110OrgOpencontainersLabels() throws Exception { staticLabels.put("source", "https://github.com/elastic/elasticsearch"); staticLabels.put("vendor", "Elastic"); - if (distribution.isOSS()) { - staticLabels.put("licenses", "Apache-2.0"); - } else { - staticLabels.put("licenses", "Elastic-License"); - } + staticLabels.put("licenses", "Apache-2.0"); // TODO: we should check the actual version value final Set dynamicLabels = new HashSet<>(); @@ -644,46 +489,4 @@ public void test140CgroupOsStatsAreAvailable() throws Exception { assertThat("Failed to find [cpu] in node OS cgroup stats", cgroupStats.get("cpu"), not(nullValue())); assertThat("Failed to find [cpuacct] in node OS cgroup stats", cgroupStats.get("cpuacct"), not(nullValue())); } - - /** - * Check that the UBI images has the correct license information in the correct place. - */ - public void test200UbiImagesHaveLicenseDirectory() { - assumeTrue(distribution.packaging == Distribution.Packaging.DOCKER_UBI); - - final String[] files = sh.run("find /licenses -type f").stdout.split("\n"); - assertThat(files, arrayContaining("/licenses/LICENSE")); - - // UBI image doesn't contain `diff` - final String ubiLicense = sh.run("cat /licenses/LICENSE").stdout; - final String distroLicense = sh.run("cat /usr/share/elasticsearch/LICENSE.txt").stdout; - assertThat(ubiLicense, equalTo(distroLicense)); - } - - /** - * Check that the UBI image has the expected labels - */ - public void test210UbiLabels() throws Exception { - assumeTrue(distribution.packaging == Distribution.Packaging.DOCKER_UBI); - - final Map labels = getImageLabels(distribution); - - final Map staticLabels = new HashMap<>(); - staticLabels.put("name", "Elasticsearch"); - staticLabels.put("maintainer", "infra@elastic.co"); - staticLabels.put("vendor", "Elastic"); - staticLabels.put("summary", "Elasticsearch"); - staticLabels.put("description", "You know, for search."); - - final Set dynamicLabels = new HashSet<>(); - dynamicLabels.add("release"); - dynamicLabels.add("version"); - - staticLabels.forEach((key, value) -> { - assertThat(labels, hasKey(key)); - assertThat(labels.get(key), equalTo(value)); - }); - - dynamicLabels.forEach(key -> assertThat(labels, hasKey(key))); - } } diff --git a/qa/os/src/test/java/org/elasticsearch/packaging/test/KeystoreManagementTests.java b/qa/os/src/test/java/org/elasticsearch/packaging/test/KeystoreManagementTests.java index 2c2914c863881..a20986c7a30ff 100644 --- a/qa/os/src/test/java/org/elasticsearch/packaging/test/KeystoreManagementTests.java +++ b/qa/os/src/test/java/org/elasticsearch/packaging/test/KeystoreManagementTests.java @@ -491,7 +491,6 @@ private void verifyKeystorePermissions() { assertThat(keystore, file(File, "root", "elasticsearch", p660)); break; case DOCKER: - case DOCKER_UBI: assertPermissionsAndOwnership(keystore, p660); break; default: diff --git a/qa/os/src/test/java/org/elasticsearch/packaging/test/PackagingTestCase.java b/qa/os/src/test/java/org/elasticsearch/packaging/test/PackagingTestCase.java index 99aff5f4d6237..eed0d13e31769 100644 --- a/qa/os/src/test/java/org/elasticsearch/packaging/test/PackagingTestCase.java +++ b/qa/os/src/test/java/org/elasticsearch/packaging/test/PackagingTestCase.java @@ -220,7 +220,6 @@ protected static void install() throws Exception { Packages.verifyPackageInstallation(installation, distribution, sh); break; case DOCKER: - case DOCKER_UBI: installation = Docker.runContainer(distribution); Docker.verifyContainerInstallation(installation, distribution); break; @@ -296,7 +295,6 @@ public Shell.Result runElasticsearchStartCommand(String password, boolean daemon case RPM: return Packages.runElasticsearchStartCommand(sh); case DOCKER: - case DOCKER_UBI: // nothing, "installing" docker image is running it return Shell.NO_OP; default: @@ -315,7 +313,6 @@ public void stopElasticsearch() throws Exception { Packages.stopElasticsearch(sh); break; case DOCKER: - case DOCKER_UBI: // nothing, "installing" docker image is running it break; default: @@ -335,7 +332,6 @@ public void awaitElasticsearchStartup(Shell.Result result) throws Exception { Packages.assertElasticsearchStarted(sh, installation); break; case DOCKER: - case DOCKER_UBI: Docker.waitForElasticsearchToStart(); break; default: diff --git a/qa/os/src/test/java/org/elasticsearch/packaging/test/RpmMetadataTests.java b/qa/os/src/test/java/org/elasticsearch/packaging/test/RpmMetadataTests.java index e4e63c4eadd4a..0f3323de43e70 100644 --- a/qa/os/src/test/java/org/elasticsearch/packaging/test/RpmMetadataTests.java +++ b/qa/os/src/test/java/org/elasticsearch/packaging/test/RpmMetadataTests.java @@ -48,12 +48,5 @@ public void test11Dependencies() { TestCase.assertTrue(Pattern.compile("(?m)^/bin/bash\\s*$").matcher(deps.stdout).find()); final Shell.Result conflicts = sh.run("rpm -qp --conflicts " + getDistributionFile(distribution())); - - String oppositePackageName = "elasticsearch"; - if (distribution().isDefault()) { - oppositePackageName += "-oss"; - } - - TestCase.assertTrue(Pattern.compile("(?m)^" + oppositePackageName + "\\s*$").matcher(conflicts.stdout).find()); } } diff --git a/qa/os/src/test/java/org/elasticsearch/packaging/test/RpmPreservationTests.java b/qa/os/src/test/java/org/elasticsearch/packaging/test/RpmPreservationTests.java index 5a99f33277a24..bef306bab67a9 100644 --- a/qa/os/src/test/java/org/elasticsearch/packaging/test/RpmPreservationTests.java +++ b/qa/os/src/test/java/org/elasticsearch/packaging/test/RpmPreservationTests.java @@ -82,11 +82,6 @@ public void test30PreserveConfig() throws Exception { .map(each -> installation.config(each)) .forEach(path -> append(path, "# foo")); append(installation.config(Paths.get("jvm.options.d", "heap.options")), "# foo"); - if (distribution().isDefault()) { - Stream.of("role_mapping.yml", "roles.yml", "users", "users_roles") - .map(each -> installation.config(each)) - .forEach(path -> append(path, "# foo")); - } remove(distribution()); assertRemoved(distribution()); @@ -112,10 +107,6 @@ public void test30PreserveConfig() throws Exception { Stream.of("elasticsearch.yml", "jvm.options", "log4j2.properties").forEach(this::assertConfFilePreserved); assertThat(installation.config(Paths.get("jvm.options.d", "heap.options")), fileExists()); - - if (distribution().isDefault()) { - Stream.of("role_mapping.yml", "roles.yml", "users", "users_roles").forEach(this::assertConfFilePreserved); - } } private void assertConfFilePreserved(String configFile) { diff --git a/qa/os/src/test/java/org/elasticsearch/packaging/util/Distribution.java b/qa/os/src/test/java/org/elasticsearch/packaging/util/Distribution.java index 992335c9c2e19..89bdc015887a3 100644 --- a/qa/os/src/test/java/org/elasticsearch/packaging/util/Distribution.java +++ b/qa/os/src/test/java/org/elasticsearch/packaging/util/Distribution.java @@ -27,7 +27,6 @@ public class Distribution { public final Path path; public final Packaging packaging; public final Platform platform; - public final Flavor flavor; public final boolean hasJdk; public final String version; @@ -39,15 +38,12 @@ public Distribution(Path path) { this.packaging = Packaging.TAR; } else if (filename.endsWith(".docker.tar")) { this.packaging = Packaging.DOCKER; - } else if (filename.endsWith(".ubi.tar")) { - this.packaging = Packaging.DOCKER_UBI; } else { int lastDot = filename.lastIndexOf('.'); this.packaging = Packaging.valueOf(filename.substring(lastDot + 1).toUpperCase(Locale.ROOT)); } this.platform = filename.contains("windows") ? Platform.WINDOWS : Platform.LINUX; - this.flavor = filename.contains("oss") ? Flavor.OSS : Flavor.DEFAULT; this.hasJdk = filename.contains("no-jdk") == false; String version = filename.split("-", 3)[1]; if (filename.contains("-SNAPSHOT")) { @@ -56,14 +52,6 @@ public Distribution(Path path) { this.version = version; } - public boolean isDefault() { - return flavor.equals(Flavor.DEFAULT); - } - - public boolean isOSS() { - return flavor.equals(Flavor.OSS); - } - public boolean isArchive() { return packaging == Packaging.TAR || packaging == Packaging.ZIP; } @@ -73,7 +61,7 @@ public boolean isPackage() { } public boolean isDocker() { - return packaging == Packaging.DOCKER || packaging == Packaging.DOCKER_UBI; + return packaging == Packaging.DOCKER; } public enum Packaging { @@ -82,8 +70,7 @@ public enum Packaging { ZIP(".zip", Platforms.WINDOWS), DEB(".deb", Platforms.isDPKG()), RPM(".rpm", Platforms.isRPM()), - DOCKER(".docker.tar", Platforms.isDocker()), - DOCKER_UBI(".ubi.tar", Platforms.isDocker()); + DOCKER(".docker.tar", Platforms.isDocker()); /** The extension of this distribution's file */ public final String extension; @@ -106,16 +93,4 @@ public String toString() { return name().toLowerCase(Locale.ROOT); } } - - public enum Flavor { - - OSS("elasticsearch-oss"), - DEFAULT("elasticsearch"); - - public final String name; - - Flavor(String name) { - this.name = name; - } - } } diff --git a/qa/os/src/test/java/org/elasticsearch/packaging/util/Docker.java b/qa/os/src/test/java/org/elasticsearch/packaging/util/Docker.java index e619d6f0e299f..21dd6261b8a1f 100644 --- a/qa/os/src/test/java/org/elasticsearch/packaging/util/Docker.java +++ b/qa/os/src/test/java/org/elasticsearch/packaging/util/Docker.java @@ -586,6 +586,6 @@ public static Shell.Result getContainerLogs() { } public static String getImageName(Distribution distribution) { - return distribution.flavor.name + (distribution.packaging == Distribution.Packaging.DOCKER_UBI ? "-ubi8" : "") + ":test"; + return ":test"; } } diff --git a/qa/os/src/test/java/org/elasticsearch/packaging/util/Packages.java b/qa/os/src/test/java/org/elasticsearch/packaging/util/Packages.java index 5c1c89cbeaa25..1cf364aff1763 100644 --- a/qa/os/src/test/java/org/elasticsearch/packaging/util/Packages.java +++ b/qa/os/src/test/java/org/elasticsearch/packaging/util/Packages.java @@ -124,9 +124,7 @@ public static Installation forceUpgradePackage(Shell sh, Distribution distributi } private static Result runPackageManager(Distribution distribution, Shell sh, PackageManagerCommand command) { - final String distributionArg = command == PackageManagerCommand.QUERY || command == PackageManagerCommand.REMOVE - ? distribution.flavor.name - : distribution.path.toString(); + final String distributionArg = distribution.path.toString(); if (Platforms.isRPM()) { String rpmOptions = RPM_OPTIONS.get(command); @@ -204,7 +202,7 @@ private static void verifyOssInstallation(Installation es, Distribution distribu if (distribution.packaging == Distribution.Packaging.RPM) { assertThat(es.home.resolve("LICENSE.txt"), file(File, "root", "root", p644)); } else { - Path copyrightDir = Paths.get(sh.run("readlink -f /usr/share/doc/" + distribution.flavor.name).stdout.trim()); + Path copyrightDir = Paths.get(sh.run("readlink -f /usr/share/doc/").stdout.trim()); assertThat(copyrightDir, file(Directory, "root", "root", p755)); assertThat(copyrightDir.resolve("copyright"), file(File, "root", "root", p644)); } diff --git a/qa/remote-clusters/build.gradle b/qa/remote-clusters/build.gradle index e136ce16cf3e4..0c57252258aae 100644 --- a/qa/remote-clusters/build.gradle +++ b/qa/remote-clusters/build.gradle @@ -35,7 +35,6 @@ elasticsearch_distributions { docker { type = 'docker' architecture = Architecture.current() - flavor = System.getProperty('tests.distribution', 'default') version = VersionProperties.getElasticsearch() failIfUnavailable = false // This ensures we skip this testing if Docker is unavailable } @@ -62,11 +61,7 @@ preProcessFixture { dockerCompose { tcpPortsToIgnoreWhenWaiting = [9600, 9601] - if ('default'.equalsIgnoreCase(System.getProperty('tests.distribution', 'default'))) { - useComposeFiles = ['docker-compose.yml'] - } else { - useComposeFiles = ['docker-compose-oss.yml'] - } + useComposeFiles = ['docker-compose-oss.yml'] } def createAndSetWritable(Object... locations) { diff --git a/qa/remote-clusters/docker-compose.yml b/qa/remote-clusters/docker-compose.yml index b568127115eef..00421ecad749f 100644 --- a/qa/remote-clusters/docker-compose.yml +++ b/qa/remote-clusters/docker-compose.yml @@ -34,7 +34,7 @@ services: entrypoint: /docker-test-entrypoint.sh healthcheck: start_period: 15s - test: ["CMD", "curl", "-f", "-u", "x_pack_rest_user:x-pack-test-password", "-k", "https://localhost:9200"] + test: ["CMD", "curl", "-f", "-u", "rest_user:test-password", "-k", "https://localhost:9200"] interval: 10s timeout: 2s retries: 5 @@ -71,7 +71,7 @@ services: entrypoint: /docker-test-entrypoint.sh healthcheck: start_period: 15s - test: ["CMD", "curl", "-f", "-u", "x_pack_rest_user:x-pack-test-password", "-k", "https://localhost:9200"] + test: ["CMD", "curl", "-f", "-u", "rest_user:test-password", "-k", "https://localhost:9200"] interval: 10s timeout: 2s retries: 5 diff --git a/qa/remote-clusters/docker-test-entrypoint.sh b/qa/remote-clusters/docker-test-entrypoint.sh index b98d4a1a148a9..4c5003664eabd 100755 --- a/qa/remote-clusters/docker-test-entrypoint.sh +++ b/qa/remote-clusters/docker-test-entrypoint.sh @@ -1,5 +1,5 @@ #!/bin/bash cd /usr/share/elasticsearch/bin/ -./elasticsearch-users useradd x_pack_rest_user -p x-pack-test-password -r superuser || true +./elasticsearch-users useradd rest_user -p test-password -r superuser || true echo "testnode" > /tmp/password /usr/local/bin/docker-entrypoint.sh | tee > /usr/share/elasticsearch/logs/console.log diff --git a/qa/remote-clusters/src/test/java/org/elasticsearch/cluster/remote/test/AbstractMultiClusterRemoteTestCase.java b/qa/remote-clusters/src/test/java/org/elasticsearch/cluster/remote/test/AbstractMultiClusterRemoteTestCase.java index 65ae26bcd4d19..24e69c2c35de3 100644 --- a/qa/remote-clusters/src/test/java/org/elasticsearch/cluster/remote/test/AbstractMultiClusterRemoteTestCase.java +++ b/qa/remote-clusters/src/test/java/org/elasticsearch/cluster/remote/test/AbstractMultiClusterRemoteTestCase.java @@ -24,11 +24,8 @@ import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestHighLevelClient; -import org.elasticsearch.common.CharArrays; import org.elasticsearch.common.io.PathUtils; -import org.elasticsearch.common.settings.SecureString; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.core.internal.io.IOUtils; import org.elasticsearch.test.rest.ESRestTestCase; import org.junit.AfterClass; @@ -37,19 +34,12 @@ import java.io.IOException; import java.net.URISyntaxException; -import java.nio.CharBuffer; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Arrays; -import java.util.Base64; import java.util.Collections; public abstract class AbstractMultiClusterRemoteTestCase extends ESRestTestCase { - private static final String USER = "x_pack_rest_user"; - private static final String PASS = "x-pack-test-password"; - private static final String KEYSTORE_PASS = "testnode"; - @Override protected boolean preserveClusterUponCompletion() { return true; @@ -62,7 +52,7 @@ protected boolean preserveClusterUponCompletion() { @Override protected String getTestRestCluster() { - return "localhost:" + getProperty("test.fixtures.elasticsearch-" + getDistribution() + "-1.tcp.9200"); + return "localhost:" + getProperty("test.fixtures.elasticsearch-oss-1.tcp.9200"); } @Before @@ -71,8 +61,8 @@ public void initClientsAndConfigureClusters() throws Exception { return; } - cluster1Client = buildClient("localhost:" + getProperty("test.fixtures.elasticsearch-" + getDistribution() + "-1.tcp.9200")); - cluster2Client = buildClient("localhost:" + getProperty("test.fixtures.elasticsearch-" + getDistribution() + "-2.tcp.9200")); + cluster1Client = buildClient("localhost:" + getProperty("test.fixtures.elasticsearch-oss-1.tcp.9200")); + cluster2Client = buildClient("localhost:" + getProperty("test.fixtures.elasticsearch-oss-2.tcp.9200")); cluster1Client().cluster().health(new ClusterHealthRequest().waitForNodes("1").waitForYellowStatus(), RequestOptions.DEFAULT); cluster2Client().cluster().health(new ClusterHealthRequest().waitForNodes("1").waitForYellowStatus(), RequestOptions.DEFAULT); @@ -80,13 +70,6 @@ public void initClientsAndConfigureClusters() throws Exception { initialized = true; } - protected String getDistribution() { - String distribution = System.getProperty("tests.distribution", "default"); - if (distribution.equals("oss") == false && distribution.equals("default") == false) { - throw new IllegalArgumentException("supported values for tests.distribution are oss or default but it was " + distribution); - } - return distribution; - } @AfterClass public static void destroyClients() throws IOException { @@ -119,10 +102,6 @@ private RestHighLevelClient buildClient(final String url) throws IOException { return new HighLevelClient(buildClient(restAdminSettings(), new HttpHost[]{httpHost})); } - protected boolean isOss() { - return getDistribution().equals("oss"); - } - static Path keyStore; @BeforeClass @@ -144,41 +123,12 @@ public static void clearKeyStore() { @Override protected Settings restClientSettings() { - if (isOss()) { - return super.restClientSettings(); - } - String token = basicAuthHeaderValue(USER, new SecureString(PASS.toCharArray())); - return Settings.builder() - .put(ThreadContext.PREFIX + ".Authorization", token) - .put(ESRestTestCase.TRUSTSTORE_PATH, keyStore) - .put(ESRestTestCase.TRUSTSTORE_PASSWORD, KEYSTORE_PASS) - .build(); + return super.restClientSettings(); } @Override protected String getProtocol() { - if (isOss()) { - return "http"; - } - return "https"; - } - - private static String basicAuthHeaderValue(String username, SecureString passwd) { - CharBuffer chars = CharBuffer.allocate(username.length() + passwd.length() + 1); - byte[] charBytes = null; - try { - chars.put(username).put(':').put(passwd.getChars()); - charBytes = CharArrays.toUtf8Bytes(chars.array()); - - //TODO we still have passwords in Strings in headers. Maybe we can look into using a CharSequence? - String basicToken = Base64.getEncoder().encodeToString(charBytes); - return "Basic " + basicToken; - } finally { - Arrays.fill(chars.array(), (char) 0); - if (charBytes != null) { - Arrays.fill(charBytes, (byte) 0); - } - } + return "http"; } private String getProperty(String key) { diff --git a/qa/remote-clusters/src/test/java/org/elasticsearch/cluster/remote/test/RemoteClustersIT.java b/qa/remote-clusters/src/test/java/org/elasticsearch/cluster/remote/test/RemoteClustersIT.java index ccec9cd056d63..bb0b21088590c 100644 --- a/qa/remote-clusters/src/test/java/org/elasticsearch/cluster/remote/test/RemoteClustersIT.java +++ b/qa/remote-clusters/src/test/java/org/elasticsearch/cluster/remote/test/RemoteClustersIT.java @@ -68,7 +68,7 @@ public void clearRemoteClusterSettings() throws IOException { } public void testProxyModeConnectionWorks() throws IOException { - String cluster2RemoteClusterSeed = "elasticsearch-" + getDistribution() + "-2:9300"; + String cluster2RemoteClusterSeed = "elasticsearch-oss-2:9300"; logger.info("Configuring remote cluster [{}]", cluster2RemoteClusterSeed); ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest().persistentSettings(Settings.builder() .put("cluster.remote.cluster2.mode", "proxy") @@ -85,7 +85,7 @@ public void testProxyModeConnectionWorks() throws IOException { } public void testSniffModeConnectionFails() throws IOException { - String cluster2RemoteClusterSeed = "elasticsearch-" + getDistribution() + "-2:9300"; + String cluster2RemoteClusterSeed = "elasticsearch-oss-2:9300"; logger.info("Configuring remote cluster [{}]", cluster2RemoteClusterSeed); ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest().persistentSettings(Settings.builder() .put("cluster.remote.cluster2alt.mode", "sniff") diff --git a/qa/smoke-test-multinode/build.gradle b/qa/smoke-test-multinode/build.gradle index b72402c73128f..dec13d6fd2a69 100644 --- a/qa/smoke-test-multinode/build.gradle +++ b/qa/smoke-test-multinode/build.gradle @@ -39,11 +39,4 @@ integTest { project.delete(repo) repo.mkdirs() } - if ('default'.equalsIgnoreCase(System.getProperty('tests.distribution', 'oss'))) { - systemProperty 'tests.rest.blacklist', [ - 'cat.templates/10_basic/No templates', - 'cat.templates/10_basic/Sort templates', - 'cat.templates/10_basic/Multiple template', - ].join(',') - } } diff --git a/qa/translog-policy/build.gradle b/qa/translog-policy/build.gradle index 42189ba1f782a..441bf93ed373d 100644 --- a/qa/translog-policy/build.gradle +++ b/qa/translog-policy/build.gradle @@ -26,9 +26,8 @@ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-test' apply from : "$rootDir/gradle/bwc-test.gradle" -boolean isDefaultDistro = System.getProperty('tests.distribution', 'oss') == 'default' for (Version bwcVersion : BuildParams.bwcVersions.indexCompatible) { - if (bwcVersion.before('6.3.0') && isDefaultDistro) { + if (bwcVersion.before('6.3.0')) { // explicitly running restart on the current node does not work in step 2 // below when plugins are installed, wihch is the case for x-pack as a plugin // prior to 6.3.0 diff --git a/qa/wildfly/build.gradle b/qa/wildfly/build.gradle index ea5f86e3bf0cc..64ac8df900dba 100644 --- a/qa/wildfly/build.gradle +++ b/qa/wildfly/build.gradle @@ -57,7 +57,6 @@ elasticsearch_distributions { docker { type = 'docker' architecture = Architecture.current() - flavor = System.getProperty('tests.distribution', 'default') version = VersionProperties.getElasticsearch() failIfUnavailable = false // This ensures we skip this testing if Docker is unavailable } @@ -68,11 +67,7 @@ preProcessFixture { } dockerCompose { - if ('default'.equalsIgnoreCase(System.getProperty('tests.distribution', 'default'))) { - useComposeFiles = ['docker-compose.yml'] - } else { - useComposeFiles = ['docker-compose-oss.yml'] - } + useComposeFiles = ['docker-compose-oss.yml'] } tasks.register("integTest", Test) { diff --git a/server/src/main/java/org/elasticsearch/Build.java b/server/src/main/java/org/elasticsearch/Build.java index a67d51fab9d08..43b2656bf6b53 100644 --- a/server/src/main/java/org/elasticsearch/Build.java +++ b/server/src/main/java/org/elasticsearch/Build.java @@ -41,42 +41,6 @@ public class Build { */ public static final Build CURRENT; - public enum Flavor { - - DEFAULT("default"), - OSS("oss"), - UNKNOWN("unknown"); - - final String displayName; - - Flavor(final String displayName) { - this.displayName = displayName; - } - - public String displayName() { - return displayName; - } - - public static Flavor fromDisplayName(final String displayName, final boolean strict) { - switch (displayName) { - case "default": - return Flavor.DEFAULT; - case "oss": - return Flavor.OSS; - case "unknown": - return Flavor.UNKNOWN; - default: - if (strict) { - final String message = "unexpected distribution flavor [" + displayName + "]; your distribution is broken"; - throw new IllegalStateException(message); - } else { - return Flavor.UNKNOWN; - } - } - } - - } - public enum Type { DEB("deb"), @@ -122,7 +86,6 @@ public static Type fromDisplayName(final String displayName, final boolean stric } static { - final Flavor flavor; final Type type; final String hash; final String date; @@ -130,7 +93,6 @@ public static Type fromDisplayName(final String displayName, final boolean stric final String version; // these are parsed at startup, and we require that we are able to recognize the values passed in by the startup scripts - flavor = Flavor.fromDisplayName(System.getProperty("es.distribution.flavor", "unknown"), true); type = Type.fromDisplayName(System.getProperty("es.distribution.type", "unknown"), true); final String esPrefix = "elasticsearch-" + Version.CURRENT; @@ -180,7 +142,7 @@ public static Type fromDisplayName(final String displayName, final boolean stric "Stopping Elasticsearch now so it doesn't run in subtly broken ways. This is likely a build bug."); } - CURRENT = new Build(flavor, type, hash, date, isSnapshot, version); + CURRENT = new Build(type, hash, date, isSnapshot, version); } private final boolean isSnapshot; @@ -195,17 +157,15 @@ static URL getElasticsearchCodeSourceLocation() { return codeSource == null ? null : codeSource.getLocation(); } - private final Flavor flavor; private final Type type; private final String hash; private final String date; private final String version; public Build( - final Flavor flavor, final Type type, final String hash, final String date, boolean isSnapshot, + final Type type, final String hash, final String date, boolean isSnapshot, String version ) { - this.flavor = flavor; this.type = type; this.hash = hash; this.date = date; @@ -222,13 +182,12 @@ public String date() { } public static Build readBuild(StreamInput in) throws IOException { - final Flavor flavor; + final String flavor; final Type type; - if (in.getVersion().onOrAfter(Version.V_6_3_0)) { - // be lenient when reading on the wire, the enumeration values from other versions might be different than what we know - flavor = Flavor.fromDisplayName(in.readString(), false); - } else { - flavor = Flavor.OSS; + // The following block is kept for existing BWS tests to pass. + // TODO - clean up this code when we remove all v6 bwc tests. + if (in.getVersion().onOrAfter(Version.V_6_3_0) && in.getVersion().onOrBefore(Version.V_7_0_0)) { + flavor = in.readString(); } if (in.getVersion().onOrAfter(Version.V_6_3_0)) { // be lenient when reading on the wire, the enumeration values from other versions might be different than what we know @@ -246,12 +205,14 @@ public static Build readBuild(StreamInput in) throws IOException { } else { version = in.getVersion().toString(); } - return new Build(flavor, type, hash, date, snapshot, version); + return new Build(type, hash, date, snapshot, version); } public static void writeBuild(Build build, StreamOutput out) throws IOException { - if (out.getVersion().onOrAfter(Version.V_6_3_0)) { - out.writeString(build.flavor().displayName()); + // The following block is kept for existing BWS tests to pass. + // TODO - clean up this code when we remove all v6 bwc tests. + if (out.getVersion().onOrAfter(Version.V_6_3_0) && out.getVersion().onOrBefore(Version.V_7_0_0)) { + out.writeString("oss"); } if (out.getVersion().onOrAfter(Version.V_6_3_0)) { final Type buildType; @@ -283,10 +244,6 @@ public String getQualifiedVersion() { return version; } - public Flavor flavor() { - return flavor; - } - public Type type() { return type; } @@ -306,7 +263,7 @@ public boolean isProductionRelease() { @Override public String toString() { - return "[" + flavor.displayName() + "][" + type.displayName + "][" + hash + "][" + date + "][" + version +"]"; + return "[" + type.displayName + "][" + hash + "][" + date + "][" + version +"]"; } @Override @@ -320,10 +277,6 @@ public boolean equals(Object o) { Build build = (Build) o; - if (!flavor.equals(build.flavor)) { - return false; - } - if (!type.equals(build.type)) { return false; } @@ -342,7 +295,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(flavor, type, isSnapshot, hash, date, version); + return Objects.hash(type, isSnapshot, hash, date, version); } } diff --git a/server/src/main/java/org/elasticsearch/Version.java b/server/src/main/java/org/elasticsearch/Version.java index 868783549db2c..add889c970648 100644 --- a/server/src/main/java/org/elasticsearch/Version.java +++ b/server/src/main/java/org/elasticsearch/Version.java @@ -484,7 +484,6 @@ public static void main(String[] args) { Locale.ROOT, "Version: %s, Build: %s/%s/%s/%s, JVM: %s", Build.CURRENT.getQualifiedVersion(), - Build.CURRENT.flavor().displayName(), Build.CURRENT.type().displayName(), Build.CURRENT.hash(), Build.CURRENT.date(), diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java index 56ac729566443..63a4ed4d23e8d 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java @@ -75,7 +75,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws builder.field("ip", nodeInfo.getNode().getHostAddress()); builder.field("version", nodeInfo.getVersion()); - builder.field("build_flavor", nodeInfo.getBuild().flavor().displayName()); builder.field("build_type", nodeInfo.getBuild().type().displayName()); builder.field("build_hash", nodeInfo.getBuild().hash()); if (nodeInfo.getTotalIndexingBuffer() != null) { diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodes.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodes.java index 02f85e327ab48..bb9ab951489a6 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodes.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodes.java @@ -28,7 +28,6 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodeRole; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.TransportAddress; @@ -668,14 +667,13 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws static class PackagingTypes implements ToXContentFragment { - private final Map, AtomicInteger> packagingTypes; + private final Map packagingTypes; PackagingTypes(final List nodeInfos) { - final Map, AtomicInteger> packagingTypes = new HashMap<>(); + final Map packagingTypes = new HashMap<>(); for (final NodeInfo nodeInfo : nodeInfos) { - final String flavor = nodeInfo.getBuild().flavor().displayName(); final String type = nodeInfo.getBuild().type().displayName(); - packagingTypes.computeIfAbsent(Tuple.tuple(flavor, type), k -> new AtomicInteger()).incrementAndGet(); + packagingTypes.computeIfAbsent(type, k -> new AtomicInteger()).incrementAndGet(); } this.packagingTypes = Collections.unmodifiableMap(packagingTypes); } @@ -684,11 +682,10 @@ static class PackagingTypes implements ToXContentFragment { public XContentBuilder toXContent(final XContentBuilder builder, final Params params) throws IOException { builder.startArray("packaging_types"); { - for (final Map.Entry, AtomicInteger> entry : packagingTypes.entrySet()) { + for (final Map.Entry entry : packagingTypes.entrySet()) { builder.startObject(); { - builder.field("flavor", entry.getKey().v1()); - builder.field("type", entry.getKey().v2()); + builder.field("type", entry.getKey()); builder.field("count", entry.getValue().get()); } builder.endObject(); diff --git a/server/src/main/java/org/elasticsearch/action/main/MainResponse.java b/server/src/main/java/org/elasticsearch/action/main/MainResponse.java index 16c2f5528cc70..4ccddf023ac89 100644 --- a/server/src/main/java/org/elasticsearch/action/main/MainResponse.java +++ b/server/src/main/java/org/elasticsearch/action/main/MainResponse.java @@ -105,7 +105,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws builder.field("cluster_uuid", clusterUuid); builder.startObject("version") .field("number", build.getQualifiedVersion()) - .field("build_flavor", build.flavor().displayName()) .field("build_type", build.type().displayName()) .field("build_hash", build.hash()) .field("build_date", build.date()) @@ -128,7 +127,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws PARSER.declareString((response, value) -> response.clusterUuid = value, new ParseField("cluster_uuid")); PARSER.declareString((response, value) -> {}, new ParseField("tagline")); PARSER.declareObject((response, value) -> { - final String buildFlavor = (String) value.get("build_flavor"); final String buildType = (String) value.get("build_type"); response.build = new Build( @@ -136,7 +134,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws * Be lenient when reading on the wire, the enumeration values from other versions might be different than what * we know. */ - buildFlavor == null ? Build.Flavor.UNKNOWN : Build.Flavor.fromDisplayName(buildFlavor, false), buildType == null ? Build.Type.UNKNOWN : Build.Type.fromDisplayName(buildType, false), (String) value.get("build_hash"), (String) value.get("build_date"), diff --git a/server/src/main/java/org/elasticsearch/bootstrap/Elasticsearch.java b/server/src/main/java/org/elasticsearch/bootstrap/Elasticsearch.java index 83cdf533e03a7..bf78c006db7b5 100644 --- a/server/src/main/java/org/elasticsearch/bootstrap/Elasticsearch.java +++ b/server/src/main/java/org/elasticsearch/bootstrap/Elasticsearch.java @@ -134,9 +134,8 @@ protected void execute(Terminal terminal, OptionSet options, Environment env) th if (options.has(versionOption)) { final String versionOutput = String.format( Locale.ROOT, - "Version: %s, Build: %s/%s/%s/%s, JVM: %s", + "Version: %s, Build: %s/%s/%s, JVM: %s", Build.CURRENT.getQualifiedVersion(), - Build.CURRENT.flavor().displayName(), Build.CURRENT.type().displayName(), Build.CURRENT.hash(), Build.CURRENT.date(), diff --git a/server/src/main/java/org/elasticsearch/node/Node.java b/server/src/main/java/org/elasticsearch/node/Node.java index f9fd964dac681..7cb5b890567ad 100644 --- a/server/src/main/java/org/elasticsearch/node/Node.java +++ b/server/src/main/java/org/elasticsearch/node/Node.java @@ -307,10 +307,9 @@ protected Node(final Environment initialEnvironment, final JvmInfo jvmInfo = JvmInfo.jvmInfo(); logger.info( - "version[{}], pid[{}], build[{}/{}/{}/{}], OS[{}/{}/{}], JVM[{}/{}/{}/{}]", + "version[{}], pid[{}], build[{}/{}/{}], OS[{}/{}/{}], JVM[{}/{}/{}/{}]", Build.CURRENT.getQualifiedVersion(), jvmInfo.pid(), - Build.CURRENT.flavor().displayName(), Build.CURRENT.type().displayName(), Build.CURRENT.hash(), Build.CURRENT.date(), diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java index fd0114a47315d..6caede413bcc4 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java @@ -143,7 +143,6 @@ protected Table getTableWithHeader(final RestRequest request) { table.addCell("http_address", "default:false;alias:http;desc:bound http address"); table.addCell("version", "default:false;alias:v;desc:es version"); - table.addCell("flavor", "default:false;alias:f;desc:es distribution flavor"); table.addCell("type", "default:false;alias:t;desc:es distribution type"); table.addCell("build", "default:false;alias:b;desc:es build hash"); table.addCell("jdk", "default:false;alias:j;desc:jdk version"); @@ -299,7 +298,6 @@ Table buildTable(boolean fullId, RestRequest req, ClusterStateResponse state, No } table.addCell(node.getVersion().toString()); - table.addCell(info == null ? null : info.getBuild().flavor().displayName()); table.addCell(info == null ? null : info.getBuild().type().displayName()); table.addCell(info == null ? null : info.getBuild().hash()); table.addCell(jvmInfo == null ? null : jvmInfo.version()); diff --git a/server/src/test/java/org/elasticsearch/BuildTests.java b/server/src/test/java/org/elasticsearch/BuildTests.java index ce9e7230d5402..dd9843b1498ee 100644 --- a/server/src/test/java/org/elasticsearch/BuildTests.java +++ b/server/src/test/java/org/elasticsearch/BuildTests.java @@ -54,28 +54,28 @@ public void testJarMetadata() throws IOException { public void testIsProduction() { Build build = new Build( - Build.CURRENT.flavor(), Build.CURRENT.type(), Build.CURRENT.hash(), Build.CURRENT.date(), + Build.CURRENT.type(), Build.CURRENT.hash(), Build.CURRENT.date(), Build.CURRENT.isSnapshot(), Math.abs(randomInt()) + "." + Math.abs(randomInt()) + "." + Math.abs(randomInt()) ); assertTrue(build.getQualifiedVersion(), build.isProductionRelease()); assertFalse(new Build( - Build.CURRENT.flavor(), Build.CURRENT.type(), Build.CURRENT.hash(), Build.CURRENT.date(), + Build.CURRENT.type(), Build.CURRENT.hash(), Build.CURRENT.date(), Build.CURRENT.isSnapshot(), "7.0.0-alpha1" ).isProductionRelease()); assertFalse(new Build( - Build.CURRENT.flavor(), Build.CURRENT.type(), Build.CURRENT.hash(), Build.CURRENT.date(), + Build.CURRENT.type(), Build.CURRENT.hash(), Build.CURRENT.date(), Build.CURRENT.isSnapshot(), "7.0.0-alpha1-SNAPSHOT" ).isProductionRelease()); assertFalse(new Build( - Build.CURRENT.flavor(), Build.CURRENT.type(), Build.CURRENT.hash(), Build.CURRENT.date(), + Build.CURRENT.type(), Build.CURRENT.hash(), Build.CURRENT.date(), Build.CURRENT.isSnapshot(), "7.0.0-SNAPSHOT" ).isProductionRelease()); assertFalse(new Build( - Build.CURRENT.flavor(), Build.CURRENT.type(), Build.CURRENT.hash(), Build.CURRENT.date(), + Build.CURRENT.type(), Build.CURRENT.hash(), Build.CURRENT.date(), Build.CURRENT.isSnapshot(), "Unknown" ).isProductionRelease()); } @@ -84,45 +84,37 @@ public void testEqualsAndHashCode() { Build build = Build.CURRENT; Build another = new Build( - build.flavor(), build.type(), build.hash(), build.date(), build.isSnapshot(), build.getQualifiedVersion() + build.type(), build.hash(), build.date(), build.isSnapshot(), build.getQualifiedVersion() ); assertEquals(build, another); assertEquals(build.hashCode(), another.hashCode()); - final Set otherFlavors = - Arrays.stream(Build.Flavor.values()).filter(f -> !f.equals(build.flavor())).collect(Collectors.toSet()); - final Build.Flavor otherFlavor = randomFrom(otherFlavors); - Build differentFlavor = new Build( - otherFlavor, build.type(), build.hash(), build.date(), build.isSnapshot(), build.getQualifiedVersion() - ); - assertNotEquals(build, differentFlavor); - final Set otherTypes = Arrays.stream(Build.Type.values()).filter(f -> !f.equals(build.type())).collect(Collectors.toSet()); final Build.Type otherType = randomFrom(otherTypes); Build differentType = new Build( - build.flavor(), otherType, build.hash(), build.date(), build.isSnapshot(), build.getQualifiedVersion() + otherType, build.hash(), build.date(), build.isSnapshot(), build.getQualifiedVersion() ); assertNotEquals(build, differentType); Build differentHash = new Build( - build.flavor(), build.type(), randomAlphaOfLengthBetween(3, 10), build.date(), build.isSnapshot(), + build.type(), randomAlphaOfLengthBetween(3, 10), build.date(), build.isSnapshot(), build.getQualifiedVersion() ); assertNotEquals(build, differentHash); Build differentDate = new Build( - build.flavor(), build.type(), build.hash(), "1970-01-01", build.isSnapshot(), build.getQualifiedVersion() + build.type(), build.hash(), "1970-01-01", build.isSnapshot(), build.getQualifiedVersion() ); assertNotEquals(build, differentDate); Build differentSnapshot = new Build( - build.flavor(), build.type(), build.hash(), build.date(), !build.isSnapshot(), build.getQualifiedVersion() + build.type(), build.hash(), build.date(), !build.isSnapshot(), build.getQualifiedVersion() ); assertNotEquals(build, differentSnapshot); Build differentVersion = new Build( - build.flavor(), build.type(), build.hash(), build.date(), build.isSnapshot(), "1.2.3" + build.type(), build.hash(), build.date(), build.isSnapshot(), "1.2.3" ); assertNotEquals(build, differentVersion); } @@ -163,31 +155,27 @@ private static String randomStringExcept(final String s) { public void testSerialization() { EqualsHashCodeTestUtils.checkEqualsAndHashCode(new WriteableBuild(new Build( - randomFrom(Build.Flavor.values()), randomFrom(Build.Type.values()), + randomFrom(Build.Type.values()), randomAlphaOfLength(6), randomAlphaOfLength(6), randomBoolean(), randomAlphaOfLength(6))), // Note: the cast of the Copy- and MutateFunction is needed for some IDE (specifically Eclipse 4.10.0) to infer the right type (WriteableBuild b) -> copyWriteable(b, writableRegistry(), WriteableBuild::new, Version.CURRENT), (WriteableBuild b) -> { - switch (randomIntBetween(1, 6)) { + switch (randomIntBetween(1, 5)) { case 1: return new WriteableBuild(new Build( - randomValueOtherThan(b.build.flavor(), () -> randomFrom(Build.Flavor.values())), b.build.type(), - b.build.hash(), b.build.date(), b.build.isSnapshot(), b.build.getQualifiedVersion())); - case 2: - return new WriteableBuild(new Build(b.build.flavor(), randomValueOtherThan(b.build.type(), () -> randomFrom(Build.Type.values())), b.build.hash(), b.build.date(), b.build.isSnapshot(), b.build.getQualifiedVersion())); - case 3: - return new WriteableBuild(new Build(b.build.flavor(), b.build.type(), + case 2: + return new WriteableBuild(new Build(b.build.type(), randomStringExcept(b.build.hash()), b.build.date(), b.build.isSnapshot(), b.build.getQualifiedVersion())); - case 4: - return new WriteableBuild(new Build(b.build.flavor(), b.build.type(), + case 3: + return new WriteableBuild(new Build(b.build.type(), b.build.hash(), randomStringExcept(b.build.date()), b.build.isSnapshot(), b.build.getQualifiedVersion())); - case 5: - return new WriteableBuild(new Build(b.build.flavor(), b.build.type(), + case 4: + return new WriteableBuild(new Build(b.build.type(), b.build.hash(), b.build.date(), b.build.isSnapshot() == false, b.build.getQualifiedVersion())); - case 6: - return new WriteableBuild(new Build(b.build.flavor(), b.build.type(), + case 5: + return new WriteableBuild(new Build(b.build.type(), b.build.hash(), b.build.date(), b.build.isSnapshot(), randomStringExcept(b.build.getQualifiedVersion()))); } throw new AssertionError(); @@ -195,7 +183,7 @@ public void testSerialization() { } public void testSerializationBWC() throws IOException { - final WriteableBuild dockerBuild = new WriteableBuild(new Build(randomFrom(Build.Flavor.values()), Build.Type.DOCKER, + final WriteableBuild dockerBuild = new WriteableBuild(new Build(Build.Type.DOCKER, randomAlphaOfLength(6), randomAlphaOfLength(6), randomBoolean(), randomAlphaOfLength(6))); final List versions = Version.getDeclaredVersions(Version.class); @@ -211,11 +199,6 @@ public void testSerializationBWC() throws IOException { final WriteableBuild post67pre70 = copyWriteable(dockerBuild, writableRegistry(), WriteableBuild::new, post67Pre70Version); final WriteableBuild post70 = copyWriteable(dockerBuild, writableRegistry(), WriteableBuild::new, post70Version); - assertThat(pre63.build.flavor(), equalTo(Build.Flavor.OSS)); - assertThat(post63pre67.build.flavor(), equalTo(dockerBuild.build.flavor())); - assertThat(post67pre70.build.flavor(), equalTo(dockerBuild.build.flavor())); - assertThat(post70.build.flavor(), equalTo(dockerBuild.build.flavor())); - assertThat(pre63.build.type(), equalTo(Build.Type.UNKNOWN)); assertThat(post63pre67.build.type(), equalTo(Build.Type.TAR)); assertThat(post67pre70.build.type(), equalTo(dockerBuild.build.type())); @@ -227,13 +210,6 @@ public void testSerializationBWC() throws IOException { assertThat(post70.build.getQualifiedVersion(), equalTo(dockerBuild.build.getQualifiedVersion())); } - public void testFlavorParsing() { - for (final Build.Flavor flavor : Build.Flavor.values()) { - // strict or not should not impact parsing at all here - assertThat(Build.Flavor.fromDisplayName(flavor.displayName(), randomBoolean()), sameInstance(flavor)); - } - } - public void testTypeParsing() { for (final Build.Type type : Build.Type.values()) { // strict or not should not impact parsing at all here @@ -241,18 +217,6 @@ public void testTypeParsing() { } } - public void testLenientFlavorParsing() { - final String displayName = randomAlphaOfLength(8); - assertThat(Build.Flavor.fromDisplayName(displayName, false), equalTo(Build.Flavor.UNKNOWN)); - } - - public void testStrictFlavorParsing() { - final String displayName = randomAlphaOfLength(8); - @SuppressWarnings("ResultOfMethodCallIgnored") final IllegalStateException e = - expectThrows(IllegalStateException.class, () -> Build.Flavor.fromDisplayName(displayName, true)); - assertThat(e, hasToString(containsString("unexpected distribution flavor [" + displayName + "]; your distribution is broken"))); - } - public void testLenientTypeParsing() { final String displayName = randomAlphaOfLength(8); assertThat(Build.Type.fromDisplayName(displayName, false), equalTo(Build.Type.UNKNOWN)); diff --git a/server/src/test/java/org/elasticsearch/action/main/MainResponseTests.java b/server/src/test/java/org/elasticsearch/action/main/MainResponseTests.java index 5ca6fc7660123..d86c6a4097d64 100644 --- a/server/src/test/java/org/elasticsearch/action/main/MainResponseTests.java +++ b/server/src/test/java/org/elasticsearch/action/main/MainResponseTests.java @@ -44,7 +44,7 @@ protected MainResponse createTestInstance() { final String date = new Date(randomNonNegativeLong()).toString(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_0_1, Version.CURRENT); Build build = new Build( - Build.Flavor.UNKNOWN, Build.Type.UNKNOWN, randomAlphaOfLength(8), date, randomBoolean(), + Build.Type.UNKNOWN, randomAlphaOfLength(8), date, randomBoolean(), version.toString() ); return new MainResponse(nodeName, version, clusterName, clusterUuid , build); @@ -64,7 +64,7 @@ public void testToXContent() throws IOException { String clusterUUID = randomAlphaOfLengthBetween(10, 20); final Build current = Build.CURRENT; Build build = new Build( - current.flavor(), current.type(), current.hash(), current.date(), current.isSnapshot(), + current.type(), current.hash(), current.date(), current.isSnapshot(), current.getQualifiedVersion() ); Version version = Version.CURRENT; @@ -77,7 +77,6 @@ public void testToXContent() throws IOException { + "\"cluster_uuid\":\"" + clusterUUID + "\"," + "\"version\":{" + "\"number\":\"" + build.getQualifiedVersion() + "\"," - + "\"build_flavor\":\"" + current.flavor().displayName() + "\"," + "\"build_type\":\"" + current.type().displayName() + "\"," + "\"build_hash\":\"" + current.hash() + "\"," + "\"build_date\":\"" + current.date() + "\"," @@ -106,7 +105,7 @@ protected MainResponse mutateInstance(MainResponse mutateInstance) { case 2: // toggle the snapshot flag of the original Build parameter build = new Build( - Build.Flavor.UNKNOWN, Build.Type.UNKNOWN, build.hash(), build.date(), !build.isSnapshot(), + Build.Type.UNKNOWN, build.hash(), build.date(), !build.isSnapshot(), build.getQualifiedVersion() ); break; diff --git a/server/src/test/java/org/elasticsearch/bootstrap/ElasticsearchCliTests.java b/server/src/test/java/org/elasticsearch/bootstrap/ElasticsearchCliTests.java index fb6925ba2ebe7..ba8c14fb49a25 100644 --- a/server/src/test/java/org/elasticsearch/bootstrap/ElasticsearchCliTests.java +++ b/server/src/test/java/org/elasticsearch/bootstrap/ElasticsearchCliTests.java @@ -65,8 +65,7 @@ private void runTestThatVersionIsReturned(String... args) throws Exception { assertThat(output, containsString("Version: " + Build.CURRENT.getQualifiedVersion())); final String expectedBuildOutput = String.format( Locale.ROOT, - "Build: %s/%s/%s/%s", - Build.CURRENT.flavor().displayName(), + "Build: %s/%s/%s", Build.CURRENT.type().displayName(), Build.CURRENT.hash(), Build.CURRENT.date()); diff --git a/settings.gradle b/settings.gradle index e02d8f499ba5f..1140e27164ad6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -19,43 +19,23 @@ List projects = [ 'benchmarks', 'distribution:archives:integ-test-zip', 'distribution:archives:oss-windows-zip', - 'distribution:archives:windows-zip', 'distribution:archives:oss-no-jdk-windows-zip', - 'distribution:archives:no-jdk-windows-zip', 'distribution:archives:oss-darwin-tar', - 'distribution:archives:darwin-tar', 'distribution:archives:oss-no-jdk-darwin-tar', - 'distribution:archives:no-jdk-darwin-tar', 'distribution:archives:oss-linux-aarch64-tar', 'distribution:archives:oss-linux-tar', - 'distribution:archives:linux-aarch64-tar', - 'distribution:archives:linux-tar', 'distribution:archives:oss-no-jdk-linux-tar', - 'distribution:archives:no-jdk-linux-tar', 'distribution:docker', - 'distribution:docker:docker-aarch64-build-context', - 'distribution:docker:docker-aarch64-export', - 'distribution:docker:docker-build-context', - 'distribution:docker:docker-export', 'distribution:docker:oss-docker-aarch64-build-context', 'distribution:docker:oss-docker-aarch64-export', 'distribution:docker:oss-docker-build-context', 'distribution:docker:oss-docker-export', - 'distribution:docker:ubi-docker-aarch64-export', - 'distribution:docker:ubi-docker-build-context', - 'distribution:docker:ubi-docker-export', 'distribution:packages:aarch64-oss-deb', 'distribution:packages:oss-deb', - 'distribution:packages:aarch64-deb', - 'distribution:packages:deb', 'distribution:packages:oss-no-jdk-deb', - 'distribution:packages:no-jdk-deb', 'distribution:packages:aarch64-oss-rpm', 'distribution:packages:oss-rpm', - 'distribution:packages:aarch64-rpm', - 'distribution:packages:rpm', 'distribution:packages:oss-no-jdk-rpm', - 'distribution:packages:no-jdk-rpm', 'distribution:bwc:bugfix', 'distribution:bwc:maintenance', 'distribution:bwc:minor', diff --git a/test/framework/src/main/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java b/test/framework/src/main/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java index 1b43cd924c51b..5658ad70abd79 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java +++ b/test/framework/src/main/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java @@ -172,7 +172,6 @@ private ReproduceErrorMessageBuilder appendESProperties() { } appendOpt("tests.locale", Locale.getDefault().toLanguageTag()); appendOpt("tests.timezone", TimeZone.getDefault().getID()); - appendOpt("tests.distribution", System.getProperty("tests.distribution")); appendOpt("runtime.java", Integer.toString(JavaVersion.current().getVersion().get(0))); appendOpt(ESTestCase.FIPS_SYSPROP, System.getProperty(ESTestCase.FIPS_SYSPROP)); return this;