Skip to content

Commit

Permalink
[7.17] [docker] Add ubi9 image (#170260)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbudz authored Oct 31, 2023
1 parent 84071f1 commit a3a94fe
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 23 deletions.
22 changes: 21 additions & 1 deletion .buildkite/pipelines/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,27 @@ steps:
- exit_status: '*'
limit: 1

- command: .buildkite/scripts/steps/artifacts/docker_context.sh
- command: KIBANA_DOCKER_CONTEXT=default .buildkite/scripts/steps/artifacts/docker_context.sh
label: 'Docker Context Verification'
agents:
queue: n2-2
timeout_in_minutes: 30
retry:
automatic:
- exit_status: '*'
limit: 1

- command: KIBANA_DOCKER_CONTEXT=ubi8 .buildkite/scripts/steps/artifacts/docker_context.sh
label: 'Docker Context Verification'
agents:
queue: n2-2
timeout_in_minutes: 30
retry:
automatic:
- exit_status: '*'
limit: 1

- command: KIBANA_DOCKER_CONTEXT=ubi9 .buildkite/scripts/steps/artifacts/docker_context.sh
label: 'Docker Context Verification'
agents:
queue: n2-2
Expand Down
11 changes: 0 additions & 11 deletions .buildkite/pipelines/docker_context.yml

This file was deleted.

10 changes: 9 additions & 1 deletion .buildkite/scripts/steps/artifacts/docker_context.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ node scripts/build --skip-initialize --skip-generic-folders --skip-platform-fold
echo "--- Setup default context"
DOCKER_BUILD_FOLDER=$(mktemp -d)

tar -xf target/kibana-[0-9]*-docker-build-context.tar.gz -C "$DOCKER_BUILD_FOLDER"
if [[ "$KIBANA_DOCKER_CONTEXT" == "default" ]]; then
DOCKER_CONTEXT_FILE="kibana-$FULL_VERSION-docker-build-context.tar.gz"
elif [[ "$KIBANA_DOCKER_CONTEXT" == "ubi8" ]]; then
DOCKER_CONTEXT_FILE="kibana-ubi8-$FULL_VERSION-docker-build-context.tar.gz"
elif [[ "$KIBANA_DOCKER_CONTEXT" == "ubi9" ]]; then
DOCKER_CONTEXT_FILE="kibana-ubi9-$FULL_VERSION-docker-build-context.tar.gz"
fi

tar -xf "target/$DOCKER_CONTEXT_FILE" -C "$DOCKER_BUILD_FOLDER"
cd $DOCKER_BUILD_FOLDER

buildkite-agent artifact download "kibana-$FULL_VERSION-linux-x86_64.tar.gz" . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}"
Expand Down
16 changes: 13 additions & 3 deletions src/dev/build/tasks/os_packages/create_os_package_tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ export const CreateDockerUBI: Task = {
await runDockerGenerator(config, log, build, {
architecture: 'x64',
context: false,
ubi: true,
ubi8: true,
image: true,
});
await runDockerGenerator(config, log, build, {
architecture: 'x64',
context: false,
ubi9: true,
image: true,
});
},
Expand Down Expand Up @@ -115,9 +121,13 @@ export const CreateDockerContexts: Task = {
image: false,
dockerBuildDate,
});

await runDockerGenerator(config, log, build, {
ubi: true,
ubi8: true,
context: true,
image: false,
});
await runDockerGenerator(config, log, build, {
ubi9: true,
context: true,
image: false,
});
Expand Down
13 changes: 8 additions & 5 deletions src/dev/build/tasks/os_packages/docker_generator/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export async function runDockerGenerator(
architecture?: string;
context: boolean;
image: boolean;
ubi?: boolean;
ubi8?: boolean;
ubi9?: boolean;
ubuntu?: boolean;
ironbank?: boolean;
cloud?: boolean;
Expand All @@ -39,11 +40,12 @@ export async function runDockerGenerator(
) {
let baseOSImage = '';
if (flags.ubuntu) baseOSImage = 'ubuntu:22.04';
if (flags.ubi) baseOSImage = 'docker.elastic.co/ubi8/ubi-minimal:latest';
const ubiVersionTag = 'ubi8';
if (flags.ubi8) baseOSImage = 'docker.elastic.co/ubi8/ubi-minimal:latest';
if (flags.ubi9) baseOSImage = 'docker.elastic.co/ubi9/ubi-minimal:latest';

let imageFlavor = '';
if (flags.ubi) imageFlavor += `-${ubiVersionTag}`;
if (flags.ubi8) imageFlavor += '-ubi8';
if (flags.ubi9) imageFlavor += '-ubi9';
if (flags.ironbank) imageFlavor += '-ironbank';
if (flags.cloud) imageFlavor += '-cloud';

Expand Down Expand Up @@ -89,7 +91,8 @@ export async function runDockerGenerator(
dockerCrossCompile,
baseOSImage,
dockerBuildDate,
ubi: flags.ubi,
ubi8: flags.ubi8,
ubi9: flags.ubi9,
ubuntu: flags.ubuntu,
cloud: flags.cloud,
metricbeatTarball,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export interface TemplateContext {
dockerBuildDate: string;
usePublicArtifact?: boolean;
publicArtifactSubdomain: string;
ubi?: boolean;
ubi8?: boolean;
ubi9?: boolean;
ubuntu?: boolean;
cloud?: boolean;
metricbeatTarball?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import { TemplateContext } from '../template_context';
function generator(options: TemplateContext) {
const dir = options.ironbank ? 'ironbank' : 'base';
const template = readFileSync(resolve(__dirname, dir, './Dockerfile'));
const ubi = Boolean(options.ubi8 || options.ubi9);
return Mustache.render(template.toString(), {
packageManager: options.ubi ? 'microdnf' : 'apt-get',
packageManager: ubi ? 'microdnf' : 'apt-get',
opensslLegacyProvider: !options.cloud,
ubi,
...options,
});
}
Expand Down

0 comments on commit a3a94fe

Please sign in to comment.