Skip to content

Commit

Permalink
[build] Replace Ubuntu base image with UBI (elastic#212155)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbudz authored Feb 25, 2025
1 parent c822109 commit 8debfd6
Show file tree
Hide file tree
Showing 17 changed files with 3 additions and 131 deletions.
13 changes: 0 additions & 13 deletions .buildkite/pipelines/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,6 @@ steps:
- exit_status: '*'
limit: 1

- command: KIBANA_DOCKER_CONTEXT=ubi .buildkite/scripts/steps/artifacts/docker_context.sh
label: 'Docker Context Verification'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-2
timeout_in_minutes: 30
retry:
automatic:
- exit_status: '*'
limit: 1

- command: KIBANA_DOCKER_CONTEXT=wolfi .buildkite/scripts/steps/artifacts/docker_context.sh
label: 'Docker Context Verification'
agents:
Expand Down
1 change: 0 additions & 1 deletion .buildkite/scripts/build_kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ if is_pr_with_label "ci:build-cloud-image"; then
--docker-push \
--skip-docker-ubi \
--skip-docker-fips \
--skip-docker-ubuntu \
--skip-docker-wolfi \
--skip-docker-serverless \
--skip-docker-contexts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ node scripts/build \
--docker-images \
--docker-namespace="kibana-ci" \
--docker-tag="$KIBANA_IMAGE_TAG" \
--skip-docker-ubuntu \
--skip-docker-wolfi \
--skip-docker-ubi \
--skip-docker-cloud \
Expand Down
3 changes: 0 additions & 3 deletions .buildkite/scripts/steps/artifacts/docker_context.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ case $KIBANA_DOCKER_CONTEXT in
cloud)
DOCKER_CONTEXT_FILE="kibana-cloud-$FULL_VERSION-docker-build-context.tar.gz"
;;
ubi)
DOCKER_CONTEXT_FILE="kibana-ubi-$FULL_VERSION-docker-build-context.tar.gz"
;;
ironbank)
DOCKER_CONTEXT_FILE="kibana-ironbank-$FULL_VERSION-docker-build-context.tar.gz"
DOCKER_BUILD_ARGS='--build-arg BASE_REGISTRY=docker.elastic.co --build-arg BASE_IMAGE=ubi9/ubi --build-arg BASE_TAG=latest'
Expand Down
3 changes: 0 additions & 3 deletions .buildkite/scripts/steps/artifacts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ download "kibana-$FULL_VERSION-docker-image.tar.gz"
download "kibana-$FULL_VERSION-docker-image-aarch64.tar.gz"
download "kibana-cloud-$FULL_VERSION-docker-image.tar.gz"
download "kibana-cloud-$FULL_VERSION-docker-image-aarch64.tar.gz"
download "kibana-ubi-$FULL_VERSION-docker-image.tar.gz"
download "kibana-ubi-$FULL_VERSION-docker-image-aarch64.tar.gz"
download "kibana-wolfi-$FULL_VERSION-docker-image.tar.gz"
download "kibana-wolfi-$FULL_VERSION-docker-image-aarch64.tar.gz"

Expand All @@ -35,7 +33,6 @@ download "kibana-$FULL_VERSION-aarch64.rpm"
download "kibana-$FULL_VERSION-docker-build-context.tar.gz"
download "kibana-cloud-$FULL_VERSION-docker-build-context.tar.gz"
download "kibana-ironbank-$FULL_VERSION-docker-build-context.tar.gz"
download "kibana-ubi-$FULL_VERSION-docker-build-context.tar.gz"
download "kibana-wolfi-$FULL_VERSION-docker-build-context.tar.gz"

