Skip to content

Commit 031d8d0

Browse files
authored
[CI] Add BUILDKITE_ANALYTICS_TOKEN to buildkite integration tests (#6153)
* Add BUILDKITE_ANALYTICS_TOKEN to buildkite integration tests * Add BUILDKITE_ANALYTICS_TOKEN to powershell
1 parent 4cbc18b commit 031d8d0

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

.buildkite/hooks/pre-command

-6
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,6 @@ if [[ "$BUILDKITE_STEP_KEY" == *"integration-tests"* ]]; then
5858
export API_KEY_TOKEN=$(vault kv get -field apiKey ${CI_ESS_PATH})
5959
echo ${API_KEY_TOKEN} > ./apiKey
6060
export TEST_INTEG_AUTH_ESS_APIKEY_FILE=$(realpath ./apiKey)
61-
62-
# BK analytics
63-
echo "--- Prepare BK test analytics token :vault:"
64-
BUILDKITE_ANALYTICS_TOKEN=$(vault kv get -field token kv/ci-shared/platform-ingest/buildkite_analytics_token)
65-
export BUILDKITE_ANALYTICS_TOKEN
66-
6761
fi
6862

6963
if [[ "$BUILDKITE_PIPELINE_SLUG" == "elastic-agent-binary-dra" ]]; then

.buildkite/scripts/integration-tests.ps1

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ $env:TEST_BINARY_NAME = "elastic-agent"
2121
$env:AGENT_VERSION = $PACKAGE_VERSION
2222
$env:SNAPSHOT = $true
2323

24+
Write-Host "--- Prepare BK test analytics token :vault:"
25+
$BUILDKITE_ANALYTICS_TOKEN = & vault kv get -field=token kv/ci-shared/platform-ingest/buildkite_analytics_token
26+
[System.Environment]::SetEnvironmentVariable("BUILDKITE_ANALYTICS_TOKEN", $BUILDKITE_ANALYTICS_TOKEN, [System.EnvironmentVariableTarget]::Process)
27+
2428
echo "~~~ Building test binaries"
2529
mage build:testBinaries
2630

.buildkite/scripts/steps/integration_tests.sh

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ if [[ -n "$STACK_VERSION" ]]; then
1717
STACK_VERSION=${STACK_VERSION}"-SNAPSHOT"
1818
fi
1919

20+
# TODO: move to common.sh when it's refactored
21+
# BK analytics
22+
echo "--- Prepare BK test analytics token :vault:"
23+
BUILDKITE_ANALYTICS_TOKEN=$(vault kv get -field token kv/ci-shared/platform-ingest/buildkite_analytics_token)
24+
export BUILDKITE_ANALYTICS_TOKEN
25+
2026
# Run integration tests
2127
set +e
2228
AGENT_STACK_VERSION="${STACK_VERSION}" TEST_INTEG_CLEAN_ON_EXIT=true STACK_PROVISIONER="$STACK_PROVISIONER" SNAPSHOT=true mage $MAGE_TARGET $MAGE_SUBTARGET

.buildkite/scripts/steps/integration_tests_tf.sh

+6
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ else
4747
export KIBANA_PASSWORD=$(buildkite-agent meta-data get "kibana.pwd")
4848
fi
4949

50+
# TODO: move to common.sh when it's refactored
51+
# BK analytics
52+
echo "--- Prepare BK test analytics token :vault:"
53+
BUILDKITE_ANALYTICS_TOKEN=$(vault kv get -field token kv/ci-shared/platform-ingest/buildkite_analytics_token)
54+
export BUILDKITE_ANALYTICS_TOKEN
55+
5056
# Run integration tests
5157
echo "~~~ Running integration tests"
5258

0 commit comments

Comments
 (0)