Skip to content

Commit

Permalink
Remove wolfi ess image
Browse files Browse the repository at this point in the history
  • Loading branch information
breskeby committed Dec 19, 2024
1 parent 3339be8 commit 12a1b69
Show file tree
Hide file tree
Showing 17 changed files with 60 additions and 204 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipelines/periodic-packaging.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ steps:
steps:
- label: "{{matrix.image}} / packaging-tests-unix"
command: ./.ci/scripts/packaging-test.sh destructivePackagingTest
timeout_in_minutes: 420
timeout_in_minutes: 300
matrix:
setup:
image:
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/pipelines/periodic-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ steps:
steps:
- label: "{{matrix.image}} / packaging-tests-unix"
command: ./.ci/scripts/packaging-test.sh destructivePackagingTest
timeout_in_minutes: 420
timeout_in_minutes: 300
matrix:
setup:
image:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,8 @@ public enum DockerBase {
WOLFI("docker.elastic.co/wolfi/chainguard-base:latest@sha256:bfdeddb33330a281950c2a54adef991dbbe6a42832bc505d13b11beaf50ae73f",
"-wolfi",
"apk"
),
);
// spotless:on

// Based on WOLFI above, with more extras. We don't set a base image because
// we programmatically extend from the Wolfi image.
WOLFI_ESS(null, "-wolfi-ess", "apk");

