[build] Replace Ubuntu base image with UBI (#212155)

https://buildkite.com/elastic/kibana-artifacts-snapshot/builds/5618
This commit is contained in:
Jon 2025-02-25 17:20:48 -06:00 committed by GitHub
parent c822109a49
commit 8debfd62fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 3 additions and 131 deletions

View file

@ -70,19 +70,6 @@ steps:
- exit_status: '*' - exit_status: '*'
limit: 1 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 - command: KIBANA_DOCKER_CONTEXT=wolfi .buildkite/scripts/steps/artifacts/docker_context.sh
label: 'Docker Context Verification' label: 'Docker Context Verification'
agents: agents:

View file

@ -31,7 +31,6 @@ if is_pr_with_label "ci:build-cloud-image"; then
--docker-push \ --docker-push \
--skip-docker-ubi \ --skip-docker-ubi \
--skip-docker-fips \ --skip-docker-fips \
--skip-docker-ubuntu \
--skip-docker-wolfi \ --skip-docker-wolfi \
--skip-docker-serverless \ --skip-docker-serverless \
--skip-docker-contexts --skip-docker-contexts

View file

@ -34,7 +34,6 @@ node scripts/build \
--docker-images \ --docker-images \
--docker-namespace="kibana-ci" \ --docker-namespace="kibana-ci" \
--docker-tag="$KIBANA_IMAGE_TAG" \ --docker-tag="$KIBANA_IMAGE_TAG" \
--skip-docker-ubuntu \
--skip-docker-wolfi \ --skip-docker-wolfi \
--skip-docker-ubi \ --skip-docker-ubi \
--skip-docker-cloud \ --skip-docker-cloud \

View file

@ -26,9 +26,6 @@ case $KIBANA_DOCKER_CONTEXT in
cloud) cloud)
DOCKER_CONTEXT_FILE="kibana-cloud-$FULL_VERSION-docker-build-context.tar.gz" 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) ironbank)
DOCKER_CONTEXT_FILE="kibana-ironbank-$FULL_VERSION-docker-build-context.tar.gz" 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' DOCKER_BUILD_ARGS='--build-arg BASE_REGISTRY=docker.elastic.co --build-arg BASE_IMAGE=ubi9/ubi --build-arg BASE_TAG=latest'

View file

@ -22,8 +22,6 @@ download "kibana-$FULL_VERSION-docker-image.tar.gz"
download "kibana-$FULL_VERSION-docker-image-aarch64.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.tar.gz"
download "kibana-cloud-$FULL_VERSION-docker-image-aarch64.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.tar.gz"
download "kibana-wolfi-$FULL_VERSION-docker-image-aarch64.tar.gz" download "kibana-wolfi-$FULL_VERSION-docker-image-aarch64.tar.gz"
@ -35,7 +33,6 @@ download "kibana-$FULL_VERSION-aarch64.rpm"
download "kibana-$FULL_VERSION-docker-build-context.tar.gz" download "kibana-$FULL_VERSION-docker-build-context.tar.gz"
download "kibana-cloud-$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-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-wolfi-$FULL_VERSION-docker-build-context.tar.gz"
download "kibana-$FULL_VERSION-linux-aarch64.tar.gz" download "kibana-$FULL_VERSION-linux-aarch64.tar.gz"

View file

@ -42,7 +42,6 @@ else
--docker-push \ --docker-push \
--skip-docker-ubi \ --skip-docker-ubi \
--skip-docker-fips \ --skip-docker-fips \
--skip-docker-ubuntu \
--skip-docker-wolfi \ --skip-docker-wolfi \
--skip-docker-serverless \ --skip-docker-serverless \
--skip-docker-contexts --skip-docker-contexts

View file

@ -22,7 +22,6 @@ node scripts/build \
--docker-tag-qualifier="$BUILDKITE_COMMIT" \ --docker-tag-qualifier="$BUILDKITE_COMMIT" \
--docker-push \ --docker-push \
--skip-docker-ubi \ --skip-docker-ubi \
--skip-docker-ubuntu \
--skip-docker-wolfi \ --skip-docker-wolfi \
--skip-docker-cloud \ --skip-docker-cloud \
--skip-docker-serverless \ --skip-docker-serverless \

