From 3e09ef63cd1e928fca7d20325cb3e925abd16fa9 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Mon, 4 Apr 2022 16:41:19 -0500 Subject: [PATCH] [artifacts] Merge docker context verification (#129399) * [artifacts] Merge docker context verification * add to pipeline * n2-2 --- .buildkite/pipelines/artifacts.yml | 6 ++++ .../scripts/steps/artifacts/docker_context.sh | 28 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 .buildkite/scripts/steps/artifacts/docker_context.sh diff --git a/.buildkite/pipelines/artifacts.yml b/.buildkite/pipelines/artifacts.yml index e934b01d8a4d9..773672c5f05f5 100644 --- a/.buildkite/pipelines/artifacts.yml +++ b/.buildkite/pipelines/artifacts.yml @@ -24,3 +24,9 @@ steps: agents: queue: n2-4-virt timeout_in_minutes: 20 + + - command: .buildkite/scripts/steps/artifacts/docker_context.sh + label: 'Docker Build Context' + agents: + queue: n2-2 + timeout_in_minutes: 20 diff --git a/.buildkite/scripts/steps/artifacts/docker_context.sh b/.buildkite/scripts/steps/artifacts/docker_context.sh new file mode 100644 index 0000000000000..787f5d278febc --- /dev/null +++ b/.buildkite/scripts/steps/artifacts/docker_context.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -euo pipefail + +.buildkite/scripts/bootstrap.sh + +if [[ "${RELEASE_BUILD:-}" == "true" ]]; then + VERSION="$(jq -r '.version' package.json)" + RELEASE_ARG="--release" +else + VERSION="$(jq -r '.version' package.json)-SNAPSHOT" + RELEASE_ARG="" +fi + +echo "--- Create contexts" +mkdir -p target +node scripts/build "$RELEASE_ARG" --skip-initialize --skip-generic-folders --skip-platform-folders --skip-archives --docker-context-use-local-artifact + +echo "--- Setup 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 + +buildkite-agent artifact download "kibana-$VERSION-linux-x86_64.tar.gz" . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}" + +echo "--- Build context" +docker build .