Skip to content

Commit ab2b481

Browse files
committed
initial attempt to create/destroy/read
1 parent dd7c6dd commit ab2b481

File tree

7 files changed

+114
-52
lines changed

7 files changed

+114
-52
lines changed

.buildkite/bk.integration-fips.pipeline.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ env:
77
IMAGE_UBUNTU_X86_64_FIPS: "platform-ingest-elastic-agent-ubuntu-2204-fips-1749862860"
88
IMAGE_UBUNTU_ARM64_FIPS: "platform-ingest-elastic-agent-ubuntu-2204-fips-aarch64-1749862860"
99

10+
# This section is used to define the plugins that will be used in the pipeline.
11+
# See https://buildkite.com/docs/pipelines/integrations/plugins/using#using-yaml-anchors-with-plugins
12+
common:
13+
- google_oidc_observability_plugin: &google_oidc_observability_plugin
14+
# See https://github.com/elastic/oblt-infra/blob/main/conf/resources/repos/elastic-agent/01-gcp-oidc.tf
15+
# This plugin authenticates to Google Cloud using the OIDC token.
16+
elastic/oblt-google-auth#v1.3.0:
17+
lifetime: 10800 # seconds
18+
# TODO: maybe we can rely on the VM and install only if not present?
19+
- oblt_cli_plugin: &oblt_cli_plugin:
20+
elastic/oblt-cli#v0.2.0:
21+
version-file: .oblt-cli-version
22+
1023
steps:
1124
- label: Build and push custom elastic-agent image
1225
depends_on:
@@ -29,7 +42,7 @@ steps:
2942
- elastic/vault-docker-login#v0.5.2:
3043
secret_path: 'kv/ci-shared/platform-ingest/elastic_docker_registry'
3144

