From d1b5049a3ef6911961eee334b3233dd9bf207d49 Mon Sep 17 00:00:00 2001 From: Paolo Chila Date: Fri, 22 Sep 2023 07:55:50 +0200 Subject: [PATCH] add pre-exit buildkite hook for integration test cleanup --- .buildkite/hooks/pre-exit | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.buildkite/hooks/pre-exit b/.buildkite/hooks/pre-exit index dc79ef5e84c..e363fbc79d2 100755 --- a/.buildkite/hooks/pre-exit +++ b/.buildkite/hooks/pre-exit @@ -20,3 +20,14 @@ if command -v docker &>/dev/null; then DOCKER_REGISTRY="docker.elastic.co" docker logout $DOCKER_REGISTRY fi + +if [[ "$BUILDKITE_PIPELINE_SLUG" == "elastic-agent" && "$BUILDKITE_STEP_KEY" == "integration-tests" ]]; then + if [[ -z "${WORKSPACE-""}" ]]; then + WORKSPACE=$(git rev-parse --show-toplevel) + fi + + source "${WORKSPACE}/.buildkite/scripts/common.sh" + +# Perform cleanup of integration tests resources +TEST_INTEG_AUTH_ESS_REGION=azure-eastus2 SNAPSHOT=true mage integration:clean +fi