private final String image;
private final String suffix;
private final String packageManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,6 @@ private static String distributionProjectName(ElasticsearchDistribution distribu
if (distribution.getType() == InternalElasticsearchDistributionTypes.DOCKER_WOLFI) {
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();
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class InternalElasticsearchDistributionTypes {
public static ElasticsearchDistributionType DOCKER_IRONBANK = new DockerIronBankElasticsearchDistributionType();
public static ElasticsearchDistributionType DOCKER_CLOUD_ESS = new DockerCloudEssElasticsearchDistributionType();
public static ElasticsearchDistributionType DOCKER_WOLFI = new DockerWolfiElasticsearchDistributionType();
public static ElasticsearchDistributionType DOCKER_WOLFI_ESS = new DockerWolfiEssElasticsearchDistributionType();

public static List<ElasticsearchDistributionType> ALL_INTERNAL = List.of(
DEB,
Expand All @@ -30,7 +29,6 @@ public class InternalElasticsearchDistributionTypes {
DOCKER_UBI,
DOCKER_IRONBANK,
DOCKER_CLOUD_ESS,
DOCKER_WOLFI,
DOCKER_WOLFI_ESS
DOCKER_WOLFI
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
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_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.util.ParamsUtils.loadBuildParams;

Expand Down Expand Up @@ -153,7 +152,6 @@ private static Map<ElasticsearchDistributionType, TaskProvider<?>> lifecycleTask
lifecyleTasks.put(DOCKER_IRONBANK, project.getTasks().register(taskPrefix + ".docker-ironbank"));
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_ESS, project.getTasks().register(taskPrefix + ".docker-wolfi-ess"));
lifecyleTasks.put(ARCHIVE, project.getTasks().register(taskPrefix + ".archives"));
lifecyleTasks.put(DEB, project.getTasks().register(taskPrefix + ".packages"));
lifecyleTasks.put(RPM, lifecyleTasks.get(DEB));
Expand Down
13 changes: 1 addition & 12 deletions distribution/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@ the [DockerBase] enum.
* UBI - the same as the default image, but based upon [RedHat's UBI
images][ubi], specifically their minimal flavour.
* 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
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. Furthermore this image has
* `filebeat` and `metricbeat` included
* `wget` included
* The `ENTRYPOINT` is just `/sbin/tini`, and the `CMD` is
`/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
can still be tested.
* Iron Bank - this is the US Department of Defence's repository of digitally
signed, binary container images including both Free and Open-Source
software (FOSS) and Commercial off-the-shelf (COTS). In practice, this is
Expand All @@ -28,7 +17,7 @@ the [DockerBase] enum.
* `filebeat` and `metricbeat` are included
* `wget` is included
* The `ENTRYPOINT` is just `/bin/tini`, and the `CMD` is
`/app/elasticsearch.sh`. In normal use this file would be bind-mounted
`/app/elasticsearc.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
can still be tested.
* Cloud ESS - this directly extends the Cloud image, and adds all ES plugins
Expand Down
93 changes: 28 additions & 65 deletions distribution/docker/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.elasticsearch.gradle.Architecture
import org.elasticsearch.gradle.LoggedExec
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.internal.DockerBase
Expand All @@ -9,7 +10,6 @@ import org.elasticsearch.gradle.internal.docker.ShellRetry
import org.elasticsearch.gradle.internal.docker.TransformLog4jConfigFilter
import org.elasticsearch.gradle.internal.docker.*
import org.elasticsearch.gradle.util.GradleUtils
import org.elasticsearch.gradle.Architecture
import java.nio.file.Path
import java.time.temporal.ChronoUnit

Expand Down Expand Up @@ -99,9 +99,9 @@ String tiniArch = Architecture.current() == Architecture.AARCH64 ? 'arm64' : 'am

dependencies {
aarch64DockerSource project(":distribution:archives:linux-aarch64-tar")
aarch64DockerSourceTar project(path: ":distribution:archives:linux-aarch64-tar", configuration: "default")
aarch64DockerSourceTar project(path: ":distribution:archives:linux-aarch64-tar", configuration:"default")
dockerSource project(":distribution:archives:linux-tar")
dockerSourceTar project(path: ":distribution:archives:linux-tar", configuration: "default")
dockerSourceTar project(path: ":distribution:archives:linux-tar", configuration:"default")
log4jConfig project(path: ":distribution", configuration: 'log4jConfig')
tini "krallin:tini:0.19.0:${tiniArch}"
allPlugins project(path: ':plugins', configuration: 'allPlugins')
Expand All @@ -112,7 +112,7 @@ dependencies {
}

ext.expansions = { Architecture architecture, DockerBase base ->
def (major, minor) = VersionProperties.elasticsearch.split("\\.")
def (major,minor) = VersionProperties.elasticsearch.split("\\.")

// We tag our Docker images with various pieces of information, including a timestamp
// for when the image was built. However, this makes it impossible completely cache
Expand Down Expand Up @@ -216,8 +216,7 @@ elasticsearch_distributions {
}

interface Injected {
@Inject
FileSystemOperations getFs()
@Inject FileSystemOperations getFs()
}

tasks.named("preProcessFixture").configure {
Expand Down Expand Up @@ -327,9 +326,9 @@ void addTransformDockerContextTask(Architecture architecture, DockerBase base) {
into "${project.buildDir}/docker-context/${archiveName}"

// Since we replaced the remote URL in the Dockerfile, copy in the required file
if (base == DockerBase.IRON_BANK) {
if(base == DockerBase.IRON_BANK) {
from(architecture == Architecture.AARCH64 ? configurations.aarch64DockerSourceTar : configurations.dockerSourceTar)
from(configurations.tini) {
from (configurations.tini) {
rename { _ -> 'tini' }
}
} else {
Expand All @@ -339,10 +338,7 @@ void addTransformDockerContextTask(Architecture architecture, DockerBase base) {
expansions(architecture, base).findAll { it.key != 'build_date' }.each { k, v ->
inputs.property(k, { v.toString() })
}
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(
project.gradle.sharedServices,
DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
)
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(project.gradle.sharedServices, DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME)
onlyIf("$architecture supported") { serviceProvider.get().isArchitectureSupported(architecture) }
}

Expand All @@ -366,7 +362,7 @@ private static List<String> generateTags(DockerBase base, Architecture architect
String image = "elasticsearch${base.suffix}"

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

Expand Down Expand Up @@ -416,10 +412,7 @@ void addBuildDockerImageTask(Architecture architecture, DockerBase base) {
baseImages = [base.image]
}

Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(
project.gradle.sharedServices,
DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
)
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(project.gradle.sharedServices, DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME)
onlyIf("$architecture supported") { serviceProvider.get().isArchitectureSupported(architecture) }

}
Expand All @@ -431,12 +424,13 @@ void addBuildDockerImageTask(Architecture architecture, DockerBase base) {
}
}

void addBuildEssDockerImageTask(Architecture architecture, DockerBase dockerBase) {
void addBuildEssDockerImageTask(Architecture architecture) {
DockerBase base = DockerBase.CLOUD_ESS
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${base.suffix}-${VersionProperties.elasticsearch}-docker-build-context${arch}"

final TaskProvider<Sync> buildContextTask =
tasks.register(taskName('build', architecture, dockerBase, 'DockerContext'), Sync) {
tasks.register(taskName('build', architecture, base, 'DockerContext'), Sync) {
into contextDir

final Path projectDir = project.projectDir.toPath()
Expand All @@ -445,54 +439,28 @@ void addBuildEssDockerImageTask(Architecture architecture, DockerBase dockerBase
from configurations.allPlugins
}

if (dockerBase == DockerBase.WOLFI_ESS) {
// 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"
}

String baseSuffix = dockerBase == DockerBase.CLOUD_ESS ? DockerBase.CLOUD.suffix : DockerBase.WOLFI.suffix
from(projectDir.resolve("src/docker/Dockerfile.ess")) {
expand(
[
base_image: "elasticsearch${baseSuffix}:${architecture.classifier}",
docker_base: "${dockerBase.name().toLowerCase()}",
version: "${VersionProperties.elasticsearch}",
retry: ShellRetry
]
)
from(projectDir.resolve("src/docker/Dockerfile.cloud-ess")) {
expand([
base_image: "elasticsearch${DockerBase.CLOUD.suffix}:${architecture.classifier}"
])
filter SquashNewlinesFilter
rename ~/Dockerfile\.ess$/, 'Dockerfile'
rename ~/Dockerfile\.cloud-ess$/, 'Dockerfile'
}
}

final TaskProvider<DockerBuildTask> buildDockerImageTask =
tasks.register(taskName("build", architecture, dockerBase, "DockerImage"), DockerBuildTask) {

DockerBase base = dockerBase == DockerBase.CLOUD_ESS ? DockerBase.CLOUD : DockerBase.WOLFI
tasks.register(taskName("build", architecture, base, "DockerImage"), DockerBuildTask) {

TaskProvider<DockerBuildTask> buildBaseTask = tasks.named(taskName("build", architecture, base, "DockerImage"))
inputs.files(buildBaseTask)
TaskProvider<DockerBuildTask> buildCloudTask = tasks.named(taskName("build", architecture, DockerBase.CLOUD, "DockerImage"))
inputs.files(buildCloudTask)

dockerContext.fileProvider(buildContextTask.map { it.getDestinationDir() })

noCache = buildParams.isCi()
baseImages = []
tags = generateTags(dockerBase, architecture)
tags = generateTags(base, architecture)
platforms.add(architecture.dockerPlatform)
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(
project.gradle.sharedServices,
DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
)
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(project.gradle.sharedServices, DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME)
onlyIf("$architecture supported") { serviceProvider.get().isArchitectureSupported(architecture) }

}
Expand All @@ -504,16 +472,15 @@ void addBuildEssDockerImageTask(Architecture architecture, DockerBase dockerBase

for (final Architecture architecture : Architecture.values()) {
for (final DockerBase base : DockerBase.values()) {
if (base == DockerBase.CLOUD_ESS || base == DockerBase.WOLFI_ESS) {
if (base == DockerBase.CLOUD_ESS) {
continue
}
addBuildDockerContextTask(architecture, base)
addTransformDockerContextTask(architecture, base)
addBuildDockerImageTask(architecture, base)
}

addBuildEssDockerImageTask(architecture, DockerBase.CLOUD_ESS)
addBuildEssDockerImageTask(architecture, DockerBase.WOLFI_ESS)
addBuildEssDockerImageTask(architecture)
}

def exportDockerImages = tasks.register("exportDockerImages")
Expand Down Expand Up @@ -544,8 +511,7 @@ subprojects { Project subProject ->
(base == DockerBase.IRON_BANK ? 'ironbank.tar' :
(base == DockerBase.CLOUD_ESS ? 'cloud-ess.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 exportTaskName = taskName("export", architecture, base, 'DockerImage')
Expand All @@ -561,10 +527,7 @@ subprojects { Project subProject ->
tarFile,
"elasticsearch${base.suffix}:${architecture.classifier}"
dependsOn(parent.path + ":" + buildTaskName)
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(
project.gradle.sharedServices,
DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
)
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(project.gradle.sharedServices, DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME)
onlyIf("$architecture supported") { serviceProvider.get().isArchitectureSupported(architecture) }
}

Expand Down
13 changes: 13 additions & 0 deletions distribution/docker/src/docker/Dockerfile.cloud-ess
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM ${base_image} AS builder

USER root

COPY plugins/*.zip /opt/plugins/archive/

RUN chown root.root /opt/plugins/archive/*
RUN chmod 0444 /opt/plugins/archive/*

FROM ${base_image}

COPY --from=builder /opt/plugins /opt/plugins
ENV ES_PLUGIN_ARCHIVE_DIR /opt/plugins/archive
Loading

0 comments on commit 12a1b69

Please sign in to comment.