Skip to content

Commit

Permalink
[CI] Add BUILDKITE_ANALYTICS_TOKEN to buildkite integration tests (#6153
Browse files Browse the repository at this point in the history
)

* Add BUILDKITE_ANALYTICS_TOKEN to buildkite integration tests

* Add BUILDKITE_ANALYTICS_TOKEN to powershell
  • Loading branch information
pazone authored Nov 27, 2024
1 parent 4cbc18b commit 031d8d0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
6 changes: 0 additions & 6 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions .buildkite/scripts/integration-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions .buildkite/scripts/steps/integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions .buildkite/scripts/steps/integration_tests_tf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 031d8d0

Please sign in to comment.