Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Verify docker contexts #122897

Merged
merged 11 commits into from
Feb 15, 2022
11 changes: 11 additions & 0 deletions .buildkite/pipelines/docker_context.yml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions .buildkite/scripts/steps/docker_context/build.sh
Original file line number Diff line number Diff line change
@@ -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 .
2 changes: 2 additions & 0 deletions src/dev/build/tasks/os_packages/docker_generator/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -100,6 +101,7 @@ export async function runDockerGenerator(
ironbank: flags.ironbank,
architecture: flags.architecture,
revision: config.getBuildSha(),
publicArtifactSubdomain,
};

type HostArchitectureToDocker = Record<string, string>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface TemplateContext {
baseOSImage: string;
dockerBuildDate: string;
usePublicArtifact?: boolean;
publicArtifactSubdomain: string;
ubi?: boolean;
ubuntu?: boolean;
cloud?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}}

Expand Down