Skip to content

Commit 3affcd2

Browse files
Reduce the scope of the legacy gcp secrets (#10734) (#10905)
* Reduce the scope of the legacy secrets usage only for integration-test-matrix * Fix pipeline slug * Add google oidc plugin in integration tests ech step * Remove gcp auth plugin usage and fix pre exit command * Fix typo * Preserve ESS Credentials logic * Use parameter expansion instead of adding more logic to reduce the complexity (cherry picked from commit 41dd43d) Co-authored-by: Francisco Ramon <[email protected]>
1 parent 508e3fb commit 3affcd2

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

.buildkite/hooks/pre-command

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,16 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "elastic-agent-package" ]]; then
3434
fi
3535
fi
3636

37-
if [[ "$BUILDKITE_STEP_KEY" == *"integration-tests"* ]]; then
37+
if [[ "$BUILDKITE_PIPELINE_SLUG" == "buildkite-elastic-agent-integration-matrix" ]]; then
3838
echo "Setting credentials"
3939
# Set GCP credentials
4040
export GOOGLE_APPLICATION_GCP_SECRET=$(retry 5 vault kv get -format=json -field=data ${CI_GCP_OBS_PATH})
4141
echo "${GOOGLE_APPLICATION_GCP_SECRET}" > ./gcp.json
4242
export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ./gcp.json)
4343
export TEST_INTEG_AUTH_GCP_SERVICE_TOKEN_FILE=$(realpath ./gcp.json)
44+
fi
4445

46+
if [[ "$BUILDKITE_STEP_KEY" == *"integration-tests"* ]]; then
4547
# ESS credentials
4648
export API_KEY_TOKEN=$(vault kv get -field apiKey ${CI_ESS_PATH})
4749
echo ${API_KEY_TOKEN} > ./apiKey

.buildkite/hooks/pre-exit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ if [[ "$BUILDKITE_STEP_KEY" == *"integration-tests"* ]]; then
1414
SNAPSHOT=true mage integration:clean
1515
fi
1616

17-
if [ -n "$GOOGLE_APPLICATION_CREDENTIALS" ]; then
17+
if [ -n "${GOOGLE_APPLICATION_CREDENTIALS:-}" ]; then
1818
if test -f "$GOOGLE_APPLICATION_CREDENTIALS"; then
1919
rm $GOOGLE_APPLICATION_CREDENTIALS
2020
fi
2121
fi
2222

23-
if [ -n "$TEST_INTEG_AUTH_GCP_SERVICE_TOKEN_FILE" ]; then
23+
if [ -n "${TEST_INTEG_AUTH_GCP_SERVICE_TOKEN_FILE:-}" ]; then
2424
if test -f "$TEST_INTEG_AUTH_GCP_SERVICE_TOKEN_FILE"; then
2525
rm $TEST_INTEG_AUTH_GCP_SERVICE_TOKEN_FILE
2626
fi

0 commit comments

Comments
 (0)