diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index c3aff579772..af49e472ce8 100755 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -58,12 +58,6 @@ if [[ "$BUILDKITE_STEP_KEY" == *"integration-tests"* ]]; then export API_KEY_TOKEN=$(vault kv get -field apiKey ${CI_ESS_PATH}) echo ${API_KEY_TOKEN} > ./apiKey export TEST_INTEG_AUTH_ESS_APIKEY_FILE=$(realpath ./apiKey) - - # BK analytics - echo "--- Prepare BK test analytics token :vault:" - BUILDKITE_ANALYTICS_TOKEN=$(vault kv get -field token kv/ci-shared/platform-ingest/buildkite_analytics_token) - export BUILDKITE_ANALYTICS_TOKEN - fi if [[ "$BUILDKITE_PIPELINE_SLUG" == "elastic-agent-binary-dra" ]]; then diff --git a/.buildkite/scripts/integration-tests.ps1 b/.buildkite/scripts/integration-tests.ps1 index 1f2261e6c73..903582cb6d9 100755 --- a/.buildkite/scripts/integration-tests.ps1 +++ b/.buildkite/scripts/integration-tests.ps1 @@ -21,6 +21,10 @@ $env:TEST_BINARY_NAME = "elastic-agent" $env:AGENT_VERSION = $PACKAGE_VERSION $env:SNAPSHOT = $true +Write-Host "--- Prepare BK test analytics token :vault:" +$BUILDKITE_ANALYTICS_TOKEN = & vault kv get -field=token kv/ci-shared/platform-ingest/buildkite_analytics_token +[System.Environment]::SetEnvironmentVariable("BUILDKITE_ANALYTICS_TOKEN", $BUILDKITE_ANALYTICS_TOKEN, [System.EnvironmentVariableTarget]::Process) + echo "~~~ Building test binaries" mage build:testBinaries diff --git a/.buildkite/scripts/steps/integration_tests.sh b/.buildkite/scripts/steps/integration_tests.sh index 834da1cd4c6..694751bd9b8 100755 --- a/.buildkite/scripts/steps/integration_tests.sh +++ b/.buildkite/scripts/steps/integration_tests.sh @@ -17,6 +17,12 @@ if [[ -n "$STACK_VERSION" ]]; then STACK_VERSION=${STACK_VERSION}"-SNAPSHOT" fi +# TODO: move to common.sh when it's refactored +# BK analytics +echo "--- Prepare BK test analytics token :vault:" +BUILDKITE_ANALYTICS_TOKEN=$(vault kv get -field token kv/ci-shared/platform-ingest/buildkite_analytics_token) +export BUILDKITE_ANALYTICS_TOKEN + # Run integration tests set +e AGENT_STACK_VERSION="${STACK_VERSION}" TEST_INTEG_CLEAN_ON_EXIT=true STACK_PROVISIONER="$STACK_PROVISIONER" SNAPSHOT=true mage $MAGE_TARGET $MAGE_SUBTARGET diff --git a/.buildkite/scripts/steps/integration_tests_tf.sh b/.buildkite/scripts/steps/integration_tests_tf.sh index 0c459b9d17a..0bec6aa7924 100755 --- a/.buildkite/scripts/steps/integration_tests_tf.sh +++ b/.buildkite/scripts/steps/integration_tests_tf.sh @@ -47,6 +47,12 @@ else export KIBANA_PASSWORD=$(buildkite-agent meta-data get "kibana.pwd") fi +# TODO: move to common.sh when it's refactored +# BK analytics +echo "--- Prepare BK test analytics token :vault:" +BUILDKITE_ANALYTICS_TOKEN=$(vault kv get -field token kv/ci-shared/platform-ingest/buildkite_analytics_token) +export BUILDKITE_ANALYTICS_TOKEN + # Run integration tests echo "~~~ Running integration tests"