Skip to content

Commit

Permalink
[ci] Verify docker contexts (elastic#122897)
Browse files Browse the repository at this point in the history
* [ci] Verify docker contexts

* bootstrap

* debug

* mkdir target

* change subdomain if snapshot

* move to separate pipeline

Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit 16f3eb3)
  • Loading branch information
jbudz authored and kibanamachine committed Feb 15, 2022
1 parent bb3c9e3 commit 4e7d144
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
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

0 comments on commit 4e7d144

Please sign in to comment.