Skip to content

Commit

Permalink
Fixes for Iron Bank (elastic#76087)
Browse files Browse the repository at this point in the history
* Fixes for Iron Bank

* Add placeholder for ES tgz checksum
  • Loading branch information
pugnascotia committed Aug 5, 2021
1 parent ee66de9 commit 2df1b4d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 24 deletions.
43 changes: 26 additions & 17 deletions distribution/docker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ ext.expansions = { Architecture architecture, DockerBase base ->
String buildArgs = ''
if (base == DockerBase.IRON_BANK) {
buildArgs = """
ARG BASE_REGISTRY=nexus-docker-secure.levelup-nexus.svc.cluster.local:18082
ARG BASE_IMAGE=redhat/ubi/ubi8
ARG BASE_TAG=8.3
ARG BASE_REGISTRY=registry1.dso.mil
ARG BASE_IMAGE=ironbank/redhat/ubi/ubi8
ARG BASE_TAG=8.4
"""
}

Expand All @@ -68,7 +68,7 @@ ARG BASE_TAG=8.3
'build_date' : BuildParams.buildDate,
'config_dir' : base == DockerBase.IRON_BANK ? 'scripts' : 'config',
'git_revision' : BuildParams.gitRevision,
'license' : 'Elastic-License-2.0',
'license' : base == DockerBase.IRON_BANK ? 'Elastic License 1.0' : 'Elastic-License-2.0',
'package_manager' : base == DockerBase.UBI ? 'microdnf' : 'yum',
'docker_base' : base.name().toLowerCase(),
'version' : VersionProperties.elasticsearch,
Expand Down Expand Up @@ -202,20 +202,27 @@ void addBuildDockerContextTask(Architecture architecture, DockerBase base) {
String configDirectory = base == DockerBase.IRON_BANK ? 'scripts' : 'config'
String arch = architecture == Architecture.AARCH64 ? '-aarch64' : ''

tasks.register(taskName('build', architecture, base, 'DockerContext'), Tar) {
archiveExtension = 'tar.gz'
compression = Compression.GZIP
archiveClassifier = "docker-build-context${arch}"
archiveBaseName = "elasticsearch${base.suffix}"
with dockerBuildContext(architecture, base)

into(configDirectory) {
from(configurations.log4jConfig) {
filter TransformLog4jConfigFilter
final TaskProvider<Tar> buildDockerContextTask =
tasks.register(taskName('build', architecture, base, 'DockerContext'), Tar) {
archiveExtension = 'tar.gz'
compression = Compression.GZIP
archiveClassifier = "docker-build-context${arch}"
archiveBaseName = "elasticsearch${base.suffix}"
with dockerBuildContext(architecture, base)

into(configDirectory) {
from(configurations.log4jConfig) {
filter TransformLog4jConfigFilter
}
}

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

onlyIf { Architecture.current() == architecture }
if (base == DockerBase.IRON_BANK) {
tasks.named("assemble").configure {
dependsOn(buildDockerContextTask)
}
}
}

Expand Down Expand Up @@ -303,8 +310,10 @@ void addBuildDockerImageTask(Architecture architecture, DockerBase base) {
onlyIf { Architecture.current() == architecture }
}

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

Expand Down
15 changes: 10 additions & 5 deletions distribution/docker/src/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,17 @@ FROM ${base_image} AS builder
RUN mkdir /usr/share/elasticsearch
WORKDIR /usr/share/elasticsearch
<% /*
Fetch the appropriate Elasticsearch distribution for this architecture.
Keep this command on one line - it is replaced with a `COPY` during local builds.
It uses the `arch` command to fetch the correct distro for the build machine.
*/ %>
<% if (docker_base == "iron_bank") {
// Iron Bank always copies the local artifact
%>
COPY elasticsearch-${version}-linux-x86_64.tar.gz /opt/elasticsearch.tar.gz
<% } else {
// Fetch the appropriate Elasticsearch distribution for this architecture.
// Keep this command on one line - it is replaced with a `COPY` during local builds.
// It uses the `arch` command to fetch the correct distro for the build machine.
%>
RUN curl --retry 10 -S -L --output /opt/elasticsearch.tar.gz https://artifacts-no-kpi.elastic.co/downloads/elasticsearch/elasticsearch-${version}-linux-\$(arch).tar.gz
<% } %>
RUN tar -zxf /opt/elasticsearch.tar.gz --strip-components=1
Expand Down
14 changes: 12 additions & 2 deletions distribution/docker/src/docker/iron_bank/hardening_manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ labels:
resources:
- filename: "elasticsearch-${version}-linux-x86_64.tar.gz"
url: "<artifact_path>/elasticsearch-${version}-linux-x86_64.tar.gz"
validation:
type: "sha512"
value: "<insert SHA 512 here>"
- filename: "tini"
url: "https://github.com/krallin/tini/releases/download/v0.19.0/tini-amd64"
validation:
Expand All @@ -47,7 +50,14 @@ resources:

# List of project maintainers
maintainers:
- name: "Nassim Kammah"
email: "[email protected]"
- name: "Rory Hunter"
email: "[email protected]"
username: "rory"
- email: "[email protected]"
name: "Alexander Klepal"
username: "alexander.klepal"
cht_member: true
- email: "[email protected]"
name: "Yalabe Dukuly"
username: "yalabe.dukuly"
cht_member: true

0 comments on commit 2df1b4d

Please sign in to comment.