diff --git a/.buildkite/pipelines/docker_context.yml b/.buildkite/pipelines/docker_context.yml new file mode 100644 index 0000000000000..f85b895e4780b --- /dev/null +++ b/.buildkite/pipelines/docker_context.yml @@ -0,0 +1,11 @@ + steps: + - command: .buildkite/scripts/steps/docker_context/build.sh + label: 'Docker Build Context' + agents: + queue: n2-4 + timeout_in_minutes: 30 + key: build-docker-context + retry: + automatic: + - exit_status: '*' + limit: 1 \ No newline at end of file diff --git a/.buildkite/scripts/steps/docker_context/build.sh b/.buildkite/scripts/steps/docker_context/build.sh new file mode 100644 index 0000000000000..42152d005ffa9 --- /dev/null +++ b/.buildkite/scripts/steps/docker_context/build.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -euo pipefail + +.buildkite/scripts/bootstrap.sh + +echo "--- Create Kibana Docker contexts" +mkdir -p target +node scripts/build --skip-initialize --skip-generic-folders --skip-platform-folders --skip-archives + +echo "--- Build default context" +DOCKER_BUILD_FOLDER=$(mktemp -d) + +tar -xf target/kibana-[0-9]*-docker-build-context.tar.gz -C "$DOCKER_BUILD_FOLDER" +cd $DOCKER_BUILD_FOLDER +docker build . diff --git a/src/dev/build/tasks/os_packages/docker_generator/run.ts b/src/dev/build/tasks/os_packages/docker_generator/run.ts index 657efc8d7bd99..332605e926537 100644 --- a/src/dev/build/tasks/os_packages/docker_generator/run.ts +++ b/src/dev/build/tasks/os_packages/docker_generator/run.ts @@ -76,6 +76,7 @@ export async function runDockerGenerator( const dockerPush = config.getDockerPush(); const dockerTagQualifier = config.getDockerTagQualfiier(); + const publicArtifactSubdomain = config.isRelease ? 'artifacts' : 'snapshots-no-kpi'; const scope: TemplateContext = { artifactPrefix, @@ -100,6 +101,7 @@ export async function runDockerGenerator( ironbank: flags.ironbank, architecture: flags.architecture, revision: config.getBuildSha(), + publicArtifactSubdomain, }; type HostArchitectureToDocker = Record; diff --git a/src/dev/build/tasks/os_packages/docker_generator/template_context.ts b/src/dev/build/tasks/os_packages/docker_generator/template_context.ts index a715bfaa5d50d..524cfcef18284 100644 --- a/src/dev/build/tasks/os_packages/docker_generator/template_context.ts +++ b/src/dev/build/tasks/os_packages/docker_generator/template_context.ts @@ -22,6 +22,7 @@ export interface TemplateContext { baseOSImage: string; dockerBuildDate: string; usePublicArtifact?: boolean; + publicArtifactSubdomain: string; ubi?: boolean; ubuntu?: boolean; cloud?: boolean; diff --git a/src/dev/build/tasks/os_packages/docker_generator/templates/base/Dockerfile b/src/dev/build/tasks/os_packages/docker_generator/templates/base/Dockerfile index 54af1c41b2da9..95f6a56ef68cb 100644 --- a/src/dev/build/tasks/os_packages/docker_generator/templates/base/Dockerfile +++ b/src/dev/build/tasks/os_packages/docker_generator/templates/base/Dockerfile @@ -22,7 +22,7 @@ RUN {{packageManager}} update && DEBIAN_FRONTEND=noninteractive {{packageManager RUN cd /tmp && \ curl --retry 8 -s -L \ --output kibana.tar.gz \ - https://artifacts.elastic.co/downloads/kibana/{{artifactPrefix}}-$(arch).tar.gz && \ + https://{{publicArtifactSubdomain}}.elastic.co/downloads/kibana/{{artifactPrefix}}-$(arch).tar.gz && \ cd - {{/usePublicArtifact}}