diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index f11f9f6b2cc..e838dfaf74c 100755 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -34,14 +34,16 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "elastic-agent-package" ]]; then fi fi -if [[ "$BUILDKITE_STEP_KEY" == *"integration-tests"* ]]; then +if [[ "$BUILDKITE_PIPELINE_SLUG" == "buildkite-elastic-agent-integration-matrix" ]]; then echo "Setting credentials" # Set GCP credentials export GOOGLE_APPLICATION_GCP_SECRET=$(retry 5 vault kv get -format=json -field=data ${CI_GCP_OBS_PATH}) echo "${GOOGLE_APPLICATION_GCP_SECRET}" > ./gcp.json export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ./gcp.json) export TEST_INTEG_AUTH_GCP_SERVICE_TOKEN_FILE=$(realpath ./gcp.json) +fi +if [[ "$BUILDKITE_STEP_KEY" == *"integration-tests"* ]]; then # ESS credentials export API_KEY_TOKEN=$(vault kv get -field apiKey ${CI_ESS_PATH}) echo ${API_KEY_TOKEN} > ./apiKey diff --git a/.buildkite/hooks/pre-exit b/.buildkite/hooks/pre-exit index c3d81b1a939..4defbe3bfc8 100755 --- a/.buildkite/hooks/pre-exit +++ b/.buildkite/hooks/pre-exit @@ -14,13 +14,13 @@ if [[ "$BUILDKITE_STEP_KEY" == *"integration-tests"* ]]; then SNAPSHOT=true mage integration:clean fi -if [ -n "$GOOGLE_APPLICATION_CREDENTIALS" ]; then +if [ -n "${GOOGLE_APPLICATION_CREDENTIALS:-}" ]; then if test -f "$GOOGLE_APPLICATION_CREDENTIALS"; then rm $GOOGLE_APPLICATION_CREDENTIALS fi fi -if [ -n "$TEST_INTEG_AUTH_GCP_SERVICE_TOKEN_FILE" ]; then +if [ -n "${TEST_INTEG_AUTH_GCP_SERVICE_TOKEN_FILE:-}" ]; then if test -f "$TEST_INTEG_AUTH_GCP_SERVICE_TOKEN_FILE"; then rm $TEST_INTEG_AUTH_GCP_SERVICE_TOKEN_FILE fi