Skip to content

Commit

Permalink
Remove unused elasticsearch cloud docker image (elastic#115357)
Browse files Browse the repository at this point in the history
  • Loading branch information
breskeby committed Oct 24, 2024
1 parent 2b0bac3 commit a5ed3df
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ public enum DockerBase {
// The Iron Bank base image is UBI (albeit hardened), but we are required to parameterize the Docker build
IRON_BANK("${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG}", "-ironbank", "yum"),

// Base image with extras for Cloud
CLOUD("ubuntu:20.04", "-cloud", "apt-get"),

// Chainguard based wolfi image with latest jdk
// This is usually updated via renovatebot
// spotless:off
Expand Down
25 changes: 3 additions & 22 deletions distribution/docker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -288,20 +288,6 @@ void addBuildDockerContextTask(Architecture architecture, DockerBase base) {
}
}

if (base == DockerBase.CLOUD) {
// 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
// we should skip the beats part of the build.
String buildId = providers.systemProperty('build.id').getOrNull()
boolean includeBeats = VersionProperties.isElasticsearchSnapshot() == true || buildId != null || useDra

if (includeBeats) {
from configurations.getByName("filebeat_${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"
}
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(
project.gradle.sharedServices,
DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
Expand Down Expand Up @@ -381,7 +367,7 @@ private static List<String> generateTags(DockerBase base, Architecture architect
String image = "elasticsearch${base.suffix}"

String namespace = 'elasticsearch'
if (base == DockerBase.CLOUD || base == DockerBase.CLOUD_ESS) {
if (base == base == DockerBase.CLOUD_ESS) {
namespace += '-ci'
}

Expand Down Expand Up @@ -439,7 +425,7 @@ void addBuildDockerImageTask(Architecture architecture, DockerBase base) {

}

if (base != DockerBase.IRON_BANK && base != DockerBase.CLOUD && base != DockerBase.CLOUD_ESS) {
if (base != DockerBase.IRON_BANK && base != DockerBase.CLOUD_ESS) {
tasks.named("assemble").configure {
dependsOn(buildDockerImageTask)
}
Expand Down Expand Up @@ -548,21 +534,16 @@ subprojects { Project subProject ->
base = DockerBase.IRON_BANK
} else if (subProject.name.contains('cloud-ess-')) {
base = DockerBase.CLOUD_ESS
} else if (subProject.name.contains('cloud-')) {
base = DockerBase.CLOUD
} else if (subProject.name.contains('wolfi-ess')) {
base = DockerBase.WOLFI_ESS
} else if (subProject.name.contains('wolfi-')) {
base = DockerBase.WOLFI
}

final String arch = architecture == Architecture.AARCH64 ? '-aarch64' : ''
final String extension = base == DockerBase.UBI ? 'ubi.tar' :
(base == DockerBase.IRON_BANK ? 'ironbank.tar' :
(base == DockerBase.CLOUD ? 'cloud.tar' :
(base == DockerBase.CLOUD_ESS ? 'cloud-ess.tar' :
(base == DockerBase.WOLFI ? 'wolfi.tar' :
'docker.tar'))))
'docker.tar')))
final String artifactName = "elasticsearch${arch}${base.suffix}_test"

final String exportTaskName = taskName("export", architecture, base, 'DockerImage')
Expand Down
2 changes: 0 additions & 2 deletions distribution/docker/cloud-docker-aarch64-export/build.gradle

This file was deleted.

2 changes: 0 additions & 2 deletions distribution/docker/cloud-docker-export/build.gradle

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions distribution/docker/wolfi-ess-docker-export/build.gradle

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,7 @@ public void test012SecurityCanBeDisabled() throws Exception {
* Checks that no plugins are initially active.
*/
public void test020PluginsListWithNoPlugins() {
assumeTrue(
"Only applies to non-Cloud images",
distribution.packaging != Packaging.DOCKER_CLOUD && distribution().packaging != Packaging.DOCKER_CLOUD_ESS
);
assumeTrue("Only applies to non-Cloud images", distribution().packaging != Packaging.DOCKER_CLOUD_ESS);

final Installation.Executables bin = installation.executables();
final Result r = sh.run(bin.pluginTool + " list");
Expand Down Expand Up @@ -1116,8 +1113,8 @@ public void test170DefaultShellIsBash() {
*/
public void test171AdditionalCliOptionsAreForwarded() throws Exception {
assumeTrue(
"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_ESS
"Does not apply to Cloud ESS images, because they don't use the default entrypoint",
distribution().packaging != Packaging.DOCKER_CLOUD_ESS
);

runContainer(distribution(), builder().runArgs("bin/elasticsearch", "-Ecluster.name=kimchy").envVar("ELASTIC_PASSWORD", PASSWORD));
Expand Down Expand Up @@ -1204,7 +1201,7 @@ public void test310IronBankImageHasNoAdditionalLabels() throws Exception {
* Check that the Cloud image contains the required Beats
*/
public void test400CloudImageBundlesBeats() {
assumeTrue(distribution.packaging == Packaging.DOCKER_CLOUD || distribution.packaging == Packaging.DOCKER_CLOUD_ESS);
assumeTrue(distribution.packaging == Packaging.DOCKER_CLOUD_ESS);

final List<String> contents = listContents("/opt");
assertThat("Expected beats in /opt", contents, hasItems("filebeat", "metricbeat"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,10 +436,7 @@ private void verifyKeystorePermissions() {
switch (distribution.packaging) {
case TAR, ZIP -> assertThat(keystore, file(File, ARCHIVE_OWNER, ARCHIVE_OWNER, 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 -> assertThat(
keystore,
DockerFileMatcher.file(p660)
);
case DOCKER, DOCKER_UBI, DOCKER_IRON_BANK, DOCKER_CLOUD_ESS, DOCKER_WOLFI -> assertThat(keystore, DockerFileMatcher.file(p660));
default -> throw new IllegalStateException("Unknown Elasticsearch packaging type.");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ protected static void install() throws Exception {
installation = Packages.installPackage(sh, distribution);
Packages.verifyPackageInstallation(installation, distribution, sh);
}
case DOCKER, DOCKER_UBI, DOCKER_IRON_BANK, DOCKER_CLOUD, DOCKER_CLOUD_ESS, DOCKER_WOLFI -> {
case DOCKER, DOCKER_UBI, DOCKER_IRON_BANK, DOCKER_CLOUD_ESS, DOCKER_WOLFI -> {
installation = Docker.runContainer(distribution);
Docker.verifyContainerInstallation(installation);
}
Expand Down Expand Up @@ -335,7 +335,6 @@ public Shell.Result runElasticsearchStartCommand(String password, boolean daemon
case DOCKER:
case DOCKER_UBI:
case DOCKER_IRON_BANK:
case DOCKER_CLOUD:
case DOCKER_CLOUD_ESS:
case DOCKER_WOLFI:
// nothing, "installing" docker image is running it
Expand All @@ -358,7 +357,6 @@ public void stopElasticsearch() throws Exception {
case DOCKER:
case DOCKER_UBI:
case DOCKER_IRON_BANK:
case DOCKER_CLOUD:
case DOCKER_CLOUD_ESS:
case DOCKER_WOLFI:
// nothing, "installing" docker image is running it
Expand All @@ -373,7 +371,7 @@ public void awaitElasticsearchStartup(Shell.Result result) throws Exception {
switch (distribution.packaging) {
case TAR, ZIP -> Archives.assertElasticsearchStarted(installation);
case DEB, RPM -> Packages.assertElasticsearchStarted(sh, installation);
case DOCKER, DOCKER_UBI, DOCKER_IRON_BANK, DOCKER_CLOUD, DOCKER_CLOUD_ESS, DOCKER_WOLFI -> Docker.waitForElasticsearchToStart();
case DOCKER, DOCKER_UBI, DOCKER_IRON_BANK, DOCKER_CLOUD_ESS, DOCKER_WOLFI -> Docker.waitForElasticsearchToStart();
default -> throw new IllegalStateException("Unknown Elasticsearch packaging type.");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ public Distribution(Path path) {
this.packaging = Packaging.DOCKER_UBI;
} else if (filename.endsWith(".ironbank.tar")) {
this.packaging = Packaging.DOCKER_IRON_BANK;
} else if (filename.endsWith(".cloud.tar")) {
this.packaging = Packaging.DOCKER_CLOUD;
} else if (filename.endsWith(".cloud-ess.tar")) {
this.packaging = Packaging.DOCKER_CLOUD_ESS;
} else if (filename.endsWith(".wolfi.tar")) {
Expand Down Expand Up @@ -63,7 +61,7 @@ public boolean isPackage() {
*/
public boolean isDocker() {
return switch (packaging) {
case DOCKER, DOCKER_UBI, DOCKER_IRON_BANK, DOCKER_CLOUD, DOCKER_CLOUD_ESS, DOCKER_WOLFI -> true;
case DOCKER, DOCKER_UBI, DOCKER_IRON_BANK, DOCKER_CLOUD_ESS, DOCKER_WOLFI -> true;
default -> false;
};
}
Expand All @@ -77,7 +75,6 @@ public enum Packaging {
DOCKER(".docker.tar", Platforms.isDocker()),
DOCKER_UBI(".ubi.tar", Platforms.isDocker()),
DOCKER_IRON_BANK(".ironbank.tar", Platforms.isDocker()),
DOCKER_CLOUD(".cloud.tar", Platforms.isDocker()),
DOCKER_CLOUD_ESS(".cloud-ess.tar", Platforms.isDocker()),
DOCKER_WOLFI(".wolfi.tar", Platforms.isDocker());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ public static void verifyContainerInstallation(Installation es) {
)
);

if (es.distribution.packaging == Packaging.DOCKER_CLOUD || es.distribution.packaging == Packaging.DOCKER_CLOUD_ESS) {
if (es.distribution.packaging == Packaging.DOCKER_CLOUD_ESS) {
verifyCloudContainerInstallation(es);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ public static String getImageName(Distribution distribution) {
case DOCKER -> "";
case DOCKER_UBI -> "-ubi8";
case DOCKER_IRON_BANK -> "-ironbank";
case DOCKER_CLOUD -> "-cloud";
case DOCKER_CLOUD_ESS -> "-cloud-ess";
case DOCKER_WOLFI -> "-wolfi";
default -> throw new IllegalStateException("Unexpected distribution packaging type: " + distribution.packaging);
Expand Down
2 changes: 0 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ List projects = [
'distribution:archives:linux-aarch64-tar',
'distribution:archives:linux-tar',
'distribution:docker',
'distribution:docker:cloud-docker-export',
'distribution:docker:cloud-docker-aarch64-export',
'distribution:docker:cloud-ess-docker-export',
'distribution:docker:cloud-ess-docker-aarch64-export',
'distribution:docker:docker-aarch64-export',
Expand Down

0 comments on commit a5ed3df

Please sign in to comment.