Skip to content

Commit

Permalink
Remove Cloud images from 7.16 (#80742)
Browse files Browse the repository at this point in the history
We don't actually need Cloud images before v8.0, so remove all
references and supporting code.
  • Loading branch information
pugnascotia committed Dec 9, 2021
1 parent 08bee54 commit d8df234
Show file tree
Hide file tree
Showing 21 changed files with 12 additions and 476 deletions.
9 changes: 0 additions & 9 deletions .ci/jobs.t/elastic+elasticsearch+periodic+release-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,5 @@
JAVA16_HOME=$HOME/.java/openjdk16
- shell: |
#!/usr/local/bin/runbld --redirect-stderr
# Fetch beats artifacts
export ES_VERSION=$(grep 'elasticsearch' build-tools-internal/version.properties | awk '{print $3}')
export BEATS_DIR=$(pwd)/distribution/docker/build/artifacts/beats
mkdir -p ${BEATS_DIR}
curl -o "${BEATS_DIR}/metricbeat-${ES_VERSION}-linux-x86_64.tar.gz" https://snapshots-no-kpi.elastic.co/downloads/beats/metricbeat/metricbeat-${ES_VERSION}-SNAPSHOT-linux-x86_64.tar.gz
curl -o "${BEATS_DIR}/filebeat-${ES_VERSION}-linux-x86_64.tar.gz" https://snapshots-no-kpi.elastic.co/downloads/beats/filebeat/filebeat-${ES_VERSION}-SNAPSHOT-linux-x86_64.tar.gz
$WORKSPACE/.ci/scripts/run-gradle.sh -Dbwc.checkout.align=true -Dbuild.snapshot=false \
-Dtests.jvm.argline=-Dbuild.snapshot=false -Dlicense.key=${WORKSPACE}/x-pack/license-tools/src/test/resources/public.key -Dbuild.id=deadbeef build
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,7 @@ public enum DockerBase {
UBI("docker.elastic.co/ubi8/ubi-minimal:latest", "-ubi8"),

// 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"),

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

// 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");
IRON_BANK("${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG}", "-ironbank");

private final String image;
private final String suffix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,6 @@ private static String distributionProjectName(ElasticsearchDistribution distribu
if (distribution.getType() == InternalElasticsearchDistributionTypes.DOCKER_IRONBANK) {
return projectName + "ironbank-docker" + archString + "-export";
}
if (distribution.getType() == InternalElasticsearchDistributionTypes.DOCKER_CLOUD) {
return projectName + "cloud-docker" + archString + "-export";
}
if (distribution.getType() == InternalElasticsearchDistributionTypes.DOCKER_CLOUD_ESS) {
return projectName + "cloud-ess-docker" + archString + "-export";
}
return projectName + distribution.getType().getName();
}

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@ public class InternalElasticsearchDistributionTypes {
public static ElasticsearchDistributionType DOCKER = new DockerElasticsearchDistributionType();
public static ElasticsearchDistributionType DOCKER_UBI = new DockerUbiElasticsearchDistributionType();
public static ElasticsearchDistributionType DOCKER_IRONBANK = new DockerIronBankElasticsearchDistributionType();
public static ElasticsearchDistributionType DOCKER_CLOUD = new DockerCloudElasticsearchDistributionType();
public static ElasticsearchDistributionType DOCKER_CLOUD_ESS = new DockerCloudEssElasticsearchDistributionType();

public static List<ElasticsearchDistributionType> ALL_INTERNAL = List.of(
DEB,
RPM,
DOCKER,
DOCKER_UBI,
DOCKER_IRONBANK,
DOCKER_CLOUD,
DOCKER_CLOUD_ESS
);
public static List<ElasticsearchDistributionType> ALL_INTERNAL = List.of(DEB, RPM, DOCKER, DOCKER_UBI, DOCKER_IRONBANK);
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.ALL_INTERNAL;
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.DEB;
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.DOCKER;
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.DOCKER_CLOUD;
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.DOCKER_CLOUD_ESS;
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.RPM;
Expand Down Expand Up @@ -236,8 +234,6 @@ private static Map<ElasticsearchDistributionType, TaskProvider<?>> lifecycleTask
lifecyleTasks.put(DOCKER, project.getTasks().register(taskPrefix + ".docker"));
lifecyleTasks.put(DOCKER_UBI, project.getTasks().register(taskPrefix + ".docker-ubi"));
lifecyleTasks.put(DOCKER_IRONBANK, project.getTasks().register(taskPrefix + ".docker-ironbank"));
lifecyleTasks.put(DOCKER_CLOUD, project.getTasks().register(taskPrefix + ".docker-cloud"));
lifecyleTasks.put(DOCKER_CLOUD_ESS, project.getTasks().register(taskPrefix + ".docker-cloud-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
105 changes: 2 additions & 103 deletions distribution/docker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,6 @@ repositories {
metadataSources { artifact() }
content { includeGroup 'krallin' }
}

// Cloud builds bundle some beats
ivy {
if (useLocalArtifacts) {
url "file://${buildDir}/artifacts/"
patternLayout {
artifact '/[organisation]/[module]-[revision]-linux-[classifier].[ext]'
}
} else {
url "https://${VersionProperties.isElasticsearchSnapshot() ? 'snapshots' : 'artifacts'}-no-kpi.elastic.co/"
patternLayout {
artifact '/downloads/[organization]/[module]/[module]-[revision]-linux-[classifier].[ext]'
}
}
metadataSources { artifact() }
content { includeGroup 'beats' }
}
}

testFixtures.useFixture()
Expand All @@ -59,24 +42,15 @@ configurations {
dockerSource
log4jConfig
tini
repositoryPlugins
nonRepositoryPlugins
filebeat
metricbeat
}

String beatsArch = Architecture.current() == Architecture.AARCH64 ? 'arm64' : 'x86_64'
String tiniArch = Architecture.current() == Architecture.AARCH64 ? 'arm64' : 'amd64'

dependencies {
aarch64DockerSource project(path: ":distribution:archives:linux-aarch64-tar", configuration: 'default')
dockerSource project(path: ":distribution:archives:linux-tar", configuration: 'default')
log4jConfig project(path: ":distribution", configuration: 'log4jConfig')
tini "krallin:tini:0.19.0:${tiniArch}"
repositoryPlugins project(path: ':plugins', configuration: 'repositoryPlugins')
nonRepositoryPlugins project(path: ':plugins', configuration: 'nonRepositoryPlugins')
filebeat "beats:filebeat:${VersionProperties.elasticsearch}:${beatsArch}@tar.gz"
metricbeat "beats:metricbeat:${VersionProperties.elasticsearch}:${beatsArch}@tar.gz"
}

ext.expansions = { Architecture architecture, DockerBase base ->
Expand Down Expand Up @@ -254,22 +228,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').forUseAtConfigurationTime().getOrNull()
boolean includeBeats = VersionProperties.isElasticsearchSnapshot() == true || buildId != null

from configurations.repositoryPlugins
if (includeBeats) {
from configurations.filebeat
from configurations.metricbeat
}
// 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"
}

onlyIf { Architecture.current() == architecture }
}

Expand Down Expand Up @@ -324,11 +282,7 @@ private static List<String> generateTags(DockerBase base) {
final String version = VersionProperties.elasticsearch

String image = "elasticsearch${base.suffix}"

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

return [
"${image}:test",
Expand Down Expand Up @@ -371,68 +325,19 @@ void addBuildDockerImageTask(Architecture architecture, DockerBase base) {
onlyIf { Architecture.current() == architecture }
}

if (base != DockerBase.IRON_BANK && base != DockerBase.CLOUD && base != DockerBase.CLOUD_ESS) {
if (base != DockerBase.IRON_BANK) {
tasks.named("assemble").configure {
dependsOn(buildDockerImageTask)
}
}
}

void addBuildEssDockerImageTask(Architecture architecture) {
DockerBase base = DockerBase.CLOUD_ESS
String arch = architecture == Architecture.AARCH64 ? '-aarch64' : ''
String contextDir = "${project.buildDir}/docker-context/elasticsearch${base.suffix}-${VersionProperties.elasticsearch}-docker-build-context${arch}"

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

final Path projectDir = project.projectDir.toPath()

into("plugins") {
from configurations.nonRepositoryPlugins
}

from(projectDir.resolve("src/docker/Dockerfile.cloud-ess")) {
expand([
base_image: "elasticsearch${DockerBase.CLOUD.suffix}:${VersionProperties.elasticsearch}"
])
filter SquashNewlinesFilter
rename ~/Dockerfile\.cloud-ess$/, 'Dockerfile'
}
}

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

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(base)

onlyIf { Architecture.current() == architecture }
}

tasks.named("assemble").configure {
dependsOn(buildDockerImageTask)
}
}

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

addBuildEssDockerImageTask(architecture)
}

/*
Expand All @@ -449,18 +354,12 @@ subprojects { Project subProject ->
base = DockerBase.UBI
} else if (subProject.name.contains('ironbank-')) {
base = DockerBase.IRON_BANK
} else if (subProject.name.contains('cloud-ess-')) {
base = DockerBase.CLOUD_ESS
} else if (subProject.name.contains('cloud-')) {
base = DockerBase.CLOUD
}

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' :
'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/cloud-ess-docker-export/build.gradle

This file was deleted.

0 comments on commit d8df234

Please sign in to comment.