Skip to content

Commit f28df38

Browse files
authored
[8.17] Revert cloud wolfi migration (elastic#119068) (elastic#119103)
This reverts the wolfi migration for cloud ess docker images. (cherry picked from commit 81f725d) # Conflicts: # build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/DockerBase.java # distribution/docker/build.gradle # qa/packaging/src/test/java/org/elasticsearch/packaging/test/DockerTests.java
1 parent c1b0a07 commit f28df38

File tree

9 files changed

+54
-129
lines changed

9 files changed

+54
-129
lines changed

.buildkite/pipelines/periodic-packaging.template.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ steps:
33
steps:
44
- label: "{{matrix.image}} / packaging-tests-unix"
55
command: ./.ci/scripts/packaging-test.sh destructivePackagingTest
6-
timeout_in_minutes: 420
6+
timeout_in_minutes: 300
77
matrix:
88
setup:
99
image:

.buildkite/pipelines/periodic-packaging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ steps:
44
steps:
55
- label: "{{matrix.image}} / packaging-tests-unix"
66
command: ./.ci/scripts/packaging-test.sh destructivePackagingTest
7-
timeout_in_minutes: 420
7+
timeout_in_minutes: 300
88
matrix:
99
setup:
1010
image:

.buildkite/pipelines/pull-request/packaging-tests-unix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ steps:
55
steps:
66
- label: "{{matrix.image}} / docker / packaging-tests-unix"
77
key: "packaging-tests-unix-docker"
8-
command: ./.ci/scripts/packaging-test.sh destructiveDistroTest.docker-cloud-ess
8+
command: ./.ci/scripts/packaging-test.sh destructiveDistroTest.docker
99
timeout_in_minutes: 300
1010
matrix:
1111
setup:

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/DockerBase.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,19 @@ public enum DockerBase {
2424
// Base image with extras for Cloud
2525
CLOUD("ubuntu:20.04", "-cloud", "apt-get"),
2626

27+
// Based on CLOUD above, with more extras. We don't set a base image because
28+
// we programmatically extend from the Cloud image.
29+
CLOUD_ESS(null, "-cloud-ess", "apt-get"),
30+
2731
// Chainguard based wolfi image with latest jdk
2832
// This is usually updated via renovatebot
2933
// spotless:off
3034
WOLFI("docker.elastic.co/wolfi/chainguard-base:latest@sha256:bfdeddb33330a281950c2a54adef991dbbe6a42832bc505d13b11beaf50ae73f",
3135
"-wolfi",
3236
"apk"
33-
),
37+
);
3438
// spotless:on
35-
// Based on WOLFI above, with more extras. We don't set a base image because
36-
// we programmatically extend from the wolfi image.
37-
CLOUD_ESS(null, "-cloud-ess", "apk");
38-
39+
3940
private final String image;
4041
private final String suffix;
4142
private final String packageManager;

distribution/docker/README.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,25 @@ the [DockerBase] enum.
77
* UBI - the same as the default image, but based upon [RedHat's UBI
88
images][ubi], specifically their minimal flavour.
99
* Wolfi - the same as the default image, but based upon [Wolfi](https://github.com/wolfi-dev)
10-
* Cloud ESS - this directly extends the Wolfi image, and adds all ES plugins
11-
that the ES build generates in an archive directory. It also sets an
12-
environment variable that points at this directory. This allows plugins to
13-
be installed from the archive instead of the internet, speeding up
14-
deployment times. Furthermore this image has
15-
* `filebeat` and `metricbeat` included
16-
* `wget` included
17-
* The `ENTRYPOINT` is just `/sbin/tini`, and the `CMD` is
18-
`/app/elasticsearch.sh`. In normal use this file would be bind-mounted
19-
in, but the image ships a stub version of this file so that the image
20-
can still be tested.
2110
* Iron Bank - this is the US Department of Defence's repository of digitally
2211
signed, binary container images including both Free and Open-Source
2312
software (FOSS) and Commercial off-the-shelf (COTS). In practice, this is
2413
another UBI build, this time on the regular UBI image, with extra
2514
hardening. See below for more details.
15+
2616
* Cloud - this is mostly the same as the default image, with some notable differences:
2717
* `filebeat` and `metricbeat` are included
2818
* `wget` is included
2919
* The `ENTRYPOINT` is just `/bin/tini`, and the `CMD` is
30-
`/app/elasticsearch.sh`. In normal use this file would be bind-mounted
20+
`/app/elasticsearc.sh`. In normal use this file would be bind-mounted
3121
in, but the image ships a stub version of this file so that the image
3222
can still be tested.
23+
* Cloud ESS - this directly extends the Cloud image, and adds all ES plugins
24+
that the ES build generates in an archive directory. It also sets an
25+
environment variable that points at this directory. This allows plugins to
26+
be installed from the archive instead of the internet, speeding up
27+
deployment times.
28+
3329
The long-term goal is for both Cloud images to be retired in favour of the
3430
default image.
3531

distribution/docker/build.gradle

Lines changed: 23 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import org.elasticsearch.gradle.Architecture
12
import org.elasticsearch.gradle.LoggedExec
23
import org.elasticsearch.gradle.VersionProperties
34
import org.elasticsearch.gradle.internal.DockerBase
@@ -9,7 +10,6 @@ import org.elasticsearch.gradle.internal.docker.ShellRetry
910
import org.elasticsearch.gradle.internal.docker.TransformLog4jConfigFilter
1011
import org.elasticsearch.gradle.internal.docker.*
1112
import org.elasticsearch.gradle.util.GradleUtils
12-
import org.elasticsearch.gradle.Architecture
1313
import java.nio.file.Path
1414
import java.time.temporal.ChronoUnit
1515

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

100100
dependencies {
101101
aarch64DockerSource project(":distribution:archives:linux-aarch64-tar")
102-
aarch64DockerSourceTar project(path: ":distribution:archives:linux-aarch64-tar", configuration: "default")
102+
aarch64DockerSourceTar project(path: ":distribution:archives:linux-aarch64-tar", configuration:"default")
103103
dockerSource project(":distribution:archives:linux-tar")
104-
dockerSourceTar project(path: ":distribution:archives:linux-tar", configuration: "default")
104+
dockerSourceTar project(path: ":distribution:archives:linux-tar", configuration:"default")
105105
log4jConfig project(path: ":distribution", configuration: 'log4jConfig')
106106
tini "krallin:tini:0.19.0:${tiniArch}"
107107
allPlugins project(path: ':plugins', configuration: 'allPlugins')
@@ -112,7 +112,7 @@ dependencies {
112112
}
113113

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

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

218218
interface Injected {
219-
@Inject
220-
FileSystemOperations getFs()
219+
@Inject FileSystemOperations getFs()
221220
}
222221

223222
tasks.named("preProcessFixture").configure {
@@ -341,9 +340,9 @@ void addTransformDockerContextTask(Architecture architecture, DockerBase base) {
341340
into "${project.buildDir}/docker-context/${archiveName}"
342341

343342
// Since we replaced the remote URL in the Dockerfile, copy in the required file
344-
if (base == DockerBase.IRON_BANK) {
343+
if(base == DockerBase.IRON_BANK) {
345344
from(architecture == Architecture.AARCH64 ? configurations.aarch64DockerSourceTar : configurations.dockerSourceTar)
346-
from(configurations.tini) {
345+
from (configurations.tini) {
347346
rename { _ -> 'tini' }
348347
}
349348
} else {
@@ -353,10 +352,7 @@ void addTransformDockerContextTask(Architecture architecture, DockerBase base) {
353352
expansions(architecture, base).findAll { it.key != 'build_date' }.each { k, v ->
354353
inputs.property(k, { v.toString() })
355354
}
356-
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(
357-
project.gradle.sharedServices,
358-
DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
359-
)
355+
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(project.gradle.sharedServices, DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME)
360356
onlyIf("$architecture supported") { serviceProvider.get().isArchitectureSupported(architecture) }
361357
}
362358

@@ -430,10 +426,7 @@ void addBuildDockerImageTask(Architecture architecture, DockerBase base) {
430426
baseImages = [base.image]
431427
}
432428

433-
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(
434-
project.gradle.sharedServices,
435-
DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
436-
)
429+
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(project.gradle.sharedServices, DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME)
437430
onlyIf("$architecture supported") { serviceProvider.get().isArchitectureSupported(architecture) }
438431

439432
}
@@ -446,12 +439,12 @@ void addBuildDockerImageTask(Architecture architecture, DockerBase base) {
446439
}
447440

448441
void addBuildEssDockerImageTask(Architecture architecture) {
449-
DockerBase dockerBase = DockerBase.CLOUD_ESS
442+
DockerBase base = DockerBase.CLOUD_ESS
450443
String arch = architecture == Architecture.AARCH64 ? '-aarch64' : ''
451-
String contextDir = "${project.buildDir}/docker-context/elasticsearch${dockerBase.suffix}-${VersionProperties.elasticsearch}-docker-build-context${arch}"
444+
String contextDir = "${project.buildDir}/docker-context/elasticsearch${base.suffix}-${VersionProperties.elasticsearch}-docker-build-context${arch}"
452445

453446
final TaskProvider<Sync> buildContextTask =
454-
tasks.register(taskName('build', architecture, dockerBase, 'DockerContext'), Sync) {
447+
tasks.register(taskName('build', architecture, base, 'DockerContext'), Sync) {
455448
into contextDir
456449

457450
final Path projectDir = project.projectDir.toPath()
@@ -460,52 +453,28 @@ void addBuildEssDockerImageTask(Architecture architecture) {
460453
from configurations.allPlugins
461454
}
462455

463-
// If we're performing a release build, but `build.id` hasn't been set, we can
464-
// infer that we're not at the Docker building stage of the build, and therefore
465-
// we should skip the beats part of the build.
466-
String buildId = providers.systemProperty('build.id').getOrNull()
467-
boolean includeBeats = VersionProperties.isElasticsearchSnapshot() == true || buildId != null || useDra
468-
469-
if (includeBeats) {
470-
from configurations.getByName("filebeat_${architecture.classifier}")
471-
from configurations.getByName("metricbeat_${architecture.classifier}")
472-
}
473-
// For some reason, the artifact name can differ depending on what repository we used.
474-
rename ~/((?:file|metric)beat)-.*\.tar\.gz$/, "\$1-${VersionProperties.elasticsearch}.tar.gz"
475-
476-
String baseSuffix = DockerBase.WOLFI.suffix
477-
from(projectDir.resolve("src/docker/Dockerfile.ess")) {
478-
expand(
479-
[
480-
base_image: "elasticsearch${baseSuffix}:${architecture.classifier}",
481-
docker_base: "${dockerBase.name().toLowerCase()}",
482-
version: "${VersionProperties.elasticsearch}",
483-
retry: ShellRetry
484-
]
485-
)
456+
from(projectDir.resolve("src/docker/Dockerfile.cloud-ess")) {
457+
expand([
458+
base_image: "elasticsearch${DockerBase.CLOUD.suffix}:${architecture.classifier}"
459+
])
486460
filter SquashNewlinesFilter
487-
rename ~/Dockerfile\.ess$/, 'Dockerfile'
461+
rename ~/Dockerfile\.cloud-ess$/, 'Dockerfile'
488462
}
489463
}
490464

491465
final TaskProvider<DockerBuildTask> buildDockerImageTask =
492-
tasks.register(taskName("build", architecture, dockerBase, "DockerImage"), DockerBuildTask) {
493-
494-
DockerBase base = DockerBase.WOLFI
466+
tasks.register(taskName("build", architecture, base, "DockerImage"), DockerBuildTask) {
495467

496-
TaskProvider<DockerBuildTask> buildBaseTask = tasks.named(taskName("build", architecture, base, "DockerImage"))
497-
inputs.files(buildBaseTask)
468+
TaskProvider<DockerBuildTask> buildCloudTask = tasks.named(taskName("build", architecture, DockerBase.CLOUD, "DockerImage"))
469+
inputs.files(buildCloudTask)
498470

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

501473
noCache = buildParams.isCi()
502474
baseImages = []
503-
tags = generateTags(dockerBase, architecture)
475+
tags = generateTags(base, architecture)
504476
platforms.add(architecture.dockerPlatform)
505-
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(
506-
project.gradle.sharedServices,
507-
DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
508-
)
477+
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(project.gradle.sharedServices, DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME)
509478
onlyIf("$architecture supported") { serviceProvider.get().isArchitectureSupported(architecture) }
510479

511480
}
@@ -577,10 +546,7 @@ subprojects { Project subProject ->
577546
tarFile,
578547
"elasticsearch${base.suffix}:${architecture.classifier}"
579548
dependsOn(parent.path + ":" + buildTaskName)
580-
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(
581-
project.gradle.sharedServices,
582-
DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
583-
)
549+
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(project.gradle.sharedServices, DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME)
584550
onlyIf("$architecture supported") { serviceProvider.get().isArchitectureSupported(architecture) }
585551
}
586552

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM ${base_image} AS builder
2+
3+
USER root
4+
5+
COPY plugins/*.zip /opt/plugins/archive/
6+
7+
RUN chown root.root /opt/plugins/archive/*
8+
RUN chmod 0444 /opt/plugins/archive/*
9+
10+
FROM ${base_image}
11+
12+
COPY --from=builder /opt/plugins /opt/plugins
13+
ENV ES_PLUGIN_ARCHIVE_DIR /opt/plugins/archive

distribution/docker/src/docker/Dockerfile.ess

Lines changed: 0 additions & 44 deletions
This file was deleted.

qa/packaging/src/test/java/org/elasticsearch/packaging/test/DockerTests.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
* <li>The default image with a custom, small base image</li>
100100
* <li>A UBI-based image</li>
101101
* <li>Another UBI image for Iron Bank</li>
102-
* <li>A WOLFI-based image</li>
103102
* <li>Images for Cloud</li>
104103
* </ul>
105104
*/
@@ -207,9 +206,7 @@ public void test022InstallPluginsFromLocalArchive() {
207206
final String plugin = "analysis-icu";
208207
final Installation.Executables bin = installation.executables();
209208

210-
listPluginArchive().forEach(System.out::println);
211209
assertThat("Expected " + plugin + " to not be installed", listPlugins(), not(hasItems(plugin)));
212-
assertThat("Expected " + plugin + " available in archive", listPluginArchive(), hasSize(16));
213210

214211
// Stuff the proxy settings with garbage, so any attempt to go out to the internet would fail
215212
sh.getEnv()
@@ -389,7 +386,7 @@ public void test040JavaUsesTheOsProvidedKeystore() {
389386
if (distribution.packaging == Packaging.DOCKER_UBI || distribution.packaging == Packaging.DOCKER_IRON_BANK) {
390387
// In these images, the `cacerts` file ought to be a symlink here
391388
assertThat(path, equalTo("/etc/pki/ca-trust/extracted/java/cacerts"));
392-
} else if (distribution.packaging == Packaging.DOCKER_WOLFI || distribution.packaging == Packaging.DOCKER_CLOUD_ESS) {
389+
} else if (distribution.packaging == Packaging.DOCKER_WOLFI) {
393390
// In these images, the `cacerts` file ought to be a symlink here
394391
assertThat(path, equalTo("/etc/ssl/certs/java/cacerts"));
395392
} else {
@@ -1222,10 +1219,6 @@ private List<String> listPlugins() {
12221219
return sh.run(bin.pluginTool + " list").stdout().lines().collect(Collectors.toList());
12231220
}
12241221

1225-
private List<String> listPluginArchive() {
1226-
return sh.run("ls -lh /opt/plugins/archive").stdout().lines().collect(Collectors.toList());
1227-
}
1228-
12291222
/**
12301223
* Check that readiness listener works
12311224
*/

0 commit comments

Comments
 (0)