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 <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
jbudz and kibanamachine committed Feb 18, 2022
1 parent 8612020 commit 578aea6
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 2 deletions.
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 .
3 changes: 2 additions & 1 deletion src/dev/build/tasks/os_packages/docker_generator/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export async function runDockerGenerator(
? [resolve(beatsDir, metricbeatTarball), resolve(beatsDir, filebeatTarball)]
: []),
];

const publicArtifactSubdomain = config.isRelease ? 'artifacts' : 'snapshots-no-kpi';
const scope: TemplateContext = {
artifactPrefix,
artifactTarball,
Expand All @@ -95,6 +95,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 @@ -20,6 +20,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 578aea6

Please sign in to comment.