View file

@ -37,7 +37,6 @@ it('build default and oss dist for current platform, without packages, by defaul
"createDockerFIPS": false, "createDockerFIPS": false,
"createDockerServerless": false, "createDockerServerless": false,
"createDockerUBI": false, "createDockerUBI": false,
"createDockerUbuntu": false,
"createDockerWolfi": false, "createDockerWolfi": false,
"createGenericFolders": true, "createGenericFolders": true,
"createPlatformFolders": true, "createPlatformFolders": true,
@ -79,7 +78,6 @@ it('builds packages if --all-platforms is passed', () => {
"createDockerFIPS": true, "createDockerFIPS": true,
"createDockerServerless": true, "createDockerServerless": true,
"createDockerUBI": true, "createDockerUBI": true,
"createDockerUbuntu": true,
"createDockerWolfi": true, "createDockerWolfi": true,
"createGenericFolders": true, "createGenericFolders": true,
"createPlatformFolders": true, "createPlatformFolders": true,
@ -121,7 +119,6 @@ it('limits packages if --rpm passed with --all-platforms', () => {
"createDockerFIPS": false, "createDockerFIPS": false,
"createDockerServerless": false, "createDockerServerless": false,
"createDockerUBI": false, "createDockerUBI": false,
"createDockerUbuntu": false,
"createDockerWolfi": false, "createDockerWolfi": false,
"createGenericFolders": true, "createGenericFolders": true,
"createPlatformFolders": true, "createPlatformFolders": true,
@ -163,7 +160,6 @@ it('limits packages if --deb passed with --all-platforms', () => {
"createDockerFIPS": false, "createDockerFIPS": false,
"createDockerServerless": false, "createDockerServerless": false,
"createDockerUBI": false, "createDockerUBI": false,
"createDockerUbuntu": false,
"createDockerWolfi": false, "createDockerWolfi": false,
"createGenericFolders": true, "createGenericFolders": true,
"createPlatformFolders": true, "createPlatformFolders": true,
@ -206,7 +202,6 @@ it('limits packages if --docker passed with --all-platforms', () => {
"createDockerFIPS": true, "createDockerFIPS": true,
"createDockerServerless": true, "createDockerServerless": true,
"createDockerUBI": true, "createDockerUBI": true,
"createDockerUbuntu": true,
"createDockerWolfi": true, "createDockerWolfi": true,
"createGenericFolders": true, "createGenericFolders": true,
"createPlatformFolders": true, "createPlatformFolders": true,
@ -256,7 +251,6 @@ it('limits packages if --docker passed with --skip-docker-ubi and --all-platform
"createDockerFIPS": true, "createDockerFIPS": true,
"createDockerServerless": true, "createDockerServerless": true,
"createDockerUBI": false, "createDockerUBI": false,
"createDockerUbuntu": true,
"createDockerWolfi": true, "createDockerWolfi": true,
"createGenericFolders": true, "createGenericFolders": true,
"createPlatformFolders": true, "createPlatformFolders": true,
@ -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', () => { it('limits packages if --all-platforms passed with --skip-docker-fips', () => {
expect(readCliArgs(['node', 'scripts/build', '--all-platforms', '--skip-docker-fips'])) expect(readCliArgs(['node', 'scripts/build', '--all-platforms', '--skip-docker-fips']))
.toMatchInlineSnapshot(` .toMatchInlineSnapshot(`
@ -342,7 +293,6 @@ it('limits packages if --all-platforms passed with --skip-docker-fips', () => {
"createDockerFIPS": false, "createDockerFIPS": false,
"createDockerServerless": true, "createDockerServerless": true,
"createDockerUBI": true, "createDockerUBI": true,
"createDockerUbuntu": true,
"createDockerWolfi": true, "createDockerWolfi": true,
"createGenericFolders": true, "createGenericFolders": true,
"createPlatformFolders": true, "createPlatformFolders": true,

View file

@ -31,7 +31,6 @@ export function readCliArgs(argv: string[]) {
'docker-push', 'docker-push',
'skip-docker-contexts', 'skip-docker-contexts',
'skip-docker-ubi', 'skip-docker-ubi',
'skip-docker-ubuntu',
'skip-docker-wolfi', 'skip-docker-wolfi',
'skip-docker-cloud', 'skip-docker-cloud',
'skip-docker-serverless', 'skip-docker-serverless',
@ -140,8 +139,6 @@ export function readCliArgs(argv: string[]) {
createCdnAssets: !Boolean(flags['skip-cdn-assets']), createCdnAssets: !Boolean(flags['skip-cdn-assets']),
createRpmPackage: isOsPackageDesired('rpm'), createRpmPackage: isOsPackageDesired('rpm'),
createDebPackage: isOsPackageDesired('deb'), createDebPackage: isOsPackageDesired('deb'),
createDockerUbuntu:
isOsPackageDesired('docker-images') && !Boolean(flags['skip-docker-ubuntu']),
createDockerWolfi: isOsPackageDesired('docker-images') && !Boolean(flags['skip-docker-wolfi']), createDockerWolfi: isOsPackageDesired('docker-images') && !Boolean(flags['skip-docker-wolfi']),
createDockerCloud: isOsPackageDesired('docker-images') && !Boolean(flags['skip-docker-cloud']), createDockerCloud: isOsPackageDesired('docker-images') && !Boolean(flags['skip-docker-cloud']),
createDockerServerless: createDockerServerless:

View file

@ -31,7 +31,6 @@ export interface BuildOptions {
createRpmPackage: boolean; createRpmPackage: boolean;
createDebPackage: boolean; createDebPackage: boolean;
createDockerUBI: boolean; createDockerUBI: boolean;
createDockerUbuntu: boolean;
createDockerWolfi: boolean; createDockerWolfi: boolean;
createDockerCloud: boolean; createDockerCloud: boolean;
createDockerServerless: boolean; createDockerServerless: boolean;
@ -146,11 +145,6 @@ export async function buildDistributables(log: ToolingLog, options: BuildOptions
await run(Tasks.CreateDockerUBI); 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) { if (options.createDockerWolfi) {
// control w/ --docker-images or --skip-docker-wolfi or --skip-os-packages // control w/ --docker-images or --skip-docker-wolfi or --skip-os-packages
await run(Tasks.CreateDockerWolfi); await run(Tasks.CreateDockerWolfi);

View file

@ -47,7 +47,6 @@ if (showHelp) {
--skip-canvas-shareable-runtime {dim Don't build the Canvas shareable runtime} --skip-canvas-shareable-runtime {dim Don't build the Canvas shareable runtime}
--skip-cdn-assets {dim Don't build CDN assets} --skip-cdn-assets {dim Don't build CDN assets}
--skip-docker-ubi {dim Don't build the docker ubi image} --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-wolfi {dim Don't build the docker wolfi image}
--skip-docker-fips {dim Don't build the docker fips image} --skip-docker-fips {dim Don't build the docker fips image}
--release {dim Produce a release-ready distributable} --release {dim Produce a release-ready distributable}

View file

@ -64,26 +64,6 @@ export const CreateRpmPackage: Task = {
}; };
const dockerBuildDate = new Date().toISOString(); 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 = { export const CreateDockerWolfi: Task = {
description: 'Creating Docker Wolfi image', description: 'Creating Docker Wolfi image',
@ -187,12 +167,6 @@ export const CreateDockerContexts: Task = {
description: 'Creating Docker build contexts', description: 'Creating Docker build contexts',
async run(config, log, build) { async run(config, log, build) {
await runDockerGenerator(config, log, build, {
baseImage: 'ubuntu',
context: true,
image: false,
dockerBuildDate,
});
await runDockerGenerator(config, log, build, { await runDockerGenerator(config, log, build, {
baseImage: 'wolfi', baseImage: 'wolfi',
context: true, context: true,

View file

@ -30,7 +30,7 @@ export async function runDockerGenerator(
build: Build, build: Build,
flags: { flags: {
architecture?: string; architecture?: string;
baseImage: 'none' | 'wolfi' | 'ubi' | 'ubuntu'; baseImage: 'none' | 'wolfi' | 'ubi';
context: boolean; context: boolean;
image: boolean; image: boolean;
ironbank?: boolean; ironbank?: boolean;
@ -41,7 +41,6 @@ export async function runDockerGenerator(
} }
) { ) {
let baseImageName = ''; let baseImageName = '';
if (flags.baseImage === 'ubuntu') baseImageName = 'ubuntu:20.04';
if (flags.baseImage === 'ubi') baseImageName = 'docker.elastic.co/ubi9/ubi-minimal:latest'; if (flags.baseImage === 'ubi') baseImageName = 'docker.elastic.co/ubi9/ubi-minimal:latest';
/** /**
* Renovate config contains a regex manager to automatically updates this Chainguard reference * Renovate config contains a regex manager to automatically updates this Chainguard reference
@ -54,7 +53,6 @@ export async function runDockerGenerator(
'docker.elastic.co/wolfi/chainguard-base:latest@sha256:0801a437e721bebdd2d5be62e3f63f60fc9d1d82efacabe4c5b8792d74ae7006'; 'docker.elastic.co/wolfi/chainguard-base:latest@sha256:0801a437e721bebdd2d5be62e3f63f60fc9d1d82efacabe4c5b8792d74ae7006';
let imageFlavor = ''; let imageFlavor = '';
if (flags.baseImage === 'ubi') imageFlavor += `-ubi`;
if (flags.baseImage === 'wolfi' && !flags.serverless && !flags.cloud) imageFlavor += `-wolfi`; if (flags.baseImage === 'wolfi' && !flags.serverless && !flags.cloud) imageFlavor += `-wolfi`;
if (flags.ironbank) imageFlavor += '-ironbank'; if (flags.ironbank) imageFlavor += '-ironbank';
if (flags.cloud) imageFlavor += '-cloud'; if (flags.cloud) imageFlavor += '-cloud';

View file

@ -25,7 +25,7 @@ export interface TemplateContext {
dockerBuildDate: string; dockerBuildDate: string;
usePublicArtifact?: boolean; usePublicArtifact?: boolean;
publicArtifactSubdomain: string; publicArtifactSubdomain: string;
baseImage: 'none' | 'ubi' | 'ubuntu' | 'wolfi'; baseImage: 'none' | 'ubi' | 'wolfi';
baseImageName: string; baseImageName: string;
cloud?: boolean; cloud?: boolean;
serverless?: boolean; serverless?: boolean;

View file

@ -14,9 +14,6 @@ FROM {{{baseImageName}}} AS builder
{{#ubi}} {{#ubi}}
RUN microdnf install -y findutils tar gzip{{#fips}} perl make gcc{{/fips}} RUN microdnf install -y findutils tar gzip{{#fips}} perl make gcc{{/fips}}
{{/ubi}} {{/ubi}}
{{#ubuntu}}
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y curl
{{/ubuntu}}
{{#wolfi}} {{#wolfi}}
RUN apk --no-cache add curl RUN apk --no-cache add curl
{{/wolfi}} {{/wolfi}}
@ -120,19 +117,6 @@ RUN for iter in {1..10}; do \
done; \ done; \
(exit $exit_code) (exit $exit_code)
{{/ubi}} {{/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}} {{#wolfi}}
RUN apk --no-cache add bash curl fontconfig font-liberation libstdc++ libnss findutils shadow ca-certificates RUN apk --no-cache add bash curl fontconfig font-liberation libstdc++ libnss findutils shadow ca-certificates
{{/wolfi}} {{/wolfi}}

View file

@ -19,7 +19,6 @@ function generator(options: TemplateContext) {
return Mustache.render(template.toString(), { return Mustache.render(template.toString(), {
wolfi: options.baseImage === 'wolfi', wolfi: options.baseImage === 'wolfi',
ubi: options.baseImage === 'ubi', ubi: options.baseImage === 'ubi',
ubuntu: options.baseImage === 'ubuntu',
opensslLegacyProvider: !(options.cloud || options.serverless || options.fips), opensslLegacyProvider: !(options.cloud || options.serverless || options.fips),
...options, ...options,
}); });

View file

@ -26,7 +26,7 @@ Build and push a Kibana image with the latest changes.
Choose a unique identifier for the build, then: 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 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> docker push docker.elastic.co/observability-ci/kibana:<UNIQUE_IDENTIFIER>
``` ```