Remove UBI-based Docker images (#50747)

This commit removes the UBI-based Docker images as we are not using this
work for now.
This commit is contained in:
Jason Tedor 2020-01-08 16:51:41 -05:00
parent 3273c366b5
commit 8d9ec1c66d
No known key found for this signature in database
GPG Key ID: FA89F05560F16BC5
7 changed files with 39 additions and 59 deletions

View File

@ -22,31 +22,29 @@ dependencies {
restSpec project(':rest-api-spec')
}
ext.expansions = { oss, ubi, local ->
ext.expansions = { oss, local ->
final String classifier = 'linux-x86_64'
final String elasticsearch = oss ? "elasticsearch-oss-${VersionProperties.elasticsearch}-${classifier}.tar.gz" : "elasticsearch-${VersionProperties.elasticsearch}-${classifier}.tar.gz"
return [
'base_image' : ubi ? 'registry.access.redhat.com/ubi7/ubi-minimal:7.7' : 'centos:7',
'build_date' : BuildParams.buildDate,
'elasticsearch' : elasticsearch,
'git_revision' : BuildParams.gitRevision,
'license' : oss ? 'Apache-2.0' : 'Elastic-License',
'package_manager' : ubi ? 'microdnf' : 'yum',
'source_elasticsearch': local ? "COPY $elasticsearch /opt/" : "RUN cd /opt && curl --retry 8 -s -L -O https://artifacts.elastic.co/downloads/elasticsearch/${elasticsearch} && cd -",
'version' : VersionProperties.elasticsearch
]
}
private static String buildPath(final boolean oss, final boolean ubi) {
return "build/${oss ? 'oss-' : ''}${ubi ? 'ubi-' : ''}docker"
private static String buildPath(final boolean oss) {
return "build/${oss ? 'oss-' : ''}docker"
}
private static String taskName(final String prefix, final boolean oss, final boolean ubi, final String suffix) {
return "${prefix}${oss ? 'Oss' : ''}${ubi ? 'Ubi' : ''}${suffix}"
private static String taskName(final String prefix, final boolean oss, final String suffix) {
return "${prefix}${oss ? 'Oss' : ''}${suffix}"
}
project.ext {
dockerBuildContext = { boolean oss, boolean ubi, boolean local ->
dockerBuildContext = { boolean oss, boolean local ->
copySpec {
into('bin') {
from project.projectDir.toPath().resolve("src/docker/bin")
@ -64,20 +62,20 @@ project.ext {
}
from(project.projectDir.toPath().resolve("src/docker/Dockerfile")) {
expand(expansions(oss, ubi, local))
expand(expansions(oss, local))
}
}
}
}
void addCopyDockerContextTask(final boolean oss, final boolean ubi) {
task(taskName("copy", oss, ubi, "DockerContext"), type: Sync) {
expansions(oss, ubi, true).findAll { it.key != 'build_date' }.each { k, v ->
void addCopyDockerContextTask(final boolean oss) {
task(taskName("copy", oss, "DockerContext"), type: Sync) {
expansions(oss, true).findAll { it.key != 'build_date' }.each { k, v ->
inputs.property(k, { v.toString() })
}
into buildPath(oss, ubi)
into buildPath(oss)
with dockerBuildContext(oss, ubi, true)
with dockerBuildContext(oss, true)
if (oss) {
from configurations.ossDockerSource
@ -149,25 +147,25 @@ task integTest(type: Test) {
check.dependsOn integTest
void addBuildDockerImage(final boolean oss, final boolean ubi) {
final Task buildDockerImageTask = task(taskName("build", oss, ubi, "DockerImage"), type: LoggedExec) {
inputs.files(tasks.named(taskName("copy", oss, ubi, "DockerContext")))
void addBuildDockerImage(final boolean oss) {
final Task buildDockerImageTask = task(taskName("build", oss, "DockerImage"), type: LoggedExec) {
inputs.files(tasks.named(taskName("copy", oss, "DockerContext")))
List<String> tags
if (oss) {
tags = [
"docker.elastic.co/elasticsearch/elasticsearch-oss${ubi ? '-ubi7' : ''}:${VersionProperties.elasticsearch}",
"elasticsearch-oss${ubi ? '-ubi7' : ''}:test"
"docker.elastic.co/elasticsearch/elasticsearch-oss:${VersionProperties.elasticsearch}",
"elasticsearch-oss:test"
]
} else {
tags = [
"elasticsearch${ubi ? '-ubi7' : ''}:${VersionProperties.elasticsearch}",
"docker.elastic.co/elasticsearch/elasticsearch${ubi ? '-ubi7' : ''}:${VersionProperties.elasticsearch}",
"docker.elastic.co/elasticsearch/elasticsearch${ubi ? '-ubi7' : ''}-full:${VersionProperties.elasticsearch}",
"elasticsearch${ubi ? '-ubi7' : ''}:test",
"elasticsearch:${VersionProperties.elasticsearch}",
"docker.elastic.co/elasticsearch/elasticsearch:${VersionProperties.elasticsearch}",
"docker.elastic.co/elasticsearch/elasticsearch-full:${VersionProperties.elasticsearch}",
"elasticsearch:test",
]
}
executable 'docker'
final List<String> dockerArgs = ['build', buildPath(oss, ubi), '--pull', '--no-cache']
final List<String> dockerArgs = ['build', buildPath(oss), '--pull', '--no-cache']
for (final String tag : tags) {
dockerArgs.add('--tag')
dockerArgs.add(tag)
@ -184,10 +182,8 @@ void addBuildDockerImage(final boolean oss, final boolean ubi) {
}
for (final boolean oss : [false, true]) {
for (final boolean ubi : [false, true]) {
addCopyDockerContextTask(oss, ubi)
addBuildDockerImage(oss, ubi)
}
addCopyDockerContextTask(oss)
addBuildDockerImage(oss)
}
// We build the images used in compose locally, but the pull command insists on using a repository
@ -206,11 +202,10 @@ subprojects { Project subProject ->
apply plugin: 'distribution'
final boolean oss = subProject.name.contains('oss-')
final boolean ubi = subProject.name.contains('ubi-')
def exportTaskName = taskName("export", oss, ubi, "DockerImage")
def buildTaskName = taskName("build", oss, ubi, "DockerImage")
def tarFile = "${parent.projectDir}/build/elasticsearch${oss ? '-oss' : ''}${ubi ? '-ubi7' : ''}_test.${VersionProperties.elasticsearch}.docker.tar"
def exportTaskName = taskName("export", oss, "DockerImage")
def buildTaskName = taskName("build", oss, "DockerImage")
def tarFile = "${parent.projectDir}/build/elasticsearch${oss ? '-oss' : ''}_test.${VersionProperties.elasticsearch}.docker.tar"
final Task exportDockerImageTask = task(exportTaskName, type: LoggedExec) {
executable 'docker'
@ -218,14 +213,14 @@ subprojects { Project subProject ->
args "save",
"-o",
tarFile,
"elasticsearch${oss ? '-oss' : ''}${ubi ? '-ubi7' : ''}:test"
"elasticsearch${oss ? '-oss' : ''}:test"
}
exportDockerImageTask.dependsOn(parent.tasks.getByName(buildTaskName))
artifacts.add('default', file(tarFile)) {
type 'tar'
name "elasticsearch${oss ? '-oss' : ''}${ubi ? '-ubi7' : ''}"
name "elasticsearch${oss ? '-oss' : ''}"
builtBy exportTaskName
}

View File

@ -5,7 +5,7 @@ task buildDockerBuildContext(type: Tar) {
compression = Compression.GZIP
archiveClassifier = "docker-build-context"
archiveBaseName = "elasticsearch"
with dockerBuildContext(false, false, false)
with dockerBuildContext(false, false)
}
assemble.dependsOn buildDockerBuildContext

View File

@ -5,7 +5,7 @@ task buildOssDockerBuildContext(type: Tar) {
compression = Compression.GZIP
archiveClassifier = "docker-build-context"
archiveBaseName = "elasticsearch-oss"
with dockerBuildContext(true, false, false)
with dockerBuildContext(true, false)
}
assemble.dependsOn buildOssDockerBuildContext

View File

@ -11,11 +11,11 @@
# Set gid=0 and make group perms==owner perms
################################################################################
FROM ${base_image} AS builder
FROM centos:7 AS builder
RUN for iter in {1..10}; do ${package_manager} update --setopt=tsflags=nodocs -y && \
${package_manager} install --setopt=tsflags=nodocs -y gzip shadow-utils tar && \
${package_manager} clean all && exit_code=0 && break || exit_code=\$? && echo "${package_manager} error: retry \$iter in 10s" && sleep 10; done; \
RUN for iter in {1..10}; do yum update --setopt=tsflags=nodocs -y && \
yum install --setopt=tsflags=nodocs -y gzip shadow-utils tar && \
yum clean all && exit_code=0 && break || exit_code=\$? && echo "yum error: retry \$iter in 10s" && sleep 10; done; \
(exit \$exit_code)
ENV PATH /usr/share/elasticsearch/bin:\$PATH
@ -41,13 +41,13 @@ RUN chmod 0660 config/elasticsearch.yml config/log4j2.properties
# Add entrypoint
################################################################################
FROM ${base_image}
FROM centos:7
ENV ELASTIC_CONTAINER true
RUN for iter in {1..10}; do ${package_manager} update --setopt=tsflags=nodocs -y && \
${package_manager} install --setopt=tsflags=nodocs -y nc shadow-utils zip unzip && \
${package_manager} clean all && exit_code=0 && break || exit_code=\$? && echo "${package_manager} error: retry \$iter in 10s" && sleep 10; done; \
RUN for iter in {1..10}; do yum update --setopt=tsflags=nodocs -y && \
yum install --setopt=tsflags=nodocs -y nc shadow-utils zip unzip && \
yum clean all && exit_code=0 && break || exit_code=\$? && echo "yum error: retry \$iter in 10s" && sleep 10; done; \
(exit \$exit_code)
RUN groupadd -g 1000 elasticsearch && \

View File

@ -1,11 +0,0 @@
apply plugin: 'base'
task buildUbiDockerBuildContext(type: Tar) {
extension = 'tar.gz'
compression = Compression.GZIP
archiveClassifier = "docker-build-context"
archiveBaseName = "elasticsearch-ubi7"
with dockerBuildContext(false, true, false)
}
assemble.dependsOn buildUbiDockerBuildContext

View File

@ -1,2 +0,0 @@
// This file is intentionally blank. All configuration of the
// export is done in the parent project.

View File

@ -36,8 +36,6 @@ List projects = [
'distribution:docker:docker-export',
'distribution:docker:oss-docker-build-context',
'distribution:docker:oss-docker-export',
'distribution:docker:ubi-docker-build-context',
'distribution:docker:ubi-docker-export',
'distribution:packages:oss-deb',
'distribution:packages:deb',
'distribution:packages:oss-no-jdk-deb',