32-
- label: Start ESS stack for FIPS integration tests
45+
- label: Start ESS stack for FIPS integration tests using oblt-cli
3346
key: integration-fips-ess
3447
depends_on:
3548
- integration-fips-cloud-image
@@ -38,14 +51,9 @@ steps:
3851
CUSTOM_IMAGE_TAG: "git-${BUILDKITE_COMMIT:0:12}"
3952
CI_ELASTIC_AGENT_DOCKER_IMAGE: "docker.elastic.co/beats-ci/elastic-agent-cloud-fips"
4053
TF_VAR_integration_server_docker_image: "docker.elastic.co/beats-ci/elastic-agent-cloud-fips:git-${BUILDKITE_COMMIT:0:12}"
41-
command: |
42-
source .buildkite/scripts/steps/ess_start.sh
43-
artifact_paths:
44-
- test_infra/ess/*.tfstate
45-
- test_infra/ess/*.lock.hcl
54+
command: .buildkite/scripts/steps/ess_start.sh
4655
agents:
47-
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:0.5"
48-
useCustomGlobalHooks: true
56+
image: "docker.elastic.co/ci-agent-images/platform-ingest/oblt-cli:latest"
4957

5058
- group: "fips:Stateful:Ubuntu"
5159
key: integration-tests-ubuntu-fips
@@ -80,6 +88,9 @@ steps:
8088
- "true"
8189
groups:
8290
- fleet # currently there is only a single test in the fleet group, add more tests once they have been defined
91+
plugins:
92+
- *google_oidc_observability_plugin
93+
- *oblt_cli_plugin
8394

8495
- label: "fips:arm64:sudo-{{matrix.sudo}}:{{matrix.groups}}"
8596
depends_on:
@@ -109,18 +120,17 @@ steps:
109120
- "true"
110121
groups:
111122
- fleet
123+
plugins:
124+
- *google_oidc_observability_plugin
125+
- *oblt_cli_plugin
112126

113127
- label: ESS FIPS stack cleanup
114128
depends_on:
115129
- integration-tests-ubuntu-fips
116130
allow_dependency_failure: true
117-
command: |
118-
buildkite-agent artifact download "test_infra/ess/**" . --step "integration-fips-ess"
119-
ls -lah test_infra/ess
120-
.buildkite/scripts/steps/ess_down.sh
131+
command: .buildkite/scripts/steps/ess_down.sh
121132
agents:
122-
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:0.5"
123-
useCustomGlobalHooks: true
133+
image: "docker.elastic.co/ci-agent-images/platform-ingest/oblt-cli:latest"
124134

125135
- label: Aggregate test reports
126136
depends_on:

.buildkite/bk.integration.pipeline.yml

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,20 @@ common:
4242
KIBANA_HOST: ea-serverless-it-kibana-hostname
4343
KIBANA_USERNAME: ea-serverless-it-kibana-username
4444
KIBANA_PASSWORD: ea-serverless-it-kibana-password
45-
- gcp_hosted_secrets_plugin: &gcp_hosted_secrets_plugin
46-
elastic/gcp-secret-manager#v1.3.0-elastic:
47-
env:
48-
# These secrets are created in the step called Start ESS stack for integration tests
49-
# TODO: need to find a way to use dynamic names in the secrets
50-
ELASTICSEARCH_HOST: ea-hosted-it-elasticsearch-hostname
51-
ELASTICSEARCH_PASSWORD: ea-hosted-it-elasticsearch-password
52-
ELASTICSEARCH_USERNAME: ea-hosted-it-elasticsearch-username
53-
KIBANA_HOST: ea-hosted-it-kibana-hostname
54-
KIBANA_USERNAME: ea-hosted-it-kibana-username
55-
KIBANA_PASSWORD: ea-hosted-it-kibana-password
56-
INTEGRATIONS_SERVER_HOST: ea-hosted-it-integration-hostname
45+
# TODO: maybe we can rely on the VM and install only if not present?
46+
- oblt_cli_plugin: &oblt_cli_plugin:
47+
elastic/oblt-cli#v0.2.0:
48+
version-file: .oblt-cli-version
5749

5850
steps:
59-
- label: Start ESS stack for integration tests
51+
- label: Start ESS stack for integration tests using oblt-cli
6052
key: integration-ess
6153
notify:
6254
- github_commit_status:
6355
context: "buildkite/elastic-agent-extended-testing - ESS stack provision using oblt-cli"
6456
command: .buildkite/scripts/steps/ess_start.sh
6557
agents:
6658
image: "docker.elastic.co/ci-agent-images/platform-ingest/oblt-cli:latest"
67-
useCustomGlobalHooks: true
6859

6960
- group: "Extended runtime leak tests"
7061
key: extended-integration-tests
@@ -92,6 +83,10 @@ steps:
9283
retry:
9384
automatic:
9485
limit: 1
86+
plugins:
87+
- *google_oidc_observability_plugin
88+
- *oblt_cli_plugin
89+
9590
- label: "Windows:2025:amd64:sudo"
9691
depends_on:
9792
- packaging-windows
@@ -110,6 +105,10 @@ steps:
110105
provider: "gcp"
111106
machineType: "n2-standard-8"
112107
image: "${IMAGE_WIN_2025}"
108+
plugins:
109+
- *google_oidc_observability_plugin
110+
- *oblt_cli_plugin
111+
113112
- label: "Ubuntu:2404:amd64:sudo"
114113
depends_on: packaging-ubuntu-x86-64
115114
env:
@@ -127,6 +126,9 @@ steps:
127126
provider: "gcp"
128127
machineType: "n2-standard-8"
129128
image: "${IMAGE_UBUNTU_2404_X86_64}"
129+
plugins:
130+
- *google_oidc_observability_plugin
131+
- *oblt_cli_plugin
130132

131133
- group: "Stateful: Windows"
132134
key: integration-tests-win
@@ -163,7 +165,7 @@ steps:
163165
- install-uninstall
164166
plugins:
165167
- *google_oidc_observability_plugin
166-
- *gcp_hosted_secrets_plugin
168+
- *oblt_cli_plugin
167169

168170
- label: "Win2022:non-sudo:{{matrix}}"
169171
depends_on:
@@ -185,7 +187,7 @@ steps:
185187
- default
186188
plugins:
187189
- *google_oidc_observability_plugin
188-
- *gcp_hosted_secrets_plugin
190+
- *oblt_cli_plugin
189191

190192
- label: "Win2025:sudo:{{matrix}}"
191193
depends_on:
@@ -214,7 +216,7 @@ steps:
214216
- install-uninstall
215217
plugins:
216218
- *google_oidc_observability_plugin
217-
- *gcp_hosted_secrets_plugin
219+
- *oblt_cli_plugin
218220

219221
- label: "Win2025:non-sudo:{{matrix}}"
220222
depends_on:
@@ -236,7 +238,7 @@ steps:
236238
- default
237239
plugins:
238240
- *google_oidc_observability_plugin
239-
- *gcp_hosted_secrets_plugin
241+
- *oblt_cli_plugin
240242

241243
- group: "Stateful:Ubuntu"
242244
key: integration-tests-ubuntu
@@ -265,7 +267,7 @@ steps:
265267
- default
266268
plugins:
267269
- *google_oidc_observability_plugin
268-
- *gcp_hosted_secrets_plugin
270+
- *oblt_cli_plugin
269271

270272
- label: "x86_64:sudo: {{matrix}}"
271273
depends_on:
@@ -301,7 +303,7 @@ steps:
301303
- container
302304
plugins:
303305
- *google_oidc_observability_plugin
304-
- *gcp_hosted_secrets_plugin
306+
- *oblt_cli_plugin
305307

306308
- label: "arm:sudo: {{matrix}}"
307309
depends_on:
@@ -337,7 +339,7 @@ steps:
337339
# - container
338340
plugins:
339341
- *google_oidc_observability_plugin
340-
- *gcp_hosted_secrets_plugin
342+
- *oblt_cli_plugin
341343

342344
- label: "arm:non-sudo: {{matrix}}"
343345
skip: true
@@ -360,7 +362,7 @@ steps:
360362
- default
361363
plugins:
362364
- *google_oidc_observability_plugin
363-
- *gcp_hosted_secrets_plugin
365+
- *oblt_cli_plugin
364366

365367
- group: "Stateful:Debian"
366368
key: integration-tests-debian
@@ -389,7 +391,7 @@ steps:
389391
- default
390392
plugins:
391393
- *google_oidc_observability_plugin
392-
- *gcp_hosted_secrets_plugin
394+
- *oblt_cli_plugin
393395

394396
- label: "x86_64:sudo: {{matrix}}"
395397
depends_on:
@@ -426,7 +428,7 @@ steps:
426428
- container
427429
plugins:
428430
- *google_oidc_observability_plugin
429-
- *gcp_hosted_secrets_plugin
431+
- *oblt_cli_plugin
430432

431433
- group: "Stateful(Sudo):RHEL8"
432434
key: integration-tests-rhel8
@@ -448,13 +450,13 @@ steps:
448450
retry:
449451
automatic:
450452
limit: 1
451-
plugins:
452-
- *google_oidc_observability_plugin
453-
- *gcp_hosted_secrets_plugin
454453
agents:
455454
provider: "gcp"
456455
machineType: "n2-standard-8"
457456
image: "${IMAGE_RHEL_8}"
457+
plugins:
458+
- *google_oidc_observability_plugin
459+
- *oblt_cli_plugin
458460

459461
- group: "Kubernetes"
460462
key: integration-tests-kubernetes
@@ -486,9 +488,6 @@ steps:
486488
machineType: "n2-standard-4"
487489
image: "${IMAGE_UBUNTU_2404_X86_64}"
488490
diskSizeGb: 80
489-
plugins:
490-
- *google_oidc_observability_plugin
491-
- *gcp_hosted_secrets_plugin
492491
matrix:
493492
setup:
494493
variants:
@@ -506,6 +505,9 @@ steps:
506505
- v1.31.0
507506
- v1.32.0
508507
- v1.33.0
508+
plugins:
509+
- *google_oidc_observability_plugin
510+
- *oblt_cli_plugin
509511

510512
- group: "Serverless integration test"
511513
key: integration-tests-serverless
@@ -585,10 +587,9 @@ steps:
585587
- integration-tests-kubernetes
586588
- extended-integration-tests
587589
allow_dependency_failure: true
588-
command: .buildkite/scripts/steps/oblt-cli-teardown.sh
590+
command: .buildkite/scripts/steps/ess_down.sh
589591
agents:
590592
image: "docker.elastic.co/ci-agent-images/platform-ingest/oblt-cli:latest"
591-
useCustomGlobalHooks: true
592593

593594
- label: Aggregate test reports
594595
# Warning: The key has a hook in pre-command

.buildkite/scripts/steps/ess.ps1

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,27 @@ function ess_up {
1111
return 1
1212
}
1313

14-
& oblt-cli
14+
& oblt-cli cluster create ess `
15+
--stack-version "$StackVersion" `
16+
--cluster-name-prefix ea-hosted-it `
17+
--output-file="cluster-info.json" `
18+
--wait 15
19+
20+
$ClusterName = (Get-Content -Path "cluster-info.json" | ConvertFrom-Json).ClusterName
21+
if (-not $ClusterName) {
22+
Write-Error "Error: Failed to retrieve cluster name from cluster-info.json"
23+
return 1
24+
}
25+
26+
# Store the cluster name as a meta-data
27+
& buildkite-agent meta-data set cluster-name $ClusterName
1528
}
1629

1730
function ess_down {
1831
Write-Output "~~~ Tearing down the ESS Stack(created for this step)"
19-
try {
20-
& oblt-cli
32+
try {
33+
$ClusterName = & buildkite-agent meta-data get cluster-name
34+
& oblt-cli cluster destroy --cluster-name "$ClusterName" --force
2135
} catch {
2236
Write-Output "Error: Failed to destroy ESS stack(it will be auto-deleted later): $_"
2337
}

.buildkite/scripts/steps/ess.sh

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,26 @@ function ess_up() {
1111
return 1
1212
fi
1313

14-
oblt-cli
14+
# Create a cluster with the specified stack version and store the cluster information in a file
15+
GITHUB_TOKEN="$VAULT_GITHUB_TOKEN" \
16+
oblt-cli cluster create ess \
17+
--stack-version "$STACK_VERSION" \
18+
--cluster-name-prefix ea-hosted-it \
19+
--output-file="${PWD}/cluster-info.json" \
20+
--wait 15
21+
22+
# Extract the cluster name from the cluster information file
23+
CLUSTER_NAME=$(jq -r '.ClusterName' cluster-info.json)
24+
25+
# Store the cluster name as a meta-data
26+
buildkite-agent meta-data set cluster-name "${CLUSTER_NAME}"
1527
}
1628

1729
function ess_down() {
18-
echo "~~~ Tearing down the ESS Stack"
19-
oblt-cli
30+
echo "~~~ Tearing down the ESS Stack"
31+
# Get the cluster name from the meta-data
32+
CLUSTER_NAME="$(buildkite-agent meta-data get cluster-name)"
33+
34+
# Destroy the cluster
35+
oblt-cli cluster destroy --cluster-name "${CLUSTER_NAME}" --force
2036
}

.buildkite/scripts/steps/integration_tests_tf.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ try {
2828
Write-Output "~~~ Running integration tests"
2929
# Get-Ess-Stack will start the ESS stack if it is a BK retry, otherwise it will retrieve ESS stack metadata
3030
Get-Ess-Stack -StackVersion $PACKAGE_VERSION
31+
32+
# Load the ESS stack secrets
33+
# Get the cluster name from the meta-data (CI specific)
34+
# QUESTION: should we support the case when using the ESS stack in local environment?
35+
$ClusterName = & buildkite-agent meta-data get cluster-name
36+
& oblt-cli cluster secrets env --cluster-nam $ClusterName --output-file="env.sh"
37+
38+
# TODO: source the secrets file
39+
source "${PWD}/env.sh" || rm "${PWD}/env.sh"
40+
3141
& "$PWD\.buildkite\scripts\buildkite-integration-tests.ps1" $GROUP_NAME $TEST_SUDO
3242
$TestsExitCode = $LASTEXITCODE
3343
if ($TestsExitCode -ne 0)

.buildkite/scripts/steps/integration_tests_tf.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ if [[ "${BUILDKITE_RETRY_COUNT}" -gt 0 ]]; then
3939
preinstall_fleet_packages
4040
fi
4141

42+
# Load the ESS stack secrets
43+
# Get the cluster name from the meta-data (CI specific)
44+
# QUESTION: should we support the case when using the ESS stack in local environment?
45+
CLUSTER_NAME="$(buildkite-agent meta-data get cluster-name)"
46+
47+
oblt-cli cluster secrets env --cluster-name="${CLUSTER_NAME}" --output-file="${PWD}/env.sh"
48+
49+
# Source the secrets file
50+
source "${PWD}/env.sh" || rm "${PWD}/env.sh"
51+
4252
# Run integration tests
4353
echo "~~~ Running integration tests"
4454

.oblt-cli-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.19.0

0 commit comments

Comments
 (0)