Skip to content

Commit cdf9161

Browse files
mergify[bot]pazone
andauthored
[8.17] (backport #8377) [CI] BK Vault plugin for EC access (#8792)
* [CI] BK Vault plugin for EC access (#8377) * [CI] BK Vault plugin for ES access * Typo * Typo * Quick Windows test * Quick test Windows * Revert last two commits * Applied proposed changes * Fixed indentation * revert buildkite_analytics_token deletion * Remaned the anchor * Added the issue to comments * Updated FIPS pipeline (cherry picked from commit e2505e4) # Conflicts: # .buildkite/bk.integration-fips.pipeline.yml * Remove backported fips pipeline --------- Co-authored-by: Pavel Zorin <[email protected]>
1 parent c2cfb50 commit cdf9161

File tree

4 files changed

+45
-25
lines changed

4 files changed

+45
-25
lines changed

.buildkite/bk.integration.pipeline.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ common:
3838
KIBANA_HOST: ea-serverless-it-kibana-hostname
3939
KIBANA_USERNAME: ea-serverless-it-kibana-username
4040
KIBANA_PASSWORD: ea-serverless-it-kibana-password
41+
- vault_ec_key_prod: &vault_ec_key_prod
42+
elastic/vault-secrets#v0.1.0:
43+
path: "kv/ci-shared/platform-ingest/platform-ingest-ec-prod"
44+
field: "apiKey"
45+
env_var: "EC_API_KEY"
4146

4247
steps:
4348
- label: Start ESS stack for integration tests
@@ -57,6 +62,8 @@ steps:
5762
agents:
5863
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:0.5"
5964
useCustomGlobalHooks: true
65+
plugins:
66+
- *vault_ec_key_prod
6067

6168
- group: "Extended runtime leak tests"
6269
key: extended-integration-tests
@@ -84,6 +91,9 @@ steps:
8491
retry:
8592
automatic:
8693
limit: 1
94+
plugins:
95+
- *vault_ec_key_prod
96+
8797
- label: "Windows:2025:amd64:sudo"
8898
depends_on:
8999
- packaging-windows
@@ -102,6 +112,9 @@ steps:
102112
provider: "gcp"
103113
machineType: "n2-standard-8"
104114
image: "${IMAGE_WIN_2025}"
115+
plugins:
116+
- *vault_ec_key_prod
117+
105118
- label: "Ubuntu:2404:amd64:sudo"
106119
depends_on: packaging-ubuntu-x86-64
107120
env:
@@ -119,6 +132,8 @@ steps:
119132
provider: "gcp"
120133
machineType: "n2-standard-8"
121134
image: "${IMAGE_UBUNTU_2404_X86_64}"
135+
plugins:
136+
- *vault_ec_key_prod
122137

123138
- group: "Stateful: Windows"
124139
key: integration-tests-win
@@ -146,6 +161,8 @@ steps:
146161
retry:
147162
automatic:
148163
limit: 1
164+
plugins:
165+
- *vault_ec_key_prod
149166
matrix:
150167
- default
151168
- fleet
@@ -173,6 +190,8 @@ steps:
173190
retry:
174191
automatic:
175192
limit: 1
193+
plugins:
194+
- *vault_ec_key_prod
176195
matrix:
177196
- default
178197

@@ -194,6 +213,8 @@ steps:
194213
retry:
195214
automatic:
196215
limit: 1
216+
plugins:
217+
- *vault_ec_key_prod
197218
matrix:
198219
- default
199220
- fleet
@@ -222,6 +243,8 @@ steps:
222243
provider: "gcp"
223244
machineType: "n2-standard-8"
224245
image: "${IMAGE_WIN_2025}"
246+
plugins:
247+
- *vault_ec_key_prod
225248
matrix:
226249
- default
227250

@@ -250,6 +273,8 @@ steps:
250273
provider: "gcp"
251274
machineType: "n2-standard-8"
252275
image: "${IMAGE_UBUNTU_2404_X86_64}"
276+
plugins:
277+
- *vault_ec_key_prod
253278
matrix:
254279
- default
255280

@@ -272,6 +297,8 @@ steps:
272297
provider: "gcp"
273298
machineType: "n2-standard-8"
274299
image: "${IMAGE_UBUNTU_2404_X86_64}"
300+
plugins:
301+
- *vault_ec_key_prod
275302
matrix:
276303
- default
277304
- upgrade
@@ -305,6 +332,8 @@ steps:
305332
retry:
306333
automatic:
307334
limit: 1
335+
plugins:
336+
- *vault_ec_key_prod
308337
matrix:
309338
- default
310339
- upgrade
@@ -340,6 +369,8 @@ steps:
340369
provider: "aws"
341370
image: "${IMAGE_UBUNTU_2404_ARM_64}"
342371
instanceType: "m6g.xlarge"
372+
plugins:
373+
- *vault_ec_key_prod
343374
matrix:
344375
- default
345376

@@ -368,6 +399,8 @@ steps:
368399
provider: "gcp"
369400
machineType: "n2-standard-8"
370401
image: "${IMAGE_DEBIAN_12}"
402+
plugins:
403+
- *vault_ec_key_prod
371404
matrix:
372405
- default
373406

@@ -390,6 +423,8 @@ steps:
390423
provider: "gcp"
391424
machineType: "n2-standard-8"
392425
image: "${IMAGE_DEBIAN_12}"
426+
plugins:
427+
- *vault_ec_key_prod
393428
matrix:
394429
- default
395430
- upgrade
@@ -429,6 +464,8 @@ steps:
429464
retry:
430465
automatic:
431466
limit: 1
467+
plugins:
468+
- *vault_ec_key_prod
432469
agents:
433470
provider: "gcp"
434471
machineType: "n2-standard-8"
@@ -464,6 +501,8 @@ steps:
464501
machineType: "n2-standard-4"
465502
image: "${IMAGE_UBUNTU_2404_X86_64}"
466503
diskSizeGb: 80
504+
plugins:
505+
- *vault_ec_key_prod
467506
matrix:
468507
setup:
469508
variants:
@@ -560,7 +599,8 @@ steps:
560599
agents:
561600
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:0.5"
562601
useCustomGlobalHooks: true
563-
602+
plugins:
603+
- *vault_ec_key_prod
564604
- label: Aggregate test reports
565605
# Warning: The key has a hook in pre-command
566606
key: aggregate-reports

.buildkite/hooks/pre-command

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ fi
1515

1616
CI_DRA_ROLE_PATH="kv/ci-shared/release/dra-role"
1717
CI_GCP_OBS_PATH="kv/ci-shared/observability-ingest/cloud/gcp"
18+
# This key exists for backward compatibility with OGC framework
19+
# see https://github.com/elastic/elastic-agent/issues/8536
1820
CI_ESS_PATH="kv/ci-shared/platform-ingest/platform-ingest-ec-prod"
1921
CI_DRA_ROLE_PATH="kv/ci-shared/release/dra-role"
2022

.buildkite/scripts/steps/ess.ps1

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,7 @@ function ess_up {
1313
Write-Error "Error: Specify stack version: ess_up [stack_version]"
1414
return 1
1515
}
16-
17-
$Env:EC_API_KEY = Retry-Command -ScriptBlock {
18-
vault kv get -field=apiKey kv/ci-shared/platform-ingest/platform-ingest-ec-prod
19-
}
20-
21-
if (-not $Env:EC_API_KEY) {
22-
Write-Error "Error: Failed to get EC API key from vault"
23-
exit 1
24-
}
25-
16+
2617
$BuildkiteBuildCreator = if ($Env:BUILDKITE_BUILD_CREATOR) { $Env:BUILDKITE_BUILD_CREATOR } else { get_git_user_email }
2718
$BuildkiteBuildNumber = if ($Env:BUILDKITE_BUILD_NUMBER) { $Env:BUILDKITE_BUILD_NUMBER } else { "0" }
2819
$BuildkitePipelineSlug = if ($Env:BUILDKITE_PIPELINE_SLUG) { $Env:BUILDKITE_PIPELINE_SLUG } else { "elastic-agent-integration-tests" }
@@ -55,10 +46,7 @@ function ess_down {
5546
return 0
5647
}
5748
Write-Output "~~~ Tearing down the ESS Stack(created for this step)"
58-
try {
59-
$Env:EC_API_KEY = Retry-Command -ScriptBlock {
60-
vault kv get -field=apiKey kv/ci-shared/platform-ingest/platform-ingest-ec-prod
61-
}
49+
try {
6250
Push-Location -Path $TfDir
6351
& terraform init
6452
& terraform destroy -auto-approve

.buildkite/scripts/steps/ess.sh

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ function ess_up() {
1313
return 1
1414
fi
1515

16-
export EC_API_KEY=$(retry -t 5 -- vault kv get -field=apiKey kv/ci-shared/platform-ingest/platform-ingest-ec-prod)
17-
18-
if [[ -z "${EC_API_KEY}" ]]; then
19-
echo "Error: Failed to get EC API key from vault" >&2
20-
exit 1
21-
fi
22-
2316
BUILDKITE_BUILD_CREATOR="${BUILDKITE_BUILD_CREATOR:-"$(get_git_user_email)"}"
2417
BUILDKITE_BUILD_NUMBER="${BUILDKITE_BUILD_NUMBER:-"0"}"
2518
BUILDKITE_PIPELINE_SLUG="${BUILDKITE_PIPELINE_SLUG:-"elastic-agent-integration-tests"}"
@@ -47,9 +40,6 @@ function ess_down() {
4740
echo "~~~ Tearing down the ESS Stack"
4841
local WORKSPACE=$(git rev-parse --show-toplevel)
4942
local TF_DIR="${WORKSPACE}/test_infra/ess/"
50-
if [ -z "${EC_API_KEY:-}" ]; then
51-
export EC_API_KEY=$(retry -t 5 -- vault kv get -field=apiKey kv/ci-shared/platform-ingest/platform-ingest-ec-prod)
52-
fi
5343

5444
pushd "${TF_DIR}"
5545
terraform init

0 commit comments

Comments
 (0)