mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 09:28:55 -04:00
Replace cloud-ess docker image with wolfi-ess (#114413)
* Replace cloud-ess docker image with wolfi-ess We just replaced the existing implementation of cloud-ess with what was wolfi-ess which is a wolfi based ess image. The cloud image itself will be removed in a future commit it was not used anywhere * Switch to test cloud docker image instead of default docker in packaging pr tests. This adds way more coverage than the default docker image which is also barely touched
This commit is contained in:
parent
2155f1bed5
commit
f1f5ee06a3
16 changed files with 61 additions and 135 deletions
|
@ -5,7 +5,7 @@ steps:
|
||||||
steps:
|
steps:
|
||||||
- label: "{{matrix.image}} / docker / packaging-tests-unix"
|
- label: "{{matrix.image}} / docker / packaging-tests-unix"
|
||||||
key: "packaging-tests-unix-docker"
|
key: "packaging-tests-unix-docker"
|
||||||
command: ./.ci/scripts/packaging-test.sh destructiveDistroTest.docker
|
command: ./.ci/scripts/packaging-test.sh destructiveDistroTest.docker-cloud-ess
|
||||||
timeout_in_minutes: 300
|
timeout_in_minutes: 300
|
||||||
matrix:
|
matrix:
|
||||||
setup:
|
setup:
|
||||||
|
|
|
@ -24,10 +24,6 @@ public enum DockerBase {
|
||||||
// Base image with extras for Cloud
|
// Base image with extras for Cloud
|
||||||
CLOUD("ubuntu:20.04", "-cloud", "apt-get"),
|
CLOUD("ubuntu:20.04", "-cloud", "apt-get"),
|
||||||
|
|
||||||
// Based on CLOUD above, with more extras. We don't set a base image because
|
|
||||||
// we programmatically extend from the Cloud image.
|
|
||||||
CLOUD_ESS(null, "-cloud-ess", "apt-get"),
|
|
||||||
|
|
||||||
// Chainguard based wolfi image with latest jdk
|
// Chainguard based wolfi image with latest jdk
|
||||||
// This is usually updated via renovatebot
|
// This is usually updated via renovatebot
|
||||||
// spotless:off
|
// spotless:off
|
||||||
|
@ -36,10 +32,9 @@ public enum DockerBase {
|
||||||
"apk"
|
"apk"
|
||||||
),
|
),
|
||||||
// spotless:on
|
// spotless:on
|
||||||
|
|
||||||
// Based on WOLFI above, with more extras. We don't set a base image because
|
// Based on WOLFI above, with more extras. We don't set a base image because
|
||||||
// we programmatically extend from the Wolfi image.
|
// we programmatically extend from the wolfi image.
|
||||||
WOLFI_ESS(null, "-wolfi-ess", "apk");
|
CLOUD_ESS(null, "-cloud-ess", "apk");
|
||||||
|
|
||||||
private final String image;
|
private final String image;
|
||||||
private final String suffix;
|
private final String suffix;
|
||||||
|
|
|
@ -181,9 +181,6 @@ public class InternalDistributionDownloadPlugin implements Plugin<Project> {
|
||||||
if (distribution.getType() == InternalElasticsearchDistributionTypes.DOCKER_WOLFI) {
|
if (distribution.getType() == InternalElasticsearchDistributionTypes.DOCKER_WOLFI) {
|
||||||
return projectName + "wolfi-docker" + archString + "-export";
|
return projectName + "wolfi-docker" + archString + "-export";
|
||||||
}
|
}
|
||||||
if (distribution.getType() == InternalElasticsearchDistributionTypes.DOCKER_WOLFI_ESS) {
|
|
||||||
return projectName + "wolfi-ess-docker" + archString + "-export";
|
|
||||||
}
|
|
||||||
return projectName + distribution.getType().getName();
|
return projectName + distribution.getType().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
||||||
* or more contributor license agreements. Licensed under the "Elastic License
|
|
||||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
|
||||||
* Public License v 1"; you may not use this file except in compliance with, at
|
|
||||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
|
||||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.elasticsearch.gradle.internal.distribution;
|
|
||||||
|
|
||||||
import org.elasticsearch.gradle.ElasticsearchDistributionType;
|
|
||||||
|
|
||||||
public class DockerWolfiEssElasticsearchDistributionType implements ElasticsearchDistributionType {
|
|
||||||
|
|
||||||
DockerWolfiEssElasticsearchDistributionType() {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "dockerWolfiEss";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDocker() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -22,7 +22,6 @@ public class InternalElasticsearchDistributionTypes {
|
||||||
public static ElasticsearchDistributionType DOCKER_CLOUD = new DockerCloudElasticsearchDistributionType();
|
public static ElasticsearchDistributionType DOCKER_CLOUD = new DockerCloudElasticsearchDistributionType();
|
||||||
public static ElasticsearchDistributionType DOCKER_CLOUD_ESS = new DockerCloudEssElasticsearchDistributionType();
|
public static ElasticsearchDistributionType DOCKER_CLOUD_ESS = new DockerCloudEssElasticsearchDistributionType();
|
||||||
public static ElasticsearchDistributionType DOCKER_WOLFI = new DockerWolfiElasticsearchDistributionType();
|
public static ElasticsearchDistributionType DOCKER_WOLFI = new DockerWolfiElasticsearchDistributionType();
|
||||||
public static ElasticsearchDistributionType DOCKER_WOLFI_ESS = new DockerWolfiEssElasticsearchDistributionType();
|
|
||||||
|
|
||||||
public static List<ElasticsearchDistributionType> ALL_INTERNAL = List.of(
|
public static List<ElasticsearchDistributionType> ALL_INTERNAL = List.of(
|
||||||
DEB,
|
DEB,
|
||||||
|
@ -32,7 +31,6 @@ public class InternalElasticsearchDistributionTypes {
|
||||||
DOCKER_IRONBANK,
|
DOCKER_IRONBANK,
|
||||||
DOCKER_CLOUD,
|
DOCKER_CLOUD,
|
||||||
DOCKER_CLOUD_ESS,
|
DOCKER_CLOUD_ESS,
|
||||||
DOCKER_WOLFI,
|
DOCKER_WOLFI
|
||||||
DOCKER_WOLFI_ESS
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,6 @@ import static org.elasticsearch.gradle.internal.distribution.InternalElasticsear
|
||||||
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.DOCKER_IRONBANK;
|
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.DOCKER_IRONBANK;
|
||||||
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.DOCKER_UBI;
|
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.DOCKER_UBI;
|
||||||
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.DOCKER_WOLFI;
|
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.DOCKER_WOLFI;
|
||||||
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.DOCKER_WOLFI_ESS;
|
|
||||||
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.RPM;
|
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.RPM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -153,7 +152,6 @@ public class DistroTestPlugin implements Plugin<Project> {
|
||||||
lifecyleTasks.put(DOCKER_CLOUD, project.getTasks().register(taskPrefix + ".docker-cloud"));
|
lifecyleTasks.put(DOCKER_CLOUD, project.getTasks().register(taskPrefix + ".docker-cloud"));
|
||||||
lifecyleTasks.put(DOCKER_CLOUD_ESS, project.getTasks().register(taskPrefix + ".docker-cloud-ess"));
|
lifecyleTasks.put(DOCKER_CLOUD_ESS, project.getTasks().register(taskPrefix + ".docker-cloud-ess"));
|
||||||
lifecyleTasks.put(DOCKER_WOLFI, project.getTasks().register(taskPrefix + ".docker-wolfi"));
|
lifecyleTasks.put(DOCKER_WOLFI, project.getTasks().register(taskPrefix + ".docker-wolfi"));
|
||||||
lifecyleTasks.put(DOCKER_WOLFI_ESS, project.getTasks().register(taskPrefix + ".docker-wolfi-ess"));
|
|
||||||
lifecyleTasks.put(ARCHIVE, project.getTasks().register(taskPrefix + ".archives"));
|
lifecyleTasks.put(ARCHIVE, project.getTasks().register(taskPrefix + ".archives"));
|
||||||
lifecyleTasks.put(DEB, project.getTasks().register(taskPrefix + ".packages"));
|
lifecyleTasks.put(DEB, project.getTasks().register(taskPrefix + ".packages"));
|
||||||
lifecyleTasks.put(RPM, lifecyleTasks.get(DEB));
|
lifecyleTasks.put(RPM, lifecyleTasks.get(DEB));
|
||||||
|
|
|
@ -7,7 +7,7 @@ the [DockerBase] enum.
|
||||||
* UBI - the same as the default image, but based upon [RedHat's UBI
|
* UBI - the same as the default image, but based upon [RedHat's UBI
|
||||||
images][ubi], specifically their minimal flavour.
|
images][ubi], specifically their minimal flavour.
|
||||||
* Wolfi - the same as the default image, but based upon [Wolfi](https://github.com/wolfi-dev)
|
* Wolfi - the same as the default image, but based upon [Wolfi](https://github.com/wolfi-dev)
|
||||||
* Wolfi ESS - this directly extends the Wolfi image, and adds all ES plugins
|
* Cloud ESS - this directly extends the Wolfi image, and adds all ES plugins
|
||||||
that the ES build generates in an archive directory. It also sets an
|
that the ES build generates in an archive directory. It also sets an
|
||||||
environment variable that points at this directory. This allows plugins to
|
environment variable that points at this directory. This allows plugins to
|
||||||
be installed from the archive instead of the internet, speeding up
|
be installed from the archive instead of the internet, speeding up
|
||||||
|
@ -23,7 +23,6 @@ the [DockerBase] enum.
|
||||||
software (FOSS) and Commercial off-the-shelf (COTS). In practice, this is
|
software (FOSS) and Commercial off-the-shelf (COTS). In practice, this is
|
||||||
another UBI build, this time on the regular UBI image, with extra
|
another UBI build, this time on the regular UBI image, with extra
|
||||||
hardening. See below for more details.
|
hardening. See below for more details.
|
||||||
|
|
||||||
* Cloud - this is mostly the same as the default image, with some notable differences:
|
* Cloud - this is mostly the same as the default image, with some notable differences:
|
||||||
* `filebeat` and `metricbeat` are included
|
* `filebeat` and `metricbeat` are included
|
||||||
* `wget` is included
|
* `wget` is included
|
||||||
|
@ -31,12 +30,6 @@ the [DockerBase] enum.
|
||||||
`/app/elasticsearch.sh`. In normal use this file would be bind-mounted
|
`/app/elasticsearch.sh`. In normal use this file would be bind-mounted
|
||||||
in, but the image ships a stub version of this file so that the image
|
in, but the image ships a stub version of this file so that the image
|
||||||
can still be tested.
|
can still be tested.
|
||||||
* Cloud ESS - this directly extends the Cloud image, and adds all ES plugins
|
|
||||||
that the ES build generates in an archive directory. It also sets an
|
|
||||||
environment variable that points at this directory. This allows plugins to
|
|
||||||
be installed from the archive instead of the internet, speeding up
|
|
||||||
deployment times.
|
|
||||||
|
|
||||||
The long-term goal is for both Cloud images to be retired in favour of the
|
The long-term goal is for both Cloud images to be retired in favour of the
|
||||||
default image.
|
default image.
|
||||||
|
|
||||||
|
|
|
@ -381,7 +381,7 @@ private static List<String> generateTags(DockerBase base, Architecture architect
|
||||||
String image = "elasticsearch${base.suffix}"
|
String image = "elasticsearch${base.suffix}"
|
||||||
|
|
||||||
String namespace = 'elasticsearch'
|
String namespace = 'elasticsearch'
|
||||||
if (base == DockerBase.CLOUD || base == DockerBase.CLOUD_ESS || base == DockerBase.WOLFI_ESS) {
|
if (base == DockerBase.CLOUD || base == DockerBase.CLOUD_ESS) {
|
||||||
namespace += '-ci'
|
namespace += '-ci'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,7 +446,8 @@ void addBuildDockerImageTask(Architecture architecture, DockerBase base) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addBuildEssDockerImageTask(Architecture architecture, DockerBase dockerBase) {
|
void addBuildEssDockerImageTask(Architecture architecture) {
|
||||||
|
DockerBase dockerBase = DockerBase.CLOUD_ESS
|
||||||
String arch = architecture == Architecture.AARCH64 ? '-aarch64' : ''
|
String arch = architecture == Architecture.AARCH64 ? '-aarch64' : ''
|
||||||
String contextDir = "${project.buildDir}/docker-context/elasticsearch${dockerBase.suffix}-${VersionProperties.elasticsearch}-docker-build-context${arch}"
|
String contextDir = "${project.buildDir}/docker-context/elasticsearch${dockerBase.suffix}-${VersionProperties.elasticsearch}-docker-build-context${arch}"
|
||||||
|
|
||||||
|
@ -460,22 +461,20 @@ void addBuildEssDockerImageTask(Architecture architecture, DockerBase dockerBase
|
||||||
from configurations.allPlugins
|
from configurations.allPlugins
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dockerBase == DockerBase.WOLFI_ESS) {
|
// If we're performing a release build, but `build.id` hasn't been set, we can
|
||||||
// If we're performing a release build, but `build.id` hasn't been set, we can
|
// infer that we're not at the Docker building stage of the build, and therefore
|
||||||
// infer that we're not at the Docker building stage of the build, and therefore
|
// we should skip the beats part of the build.
|
||||||
// we should skip the beats part of the build.
|
String buildId = providers.systemProperty('build.id').getOrNull()
|
||||||
String buildId = providers.systemProperty('build.id').getOrNull()
|
boolean includeBeats = VersionProperties.isElasticsearchSnapshot() == true || buildId != null || useDra
|
||||||
boolean includeBeats = VersionProperties.isElasticsearchSnapshot() == true || buildId != null || useDra
|
|
||||||
|
|
||||||
if (includeBeats) {
|
if (includeBeats) {
|
||||||
from configurations.getByName("filebeat_${architecture.classifier}")
|
from configurations.getByName("filebeat_${architecture.classifier}")
|
||||||
from configurations.getByName("metricbeat_${architecture.classifier}")
|
from configurations.getByName("metricbeat_${architecture.classifier}")
|
||||||
}
|
|
||||||
// For some reason, the artifact name can differ depending on what repository we used.
|
|
||||||
rename ~/((?:file|metric)beat)-.*\.tar\.gz$/, "\$1-${VersionProperties.elasticsearch}.tar.gz"
|
|
||||||
}
|
}
|
||||||
|
// For some reason, the artifact name can differ depending on what repository we used.
|
||||||
|
rename ~/((?:file|metric)beat)-.*\.tar\.gz$/, "\$1-${VersionProperties.elasticsearch}.tar.gz"
|
||||||
|
|
||||||
String baseSuffix = dockerBase == DockerBase.CLOUD_ESS ? DockerBase.CLOUD.suffix : DockerBase.WOLFI.suffix
|
String baseSuffix = DockerBase.WOLFI.suffix
|
||||||
from(projectDir.resolve("src/docker/Dockerfile.ess")) {
|
from(projectDir.resolve("src/docker/Dockerfile.ess")) {
|
||||||
expand(
|
expand(
|
||||||
[
|
[
|
||||||
|
@ -493,7 +492,7 @@ void addBuildEssDockerImageTask(Architecture architecture, DockerBase dockerBase
|
||||||
final TaskProvider<DockerBuildTask> buildDockerImageTask =
|
final TaskProvider<DockerBuildTask> buildDockerImageTask =
|
||||||
tasks.register(taskName("build", architecture, dockerBase, "DockerImage"), DockerBuildTask) {
|
tasks.register(taskName("build", architecture, dockerBase, "DockerImage"), DockerBuildTask) {
|
||||||
|
|
||||||
DockerBase base = dockerBase == DockerBase.CLOUD_ESS ? DockerBase.CLOUD : DockerBase.WOLFI
|
DockerBase base = DockerBase.WOLFI
|
||||||
|
|
||||||
TaskProvider<DockerBuildTask> buildBaseTask = tasks.named(taskName("build", architecture, base, "DockerImage"))
|
TaskProvider<DockerBuildTask> buildBaseTask = tasks.named(taskName("build", architecture, base, "DockerImage"))
|
||||||
inputs.files(buildBaseTask)
|
inputs.files(buildBaseTask)
|
||||||
|
@ -519,7 +518,7 @@ void addBuildEssDockerImageTask(Architecture architecture, DockerBase dockerBase
|
||||||
|
|
||||||
for (final Architecture architecture : Architecture.values()) {
|
for (final Architecture architecture : Architecture.values()) {
|
||||||
for (final DockerBase base : DockerBase.values()) {
|
for (final DockerBase base : DockerBase.values()) {
|
||||||
if (base == DockerBase.CLOUD_ESS || base == DockerBase.WOLFI_ESS) {
|
if (base == DockerBase.CLOUD_ESS) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
addBuildDockerContextTask(architecture, base)
|
addBuildDockerContextTask(architecture, base)
|
||||||
|
@ -527,8 +526,7 @@ for (final Architecture architecture : Architecture.values()) {
|
||||||
addBuildDockerImageTask(architecture, base)
|
addBuildDockerImageTask(architecture, base)
|
||||||
}
|
}
|
||||||
|
|
||||||
addBuildEssDockerImageTask(architecture, DockerBase.CLOUD_ESS)
|
addBuildEssDockerImageTask(architecture)
|
||||||
addBuildEssDockerImageTask(architecture, DockerBase.WOLFI_ESS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def exportDockerImages = tasks.register("exportDockerImages")
|
def exportDockerImages = tasks.register("exportDockerImages")
|
||||||
|
@ -564,8 +562,7 @@ subprojects { Project subProject ->
|
||||||
(base == DockerBase.CLOUD ? 'cloud.tar' :
|
(base == DockerBase.CLOUD ? 'cloud.tar' :
|
||||||
(base == DockerBase.CLOUD_ESS ? 'cloud-ess.tar' :
|
(base == DockerBase.CLOUD_ESS ? 'cloud-ess.tar' :
|
||||||
(base == DockerBase.WOLFI ? 'wolfi.tar' :
|
(base == DockerBase.WOLFI ? 'wolfi.tar' :
|
||||||
(base == DockerBase.WOLFI_ESS ? 'wolfi-ess.tar' :
|
'docker.tar'))))
|
||||||
'docker.tar')))))
|
|
||||||
final String artifactName = "elasticsearch${arch}${base.suffix}_test"
|
final String artifactName = "elasticsearch${arch}${base.suffix}_test"
|
||||||
|
|
||||||
final String exportTaskName = taskName("export", architecture, base, 'DockerImage')
|
final String exportTaskName = taskName("export", architecture, base, 'DockerImage')
|
||||||
|
|
|
@ -2,26 +2,24 @@ FROM ${base_image} AS builder
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
<% if (docker_base == "wolfi_ess") { %>
|
# Add plugins infrastructure
|
||||||
# Add plugins infrastructure
|
RUN mkdir -p /opt/plugins/archive
|
||||||
RUN mkdir -p /opt/plugins/archive
|
RUN chmod -R 0555 /opt/plugins
|
||||||
RUN chmod -R 0555 /opt/plugins
|
|
||||||
|
|
||||||
COPY filebeat-${version}.tar.gz metricbeat-${version}.tar.gz /tmp/
|
COPY filebeat-${version}.tar.gz metricbeat-${version}.tar.gz /tmp/
|
||||||
RUN set -eux ; \\
|
RUN set -eux ; \\
|
||||||
for beat in filebeat metricbeat ; do \\
|
for beat in filebeat metricbeat ; do \\
|
||||||
if [ ! -s /tmp/\$beat-${version}.tar.gz ]; then \\
|
if [ ! -s /tmp/\$beat-${version}.tar.gz ]; then \\
|
||||||
echo "/tmp/\$beat-${version}.tar.gz is empty - cannot uncompress" 2>&1 ; \\
|
echo "/tmp/\$beat-${version}.tar.gz is empty - cannot uncompress" 2>&1 ; \\
|
||||||
exit 1 ; \\
|
exit 1 ; \\
|
||||||
fi ; \\
|
fi ; \\
|
||||||
if ! tar tf /tmp/\$beat-${version}.tar.gz >/dev/null; then \\
|
if ! tar tf /tmp/\$beat-${version}.tar.gz >/dev/null; then \\
|
||||||
echo "/tmp/\$beat-${version}.tar.gz is corrupt - cannot uncompress" 2>&1 ; \\
|
echo "/tmp/\$beat-${version}.tar.gz is corrupt - cannot uncompress" 2>&1 ; \\
|
||||||
exit 1 ; \\
|
exit 1 ; \\
|
||||||
fi ; \\
|
fi ; \\
|
||||||
mkdir -p /opt/\$beat ; \\
|
mkdir -p /opt/\$beat ; \\
|
||||||
tar xf /tmp/\$beat-${version}.tar.gz -C /opt/\$beat --strip-components=1 ; \\
|
tar xf /tmp/\$beat-${version}.tar.gz -C /opt/\$beat --strip-components=1 ; \\
|
||||||
done
|
done
|
||||||
<% } %>
|
|
||||||
|
|
||||||
COPY plugins/*.zip /opt/plugins/archive/
|
COPY plugins/*.zip /opt/plugins/archive/
|
||||||
|
|
||||||
|
@ -29,7 +27,6 @@ RUN chown 1000:1000 /opt/plugins/archive/*
|
||||||
RUN chmod 0444 /opt/plugins/archive/*
|
RUN chmod 0444 /opt/plugins/archive/*
|
||||||
|
|
||||||
FROM ${base_image}
|
FROM ${base_image}
|
||||||
<% if (docker_base == "wolfi_ess") { %>
|
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
RUN <%= retry.loop("apk", "export DEBIAN_FRONTEND=noninteractive && apk update && apk update && apk add --no-cache wget") %>
|
RUN <%= retry.loop("apk", "export DEBIAN_FRONTEND=noninteractive && apk update && apk update && apk add --no-cache wget") %>
|
||||||
|
@ -44,8 +41,4 @@ RUN mkdir /app && \\
|
||||||
|
|
||||||
COPY --from=builder --chown=0:0 /opt /opt
|
COPY --from=builder --chown=0:0 /opt /opt
|
||||||
USER 1000:0
|
USER 1000:0
|
||||||
<% } else { %>
|
|
||||||
COPY --from=builder /opt/plugins /opt/plugins
|
|
||||||
<% } %>
|
|
||||||
|
|
||||||
ENV ES_PLUGIN_ARCHIVE_DIR /opt/plugins/archive
|
ENV ES_PLUGIN_ARCHIVE_DIR /opt/plugins/archive
|
||||||
|
|
|
@ -99,6 +99,7 @@ import static org.junit.Assume.assumeTrue;
|
||||||
* <li>The default image with a custom, small base image</li>
|
* <li>The default image with a custom, small base image</li>
|
||||||
* <li>A UBI-based image</li>
|
* <li>A UBI-based image</li>
|
||||||
* <li>Another UBI image for Iron Bank</li>
|
* <li>Another UBI image for Iron Bank</li>
|
||||||
|
* <li>A WOLFI-based image</li>
|
||||||
* <li>Images for Cloud</li>
|
* <li>Images for Cloud</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
|
@ -170,9 +171,7 @@ public class DockerTests extends PackagingTestCase {
|
||||||
public void test020PluginsListWithNoPlugins() {
|
public void test020PluginsListWithNoPlugins() {
|
||||||
assumeTrue(
|
assumeTrue(
|
||||||
"Only applies to non-Cloud images",
|
"Only applies to non-Cloud images",
|
||||||
distribution.packaging != Packaging.DOCKER_CLOUD
|
distribution.packaging != Packaging.DOCKER_CLOUD && distribution().packaging != Packaging.DOCKER_CLOUD_ESS
|
||||||
&& distribution().packaging != Packaging.DOCKER_CLOUD_ESS
|
|
||||||
&& distribution().packaging != Packaging.DOCKER_WOLFI_ESS
|
|
||||||
);
|
);
|
||||||
|
|
||||||
final Installation.Executables bin = installation.executables();
|
final Installation.Executables bin = installation.executables();
|
||||||
|
@ -203,15 +202,14 @@ public class DockerTests extends PackagingTestCase {
|
||||||
* Checks that ESS images can install plugins from the local archive.
|
* Checks that ESS images can install plugins from the local archive.
|
||||||
*/
|
*/
|
||||||
public void test022InstallPluginsFromLocalArchive() {
|
public void test022InstallPluginsFromLocalArchive() {
|
||||||
assumeTrue(
|
assumeTrue("Only ESS images have a local archive", distribution().packaging == Packaging.DOCKER_CLOUD_ESS);
|
||||||
"Only ESS images have a local archive",
|
|
||||||
distribution().packaging == Packaging.DOCKER_CLOUD_ESS || distribution().packaging == Packaging.DOCKER_WOLFI_ESS
|
|
||||||
);
|
|
||||||
|
|
||||||
final String plugin = "analysis-icu";
|
final String plugin = "analysis-icu";
|
||||||
final Installation.Executables bin = installation.executables();
|
final Installation.Executables bin = installation.executables();
|
||||||
|
|
||||||
|
listPluginArchive().forEach(System.out::println);
|
||||||
assertThat("Expected " + plugin + " to not be installed", listPlugins(), not(hasItems(plugin)));
|
assertThat("Expected " + plugin + " to not be installed", listPlugins(), not(hasItems(plugin)));
|
||||||
|
assertThat("Expected " + plugin + " available in archive", listPluginArchive(), hasSize(16));
|
||||||
|
|
||||||
// Stuff the proxy settings with garbage, so any attempt to go out to the internet would fail
|
// Stuff the proxy settings with garbage, so any attempt to go out to the internet would fail
|
||||||
sh.getEnv()
|
sh.getEnv()
|
||||||
|
@ -259,10 +257,7 @@ public class DockerTests extends PackagingTestCase {
|
||||||
* Checks that ESS images can manage plugins from the local archive by deploying a plugins config file.
|
* Checks that ESS images can manage plugins from the local archive by deploying a plugins config file.
|
||||||
*/
|
*/
|
||||||
public void test024InstallPluginFromArchiveUsingConfigFile() {
|
public void test024InstallPluginFromArchiveUsingConfigFile() {
|
||||||
assumeTrue(
|
assumeTrue("Only ESS image has a plugin archive", distribution().packaging == Packaging.DOCKER_CLOUD_ESS);
|
||||||
"Only ESS image has a plugin archive",
|
|
||||||
distribution().packaging == Packaging.DOCKER_CLOUD_ESS || distribution().packaging == Packaging.DOCKER_WOLFI_ESS
|
|
||||||
);
|
|
||||||
|
|
||||||
final String filename = "elasticsearch-plugins.yml";
|
final String filename = "elasticsearch-plugins.yml";
|
||||||
append(tempDir.resolve(filename), """
|
append(tempDir.resolve(filename), """
|
||||||
|
@ -394,7 +389,7 @@ public class DockerTests extends PackagingTestCase {
|
||||||
if (distribution.packaging == Packaging.DOCKER_UBI || distribution.packaging == Packaging.DOCKER_IRON_BANK) {
|
if (distribution.packaging == Packaging.DOCKER_UBI || distribution.packaging == Packaging.DOCKER_IRON_BANK) {
|
||||||
// In these images, the `cacerts` file ought to be a symlink here
|
// In these images, the `cacerts` file ought to be a symlink here
|
||||||
assertThat(path, equalTo("/etc/pki/ca-trust/extracted/java/cacerts"));
|
assertThat(path, equalTo("/etc/pki/ca-trust/extracted/java/cacerts"));
|
||||||
} else if (distribution.packaging == Packaging.DOCKER_WOLFI || distribution.packaging == Packaging.DOCKER_WOLFI_ESS) {
|
} else if (distribution.packaging == Packaging.DOCKER_WOLFI || distribution.packaging == Packaging.DOCKER_CLOUD_ESS) {
|
||||||
// In these images, the `cacerts` file ought to be a symlink here
|
// In these images, the `cacerts` file ought to be a symlink here
|
||||||
assertThat(path, equalTo("/etc/ssl/certs/java/cacerts"));
|
assertThat(path, equalTo("/etc/ssl/certs/java/cacerts"));
|
||||||
} else {
|
} else {
|
||||||
|
@ -1121,10 +1116,8 @@ public class DockerTests extends PackagingTestCase {
|
||||||
*/
|
*/
|
||||||
public void test171AdditionalCliOptionsAreForwarded() throws Exception {
|
public void test171AdditionalCliOptionsAreForwarded() throws Exception {
|
||||||
assumeTrue(
|
assumeTrue(
|
||||||
"Does not apply to Cloud and wolfi ess images, because they don't use the default entrypoint",
|
"Does not apply to Cloud and Cloud ESS images, because they don't use the default entrypoint",
|
||||||
distribution.packaging != Packaging.DOCKER_CLOUD
|
distribution.packaging != Packaging.DOCKER_CLOUD && distribution().packaging != Packaging.DOCKER_CLOUD_ESS
|
||||||
&& distribution().packaging != Packaging.DOCKER_CLOUD_ESS
|
|
||||||
&& distribution().packaging != Packaging.DOCKER_WOLFI_ESS
|
|
||||||
);
|
);
|
||||||
|
|
||||||
runContainer(distribution(), builder().runArgs("bin/elasticsearch", "-Ecluster.name=kimchy").envVar("ELASTIC_PASSWORD", PASSWORD));
|
runContainer(distribution(), builder().runArgs("bin/elasticsearch", "-Ecluster.name=kimchy").envVar("ELASTIC_PASSWORD", PASSWORD));
|
||||||
|
@ -1211,11 +1204,7 @@ public class DockerTests extends PackagingTestCase {
|
||||||
* Check that the Cloud image contains the required Beats
|
* Check that the Cloud image contains the required Beats
|
||||||
*/
|
*/
|
||||||
public void test400CloudImageBundlesBeats() {
|
public void test400CloudImageBundlesBeats() {
|
||||||
assumeTrue(
|
assumeTrue(distribution.packaging == Packaging.DOCKER_CLOUD || distribution.packaging == Packaging.DOCKER_CLOUD_ESS);
|
||||||
distribution.packaging == Packaging.DOCKER_CLOUD
|
|
||||||
|| distribution.packaging == Packaging.DOCKER_CLOUD_ESS
|
|
||||||
|| distribution.packaging == Packaging.DOCKER_WOLFI_ESS
|
|
||||||
);
|
|
||||||
|
|
||||||
final List<String> contents = listContents("/opt");
|
final List<String> contents = listContents("/opt");
|
||||||
assertThat("Expected beats in /opt", contents, hasItems("filebeat", "metricbeat"));
|
assertThat("Expected beats in /opt", contents, hasItems("filebeat", "metricbeat"));
|
||||||
|
@ -1233,6 +1222,10 @@ public class DockerTests extends PackagingTestCase {
|
||||||
return sh.run(bin.pluginTool + " list").stdout().lines().collect(Collectors.toList());
|
return sh.run(bin.pluginTool + " list").stdout().lines().collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<String> listPluginArchive() {
|
||||||
|
return sh.run("ls -lh /opt/plugins/archive").stdout().lines().collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that readiness listener works
|
* Check that readiness listener works
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -436,7 +436,7 @@ public class KeystoreManagementTests extends PackagingTestCase {
|
||||||
switch (distribution.packaging) {
|
switch (distribution.packaging) {
|
||||||
case TAR, ZIP -> assertThat(keystore, file(File, ARCHIVE_OWNER, ARCHIVE_OWNER, p660));
|
case TAR, ZIP -> assertThat(keystore, file(File, ARCHIVE_OWNER, ARCHIVE_OWNER, p660));
|
||||||
case DEB, RPM -> assertThat(keystore, file(File, "root", "elasticsearch", p660));
|
case DEB, RPM -> assertThat(keystore, file(File, "root", "elasticsearch", p660));
|
||||||
case DOCKER, DOCKER_UBI, DOCKER_IRON_BANK, DOCKER_CLOUD, DOCKER_CLOUD_ESS, DOCKER_WOLFI, DOCKER_WOLFI_ESS -> assertThat(
|
case DOCKER, DOCKER_UBI, DOCKER_IRON_BANK, DOCKER_CLOUD, DOCKER_CLOUD_ESS, DOCKER_WOLFI -> assertThat(
|
||||||
keystore,
|
keystore,
|
||||||
DockerFileMatcher.file(p660)
|
DockerFileMatcher.file(p660)
|
||||||
);
|
);
|
||||||
|
|
|
@ -245,7 +245,7 @@ public abstract class PackagingTestCase extends Assert {
|
||||||
installation = Packages.installPackage(sh, distribution);
|
installation = Packages.installPackage(sh, distribution);
|
||||||
Packages.verifyPackageInstallation(installation, distribution, sh);
|
Packages.verifyPackageInstallation(installation, distribution, sh);
|
||||||
}
|
}
|
||||||
case DOCKER, DOCKER_UBI, DOCKER_IRON_BANK, DOCKER_CLOUD, DOCKER_CLOUD_ESS, DOCKER_WOLFI, DOCKER_WOLFI_ESS -> {
|
case DOCKER, DOCKER_UBI, DOCKER_IRON_BANK, DOCKER_CLOUD, DOCKER_CLOUD_ESS, DOCKER_WOLFI -> {
|
||||||
installation = Docker.runContainer(distribution);
|
installation = Docker.runContainer(distribution);
|
||||||
Docker.verifyContainerInstallation(installation);
|
Docker.verifyContainerInstallation(installation);
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,6 @@ public abstract class PackagingTestCase extends Assert {
|
||||||
case DOCKER_CLOUD:
|
case DOCKER_CLOUD:
|
||||||
case DOCKER_CLOUD_ESS:
|
case DOCKER_CLOUD_ESS:
|
||||||
case DOCKER_WOLFI:
|
case DOCKER_WOLFI:
|
||||||
case DOCKER_WOLFI_ESS:
|
|
||||||
// nothing, "installing" docker image is running it
|
// nothing, "installing" docker image is running it
|
||||||
return Shell.NO_OP;
|
return Shell.NO_OP;
|
||||||
default:
|
default:
|
||||||
|
@ -362,7 +361,6 @@ public abstract class PackagingTestCase extends Assert {
|
||||||
case DOCKER_CLOUD:
|
case DOCKER_CLOUD:
|
||||||
case DOCKER_CLOUD_ESS:
|
case DOCKER_CLOUD_ESS:
|
||||||
case DOCKER_WOLFI:
|
case DOCKER_WOLFI:
|
||||||
case DOCKER_WOLFI_ESS:
|
|
||||||
// nothing, "installing" docker image is running it
|
// nothing, "installing" docker image is running it
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -375,8 +373,7 @@ public abstract class PackagingTestCase extends Assert {
|
||||||
switch (distribution.packaging) {
|
switch (distribution.packaging) {
|
||||||
case TAR, ZIP -> Archives.assertElasticsearchStarted(installation);
|
case TAR, ZIP -> Archives.assertElasticsearchStarted(installation);
|
||||||
case DEB, RPM -> Packages.assertElasticsearchStarted(sh, installation);
|
case DEB, RPM -> Packages.assertElasticsearchStarted(sh, installation);
|
||||||
case DOCKER, DOCKER_UBI, DOCKER_IRON_BANK, DOCKER_CLOUD, DOCKER_CLOUD_ESS, DOCKER_WOLFI, DOCKER_WOLFI_ESS -> Docker
|
case DOCKER, DOCKER_UBI, DOCKER_IRON_BANK, DOCKER_CLOUD, DOCKER_CLOUD_ESS, DOCKER_WOLFI -> Docker.waitForElasticsearchToStart();
|
||||||
.waitForElasticsearchToStart();
|
|
||||||
default -> throw new IllegalStateException("Unknown Elasticsearch packaging type.");
|
default -> throw new IllegalStateException("Unknown Elasticsearch packaging type.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,6 @@ public class Distribution {
|
||||||
this.packaging = Packaging.DOCKER_CLOUD_ESS;
|
this.packaging = Packaging.DOCKER_CLOUD_ESS;
|
||||||
} else if (filename.endsWith(".wolfi.tar")) {
|
} else if (filename.endsWith(".wolfi.tar")) {
|
||||||
this.packaging = Packaging.DOCKER_WOLFI;
|
this.packaging = Packaging.DOCKER_WOLFI;
|
||||||
} else if (filename.endsWith(".wolfi-ess.tar")) {
|
|
||||||
this.packaging = Packaging.DOCKER_WOLFI_ESS;
|
|
||||||
} else {
|
} else {
|
||||||
int lastDot = filename.lastIndexOf('.');
|
int lastDot = filename.lastIndexOf('.');
|
||||||
this.packaging = Packaging.valueOf(filename.substring(lastDot + 1).toUpperCase(Locale.ROOT));
|
this.packaging = Packaging.valueOf(filename.substring(lastDot + 1).toUpperCase(Locale.ROOT));
|
||||||
|
@ -65,7 +63,7 @@ public class Distribution {
|
||||||
*/
|
*/
|
||||||
public boolean isDocker() {
|
public boolean isDocker() {
|
||||||
return switch (packaging) {
|
return switch (packaging) {
|
||||||
case DOCKER, DOCKER_UBI, DOCKER_IRON_BANK, DOCKER_CLOUD, DOCKER_CLOUD_ESS, DOCKER_WOLFI, DOCKER_WOLFI_ESS -> true;
|
case DOCKER, DOCKER_UBI, DOCKER_IRON_BANK, DOCKER_CLOUD, DOCKER_CLOUD_ESS, DOCKER_WOLFI -> true;
|
||||||
default -> false;
|
default -> false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -81,8 +79,7 @@ public class Distribution {
|
||||||
DOCKER_IRON_BANK(".ironbank.tar", Platforms.isDocker()),
|
DOCKER_IRON_BANK(".ironbank.tar", Platforms.isDocker()),
|
||||||
DOCKER_CLOUD(".cloud.tar", Platforms.isDocker()),
|
DOCKER_CLOUD(".cloud.tar", Platforms.isDocker()),
|
||||||
DOCKER_CLOUD_ESS(".cloud-ess.tar", Platforms.isDocker()),
|
DOCKER_CLOUD_ESS(".cloud-ess.tar", Platforms.isDocker()),
|
||||||
DOCKER_WOLFI(".wolfi.tar", Platforms.isDocker()),
|
DOCKER_WOLFI(".wolfi.tar", Platforms.isDocker());
|
||||||
DOCKER_WOLFI_ESS(".wolfi-ess.tar", Platforms.isDocker());
|
|
||||||
|
|
||||||
/** The extension of this distribution's file */
|
/** The extension of this distribution's file */
|
||||||
public final String extension;
|
public final String extension;
|
||||||
|
|
|
@ -532,9 +532,7 @@ public class Docker {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (es.distribution.packaging == Packaging.DOCKER_CLOUD
|
if (es.distribution.packaging == Packaging.DOCKER_CLOUD || es.distribution.packaging == Packaging.DOCKER_CLOUD_ESS) {
|
||||||
|| es.distribution.packaging == Packaging.DOCKER_CLOUD_ESS
|
|
||||||
|| es.distribution.packaging == Packaging.DOCKER_WOLFI_ESS) {
|
|
||||||
verifyCloudContainerInstallation(es);
|
verifyCloudContainerInstallation(es);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -543,7 +541,7 @@ public class Docker {
|
||||||
final String pluginArchive = "/opt/plugins/archive";
|
final String pluginArchive = "/opt/plugins/archive";
|
||||||
final List<String> plugins = listContents(pluginArchive);
|
final List<String> plugins = listContents(pluginArchive);
|
||||||
|
|
||||||
if (es.distribution.packaging == Packaging.DOCKER_CLOUD_ESS || es.distribution.packaging == Packaging.DOCKER_WOLFI_ESS) {
|
if (es.distribution.packaging == Packaging.DOCKER_CLOUD_ESS) {
|
||||||
assertThat("ESS image should come with plugins in " + pluginArchive, plugins, not(empty()));
|
assertThat("ESS image should come with plugins in " + pluginArchive, plugins, not(empty()));
|
||||||
|
|
||||||
final List<String> repositoryPlugins = plugins.stream()
|
final List<String> repositoryPlugins = plugins.stream()
|
||||||
|
|
|
@ -168,7 +168,6 @@ public class DockerRun {
|
||||||
case DOCKER_CLOUD -> "-cloud";
|
case DOCKER_CLOUD -> "-cloud";
|
||||||
case DOCKER_CLOUD_ESS -> "-cloud-ess";
|
case DOCKER_CLOUD_ESS -> "-cloud-ess";
|
||||||
case DOCKER_WOLFI -> "-wolfi";
|
case DOCKER_WOLFI -> "-wolfi";
|
||||||
case DOCKER_WOLFI_ESS -> "-wolfi-ess";
|
|
||||||
default -> throw new IllegalStateException("Unexpected distribution packaging type: " + distribution.packaging);
|
default -> throw new IllegalStateException("Unexpected distribution packaging type: " + distribution.packaging);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -75,8 +75,6 @@ List projects = [
|
||||||
'distribution:docker:ubi-docker-export',
|
'distribution:docker:ubi-docker-export',
|
||||||
'distribution:docker:wolfi-docker-aarch64-export',
|
'distribution:docker:wolfi-docker-aarch64-export',
|
||||||
'distribution:docker:wolfi-docker-export',
|
'distribution:docker:wolfi-docker-export',
|
||||||
'distribution:docker:wolfi-ess-docker-aarch64-export',
|
|
||||||
'distribution:docker:wolfi-ess-docker-export',
|
|
||||||
'distribution:packages:aarch64-deb',
|
'distribution:packages:aarch64-deb',
|
||||||
'distribution:packages:deb',
|
'distribution:packages:deb',
|
||||||
'distribution:packages:aarch64-rpm',
|
'distribution:packages:aarch64-rpm',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue