Skip to content

Commit b5b9d02

Browse files
breskebysarog
authored andcommitted
[8.17] Revert cloud wolfi migration (elastic#119068)
This reverts the wolfi migration for cloud ess docker images.
1 parent 08283f1 commit b5b9d02

File tree

9 files changed

+56
-133
lines changed

9 files changed

+56
-133
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: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,18 @@ public enum DockerBase {
2121
// The Iron Bank base image is UBI (albeit hardened), but we are required to parameterize the Docker build
2222
IRON_BANK("${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG}", "-ironbank", "yum"),
2323

24+
// Based on CLOUD above, with more extras. We don't set a base image because
25+
// we programmatically extend from the Cloud image.
26+
CLOUD_ESS(null, "-cloud-ess", "apt-get"),
27+
2428
// Chainguard based wolfi image with latest jdk
2529
// This is usually updated via renovatebot
2630
// spotless:off
2731
WOLFI("docker.elastic.co/wolfi/chainguard-base:latest@sha256:bfdeddb33330a281950c2a54adef991dbbe6a42832bc505d13b11beaf50ae73f",
2832
"-wolfi",
2933
"apk"
30-
),
34+
);
3135
// spotless:on
32-
33-
// Based on WOLFI above, with more extras. We don't set a base image because
34-
// we programmatically extend from the wolfi image.
35-
CLOUD_ESS(null, "-cloud-ess", "apk");
36-
3736
private final String image;
3837
private final String suffix;
3938
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: 25 additions & 59 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 {
@@ -327,9 +326,9 @@ void addTransformDockerContextTask(Architecture architecture, DockerBase base) {
327326
into "${project.buildDir}/docker-context/${archiveName}"
328327

329328
// Since we replaced the remote URL in the Dockerfile, copy in the required file
330-
if (base == DockerBase.IRON_BANK) {
329+
if(base == DockerBase.IRON_BANK) {
331330
from(architecture == Architecture.AARCH64 ? configurations.aarch64DockerSourceTar : configurations.dockerSourceTar)
332-
from(configurations.tini) {
331+
from (configurations.tini) {
333332
rename { _ -> 'tini' }
334333
}
335334
} else {
@@ -339,10 +338,7 @@ void addTransformDockerContextTask(Architecture architecture, DockerBase base) {
339338
expansions(architecture, base).findAll { it.key != 'build_date' }.each { k, v ->
340339
inputs.property(k, { v.toString() })
341340
}
342-
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(
343-
project.gradle.sharedServices,
344-
DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
345-
)
341+
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(project.gradle.sharedServices, DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME)
346342
onlyIf("$architecture supported") { serviceProvider.get().isArchitectureSupported(architecture) }
347343
}
348344

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

368364
String namespace = 'elasticsearch'
369-
if (base == base == DockerBase.CLOUD_ESS) {
365+
if (base == DockerBase.CLOUD_ESS) {
370366
namespace += '-ci'
371367
}
372368

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

419-
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(
420-
project.gradle.sharedServices,
421-
DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
422-
)
415+
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(project.gradle.sharedServices, DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME)
423416
onlyIf("$architecture supported") { serviceProvider.get().isArchitectureSupported(architecture) }
424417

425418
}
@@ -432,12 +425,12 @@ void addBuildDockerImageTask(Architecture architecture, DockerBase base) {
432425
}
433426

434427
void addBuildEssDockerImageTask(Architecture architecture) {
435-
DockerBase dockerBase = DockerBase.CLOUD_ESS
428+
DockerBase base = DockerBase.CLOUD_ESS
436429
String arch = architecture == Architecture.AARCH64 ? '-aarch64' : ''
437-
String contextDir = "${project.buildDir}/docker-context/elasticsearch${dockerBase.suffix}-${VersionProperties.elasticsearch}-docker-build-context${arch}"
430+
String contextDir = "${project.buildDir}/docker-context/elasticsearch${base.suffix}-${VersionProperties.elasticsearch}-docker-build-context${arch}"
438431

439432
final TaskProvider<Sync> buildContextTask =
440-
tasks.register(taskName('build', architecture, dockerBase, 'DockerContext'), Sync) {
433+
tasks.register(taskName('build', architecture, base, 'DockerContext'), Sync) {
441434
into contextDir
442435

443436
final Path projectDir = project.projectDir.toPath()
@@ -446,52 +439,28 @@ void addBuildEssDockerImageTask(Architecture architecture) {
446439
from configurations.allPlugins
447440
}
448441

449-
// If we're performing a release build, but `build.id` hasn't been set, we can
450-
// infer that we're not at the Docker building stage of the build, and therefore
451-
// we should skip the beats part of the build.
452-
String buildId = providers.systemProperty('build.id').getOrNull()
453-
boolean includeBeats = VersionProperties.isElasticsearchSnapshot() == true || buildId != null || useDra
454-
455-
if (includeBeats) {
456-
from configurations.getByName("filebeat_${architecture.classifier}")
457-
from configurations.getByName("metricbeat_${architecture.classifier}")
458-
}
459-
// For some reason, the artifact name can differ depending on what repository we used.
460-
rename ~/((?:file|metric)beat)-.*\.tar\.gz$/, "\$1-${VersionProperties.elasticsearch}.tar.gz"
461-
462-
String baseSuffix = DockerBase.WOLFI.suffix
463-
from(projectDir.resolve("src/docker/Dockerfile.ess")) {
464-
expand(
465-
[
466-
base_image: "elasticsearch${baseSuffix}:${architecture.classifier}",
467-
docker_base: "${dockerBase.name().toLowerCase()}",
468-
version: "${VersionProperties.elasticsearch}",
469-
retry: ShellRetry
470-
]
471-
)
442+
from(projectDir.resolve("src/docker/Dockerfile.cloud-ess")) {
443+
expand([
444+
base_image: "elasticsearch${DockerBase.CLOUD.suffix}:${architecture.classifier}"
445+
])
472446
filter SquashNewlinesFilter
473-
rename ~/Dockerfile\.ess$/, 'Dockerfile'
447+
rename ~/Dockerfile\.cloud-ess$/, 'Dockerfile'
474448
}
475449
}
476450

477451
final TaskProvider<DockerBuildTask> buildDockerImageTask =
478-
tasks.register(taskName("build", architecture, dockerBase, "DockerImage"), DockerBuildTask) {
479-
480-
DockerBase base = DockerBase.WOLFI
452+
tasks.register(taskName("build", architecture, base, "DockerImage"), DockerBuildTask) {
481453

482-
TaskProvider<DockerBuildTask> buildBaseTask = tasks.named(taskName("build", architecture, base, "DockerImage"))
483-
inputs.files(buildBaseTask)
454+
TaskProvider<DockerBuildTask> buildCloudTask = tasks.named(taskName("build", architecture, DockerBase.CLOUD, "DockerImage"))
455+
inputs.files(buildCloudTask)
484456

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

487459
noCache = buildParams.isCi()
488460
baseImages = []
489-
tags = generateTags(dockerBase, architecture)
461+
tags = generateTags(base, architecture)
490462
platforms.add(architecture.dockerPlatform)
491-
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(
492-
project.gradle.sharedServices,
493-
DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
494-
)
463+
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(project.gradle.sharedServices, DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME)
495464
onlyIf("$architecture supported") { serviceProvider.get().isArchitectureSupported(architecture) }
496465

497466
}
@@ -542,7 +511,7 @@ subprojects { Project subProject ->
542511
(base == DockerBase.IRON_BANK ? 'ironbank.tar' :
543512
(base == DockerBase.CLOUD_ESS ? 'cloud-ess.tar' :
544513
(base == DockerBase.WOLFI ? 'wolfi.tar' :
545-
'docker.tar')))
514+
'docker.tar')))
546515
final String artifactName = "elasticsearch${arch}${base.suffix}_test"
547516

548517
final String exportTaskName = taskName("export", architecture, base, 'DockerImage')
@@ -558,10 +527,7 @@ subprojects { Project subProject ->
558527
tarFile,
559528
"elasticsearch${base.suffix}:${architecture.classifier}"
560529
dependsOn(parent.path + ":" + buildTaskName)
561-
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(
562-
project.gradle.sharedServices,
563-
DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
564-
)
530+
Provider<DockerSupportService> serviceProvider = GradleUtils.getBuildService(project.gradle.sharedServices, DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME)
565531
onlyIf("$architecture supported") { serviceProvider.get().isArchitectureSupported(architecture) }
566532
}
567533

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: 2 additions & 9 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
*/
@@ -204,9 +203,7 @@ public void test022InstallPluginsFromLocalArchive() {
204203
final String plugin = "analysis-icu";
205204
final Installation.Executables bin = installation.executables();
206205

207-
listPluginArchive().forEach(System.out::println);
208206
assertThat("Expected " + plugin + " to not be installed", listPlugins(), not(hasItems(plugin)));
209-
assertThat("Expected " + plugin + " available in archive", listPluginArchive(), hasSize(16));
210207

211208
// Stuff the proxy settings with garbage, so any attempt to go out to the internet would fail
212209
sh.getEnv()
@@ -386,7 +383,7 @@ public void test040JavaUsesTheOsProvidedKeystore() {
386383
if (distribution.packaging == Packaging.DOCKER_UBI || distribution.packaging == Packaging.DOCKER_IRON_BANK) {
387384
// In these images, the `cacerts` file ought to be a symlink here
388385
assertThat(path, equalTo("/etc/pki/ca-trust/extracted/java/cacerts"));
389-
} else if (distribution.packaging == Packaging.DOCKER_WOLFI || distribution.packaging == Packaging.DOCKER_CLOUD_ESS) {
386+
} else if (distribution.packaging == Packaging.DOCKER_WOLFI) {
390387
// In these images, the `cacerts` file ought to be a symlink here
391388
assertThat(path, equalTo("/etc/ssl/certs/java/cacerts"));
392389
} else {
@@ -1113,7 +1110,7 @@ public void test170DefaultShellIsBash() {
11131110
*/
11141111
public void test171AdditionalCliOptionsAreForwarded() throws Exception {
11151112
assumeTrue(
1116-
"Does not apply to Cloud ESS images, because they don't use the default entrypoint",
1113+
"Does not apply to Cloud ess images, because they don't use the default entrypoint",
11171114
distribution().packaging != Packaging.DOCKER_CLOUD_ESS
11181115
);
11191116

@@ -1219,10 +1216,6 @@ private List<String> listPlugins() {
12191216
return sh.run(bin.pluginTool + " list").stdout().lines().collect(Collectors.toList());
12201217
}
12211218

1222-
private List<String> listPluginArchive() {
1223-
return sh.run("ls -lh /opt/plugins/archive").stdout().lines().collect(Collectors.toList());
1224-
}
1225-
12261219
/**
12271220
* Check that readiness listener works
12281221
*/

0 commit comments

Comments
 (0)