download "kibana-$FULL_VERSION-linux-aarch64.tar.gz"
Expand Down
1 change: 0 additions & 1 deletion .buildkite/scripts/steps/cloud/build_and_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ else
--docker-push \
--skip-docker-ubi \
--skip-docker-fips \
--skip-docker-ubuntu \
--skip-docker-wolfi \
--skip-docker-serverless \
--skip-docker-contexts
Expand Down
1 change: 0 additions & 1 deletion .buildkite/scripts/steps/fips/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ node scripts/build \
--docker-tag-qualifier="$BUILDKITE_COMMIT" \
--docker-push \
--skip-docker-ubi \
--skip-docker-ubuntu \
--skip-docker-wolfi \
--skip-docker-cloud \
--skip-docker-serverless \
Expand Down
50 changes: 0 additions & 50 deletions src/dev/build/args.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ it('build default and oss dist for current platform, without packages, by defaul
"createDockerFIPS": false,
"createDockerServerless": false,
"createDockerUBI": false,
"createDockerUbuntu": false,
"createDockerWolfi": false,
"createGenericFolders": true,
"createPlatformFolders": true,
Expand Down Expand Up @@ -79,7 +78,6 @@ it('builds packages if --all-platforms is passed', () => {
"createDockerFIPS": true,
"createDockerServerless": true,
"createDockerUBI": true,
"createDockerUbuntu": true,
"createDockerWolfi": true,
"createGenericFolders": true,
"createPlatformFolders": true,
Expand Down Expand Up @@ -121,7 +119,6 @@ it('limits packages if --rpm passed with --all-platforms', () => {
"createDockerFIPS": false,
"createDockerServerless": false,
"createDockerUBI": false,
"createDockerUbuntu": false,
"createDockerWolfi": false,
"createGenericFolders": true,
"createPlatformFolders": true,
Expand Down Expand Up @@ -163,7 +160,6 @@ it('limits packages if --deb passed with --all-platforms', () => {
"createDockerFIPS": false,
"createDockerServerless": false,
"createDockerUBI": false,
"createDockerUbuntu": false,
"createDockerWolfi": false,
"createGenericFolders": true,
"createPlatformFolders": true,
Expand Down Expand Up @@ -206,7 +202,6 @@ it('limits packages if --docker passed with --all-platforms', () => {
"createDockerFIPS": true,
"createDockerServerless": true,
"createDockerUBI": true,
"createDockerUbuntu": true,
"createDockerWolfi": true,
"createGenericFolders": true,
"createPlatformFolders": true,
Expand Down Expand Up @@ -256,7 +251,6 @@ it('limits packages if --docker passed with --skip-docker-ubi and --all-platform
"createDockerFIPS": true,
"createDockerServerless": true,
"createDockerUBI": false,
"createDockerUbuntu": true,
"createDockerWolfi": true,
"createGenericFolders": true,
"createPlatformFolders": true,
Expand Down Expand Up @@ -285,49 +279,6 @@ it('limits packages if --docker passed with --skip-docker-ubi and --all-platform
`);
});

it('limits packages if --all-platforms passed with --skip-docker-ubuntu', () => {
expect(readCliArgs(['node', 'scripts/build', '--all-platforms', '--skip-docker-ubuntu']))
.toMatchInlineSnapshot(`
Object {
"buildOptions": Object {
"buildCanvasShareableRuntime": true,
"createArchives": true,
"createCdnAssets": true,
"createDebPackage": true,
"createDockerCloud": true,
"createDockerContexts": true,
"createDockerFIPS": true,
"createDockerServerless": true,
"createDockerUBI": true,
"createDockerUbuntu": false,
"createDockerWolfi": true,
"createGenericFolders": true,
"createPlatformFolders": true,
"createRpmPackage": true,
"dockerContextUseLocalArtifact": null,
"dockerCrossCompile": false,
"dockerNamespace": null,
"dockerPush": false,
"dockerTag": null,
"dockerTagQualifier": null,
"downloadCloudDependencies": true,
"downloadFreshNode": true,
"eprRegistry": "snapshot",
"initialize": true,
"isRelease": false,
"targetAllPlatforms": true,
"targetServerlessPlatforms": false,
"versionQualifier": "",
"withExamplePlugins": false,
"withTestPlugins": false,
},
"log": <ToolingLog>,
"showHelp": false,
"unknownFlags": Array [],
}
`);
});

it('limits packages if --all-platforms passed with --skip-docker-fips', () => {
expect(readCliArgs(['node', 'scripts/build', '--all-platforms', '--skip-docker-fips']))
.toMatchInlineSnapshot(`
Expand All @@ -342,7 +293,6 @@ it('limits packages if --all-platforms passed with --skip-docker-fips', () => {
"createDockerFIPS": false,
"createDockerServerless": true,
"createDockerUBI": true,
"createDockerUbuntu": true,
"createDockerWolfi": true,
"createGenericFolders": true,
"createPlatformFolders": true,
Expand Down
3 changes: 0 additions & 3 deletions src/dev/build/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export function readCliArgs(argv: string[]) {
'docker-push',
'skip-docker-contexts',
'skip-docker-ubi',
'skip-docker-ubuntu',
'skip-docker-wolfi',
'skip-docker-cloud',
'skip-docker-serverless',
Expand Down Expand Up @@ -140,8 +139,6 @@ export function readCliArgs(argv: string[]) {
createCdnAssets: !Boolean(flags['skip-cdn-assets']),
createRpmPackage: isOsPackageDesired('rpm'),
createDebPackage: isOsPackageDesired('deb'),
createDockerUbuntu:
isOsPackageDesired('docker-images') && !Boolean(flags['skip-docker-ubuntu']),
createDockerWolfi: isOsPackageDesired('docker-images') && !Boolean(flags['skip-docker-wolfi']),
createDockerCloud: isOsPackageDesired('docker-images') && !Boolean(flags['skip-docker-cloud']),
createDockerServerless:
Expand Down
6 changes: 0 additions & 6 deletions src/dev/build/build_distributables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export interface BuildOptions {
createRpmPackage: boolean;
createDebPackage: boolean;
createDockerUBI: boolean;
createDockerUbuntu: boolean;
createDockerWolfi: boolean;
createDockerCloud: boolean;
createDockerServerless: boolean;
Expand Down Expand Up @@ -146,11 +145,6 @@ export async function buildDistributables(log: ToolingLog, options: BuildOptions
await run(Tasks.CreateDockerUBI);
}

if (options.createDockerUbuntu) {
// control w/ --docker-images or --skip-docker-ubuntu or --skip-os-packages
await run(Tasks.CreateDockerUbuntu);
}

if (options.createDockerWolfi) {
// control w/ --docker-images or --skip-docker-wolfi or --skip-os-packages
await run(Tasks.CreateDockerWolfi);
Expand Down
1 change: 0 additions & 1 deletion src/dev/build/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ if (showHelp) {
--skip-canvas-shareable-runtime {dim Don't build the Canvas shareable runtime}
--skip-cdn-assets {dim Don't build CDN assets}
--skip-docker-ubi {dim Don't build the docker ubi image}
--skip-docker-ubuntu {dim Don't build the docker ubuntu image}
--skip-docker-wolfi {dim Don't build the docker wolfi image}
--skip-docker-fips {dim Don't build the docker fips image}
--release {dim Produce a release-ready distributable}
Expand Down
26 changes: 0 additions & 26 deletions src/dev/build/tasks/os_packages/create_os_package_tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,6 @@ export const CreateRpmPackage: Task = {
};

const dockerBuildDate = new Date().toISOString();
export const CreateDockerUbuntu: Task = {
description: 'Creating Docker Ubuntu image',

async run(config, log, build) {
await runDockerGenerator(config, log, build, {
architecture: 'x64',
baseImage: 'ubuntu',
context: false,
image: true,
dockerBuildDate,
});
await runDockerGenerator(config, log, build, {
architecture: 'aarch64',
baseImage: 'ubuntu',
context: false,
image: true,
dockerBuildDate,
});
},
};

export const CreateDockerWolfi: Task = {
description: 'Creating Docker Wolfi image',
Expand Down Expand Up @@ -187,12 +167,6 @@ export const CreateDockerContexts: Task = {
description: 'Creating Docker build contexts',

async run(config, log, build) {
await runDockerGenerator(config, log, build, {
baseImage: 'ubuntu',
context: true,
image: false,
dockerBuildDate,
});
await runDockerGenerator(config, log, build, {
baseImage: 'wolfi',
context: true,
Expand Down
4 changes: 1 addition & 3 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,7 @@ export async function runDockerGenerator(
build: Build,
flags: {
architecture?: string;
baseImage: 'none' | 'wolfi' | 'ubi' | 'ubuntu';
baseImage: 'none' | 'wolfi' | 'ubi';
context: boolean;
image: boolean;
ironbank?: boolean;
Expand All @@ -41,7 +41,6 @@ export async function runDockerGenerator(
}
) {
let baseImageName = '';
if (flags.baseImage === 'ubuntu') baseImageName = 'ubuntu:20.04';
if (flags.baseImage === 'ubi') baseImageName = 'docker.elastic.co/ubi9/ubi-minimal:latest';
/**
* Renovate config contains a regex manager to automatically updates this Chainguard reference
Expand All @@ -54,7 +53,6 @@ export async function runDockerGenerator(
'docker.elastic.co/wolfi/chainguard-base:latest@sha256:0801a437e721bebdd2d5be62e3f63f60fc9d1d82efacabe4c5b8792d74ae7006';

let imageFlavor = '';
if (flags.baseImage === 'ubi') imageFlavor += `-ubi`;
if (flags.baseImage === 'wolfi' && !flags.serverless && !flags.cloud) imageFlavor += `-wolfi`;
if (flags.ironbank) imageFlavor += '-ironbank';
if (flags.cloud) imageFlavor += '-cloud';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface TemplateContext {
dockerBuildDate: string;
usePublicArtifact?: boolean;
publicArtifactSubdomain: string;
baseImage: 'none' | 'ubi' | 'ubuntu' | 'wolfi';
baseImage: 'none' | 'ubi' | 'wolfi';
baseImageName: string;
cloud?: boolean;
serverless?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ FROM {{{baseImageName}}} AS builder
{{#ubi}}
RUN microdnf install -y findutils tar gzip{{#fips}} perl make gcc{{/fips}}
{{/ubi}}
{{#ubuntu}}
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y curl
{{/ubuntu}}
{{#wolfi}}
RUN apk --no-cache add curl
{{/wolfi}}
Expand Down Expand Up @@ -120,19 +117,6 @@ RUN for iter in {1..10}; do \
done; \
(exit $exit_code)
{{/ubi}}
{{#ubuntu}}
RUN for iter in {1..10}; do \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
fontconfig fonts-liberation libnss3 curl ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && exit_code=0 && break || exit_code=$? && echo "apt-get error: retry $iter in 10s" && \
sleep 10; \
done; \
(exit $exit_code)
{{/ubuntu}}
{{#wolfi}}
RUN apk --no-cache add bash curl fontconfig font-liberation libstdc++ libnss findutils shadow ca-certificates
{{/wolfi}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ function generator(options: TemplateContext) {
return Mustache.render(template.toString(), {
wolfi: options.baseImage === 'wolfi',
ubi: options.baseImage === 'ubi',
ubuntu: options.baseImage === 'ubuntu',
opensslLegacyProvider: !(options.cloud || options.serverless || options.fips),
...options,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Build and push a Kibana image with the latest changes.
Choose a unique identifier for the build, then:

```
node scripts/build --docker-images --skip-docker-ubi --skip-docker-ubuntu --skip-docker-fips
node scripts/build --docker-images --skip-docker-ubi --skip-docker-fips
docker tag docker.elastic.co/kibana-ci/kibana-cloud:8.7.0-SNAPSHOT docker.elastic.co/observability-ci/kibana:<UNIQUE_IDENTIFIER>
docker push docker.elastic.co/observability-ci/kibana:<UNIQUE_IDENTIFIER>
```
Expand Down

0 comments on commit 8debfd6

Please sign in to comment.