Skip to content

Commit 29bc862

Browse files
authored
[CI] Backport buildkite integration tests to 8.17 (#6323)
* [CI] Backport buildkite integration tests from main * Remove devmachine target. A follow-up backport is required * Remove devmachine target. A follow-up backport is required * Remove devmachine target. A follow-up backport is required * Remove devmachine target. A follow-up backport is required * Remove devmachine target. A follow-up backport is required * Update test report paths * Integration tests: Parse agent version from version.go
1 parent 62f531b commit 29bc862

16 files changed

+430
-239
lines changed

.buildkite/bk.integration.pipeline.yml

+115-82
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,12 @@ env:
44
DOCKER_REGISTRY: "docker.elastic.co"
55
VAULT_PATH: "kv/ci-shared/observability-ingest/cloud/gcp"
66
ASDF_MAGE_VERSION: 1.14.0
7-
ASDF_GOLANG_VERSION: 1.22.6
8-
ASDF_TERRAFORM_VERSION: 1.9.3
97

108
steps:
11-
- label: "Integration tests: packaging"
12-
key: "package-it"
13-
command: ".buildkite/scripts/steps/integration-package.sh"
14-
artifact_paths:
15-
- build/distributions/**
16-
agents:
17-
provider: "gcp"
18-
machineType: "n1-standard-8"
19-
209
- label: Start ESS stack for integration tests
2110
key: integration-ess
22-
depends_on:
23-
- package-it
11+
env:
12+
ASDF_TERRAFORM_VERSION: 1.9.2
2413
command: |
2514
#!/usr/bin/env bash
2615
set -euo pipefail
@@ -32,124 +21,145 @@ steps:
3221
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:0.5"
3322
useCustomGlobalHooks: true
3423

35-
- group: "Stateful IT (Sudo): Ubuntu"
36-
key: integration-tests
24+
- group: "Stateful: Windows"
25+
key: integration-tests-win
3726
depends_on:
38-
- package-it
3927
- integration-ess
4028
steps:
41-
- label: "Default"
42-
key: stateful-ubuntu-default-sudo
29+
- label: "Win2022:sudo:{{matrix}}"
4330
command: |
44-
buildkite-agent artifact download build/distributions/** . --step 'package-it'
45-
.buildkite/scripts/steps/integration_tests_tf_sudo.sh "default" "^(TestAPMConfig|TestDiagnosticsOptionalValues|TestIsolatedUnitsDiagnosticsOptionalValues|TestDiagnosticsCommand|TestIsolatedUnitsDiagnosticsCommand|TestEventLogFile|TestFakeComponent|TestFakeIsolatedUnitsComponent|TestOtelFileProcessing|TestOtelLogsIngestion|TestOtelAPMIngestion|TestPackageVersion)$$"
31+
buildkite-agent artifact download build/distributions/** . --step 'package-it' --build ${BUILDKITE_TRIGGERED_FROM_BUILD_ID}
32+
.buildkite/scripts/integration-tests.ps1 {{matrix}} true
4633
artifact_paths:
4734
- build/**
35+
- build/diagnostics/**
4836
agents:
4937
provider: "gcp"
50-
imageProject: elastic-images-qa
5138
machineType: "n1-standard-8"
52-
image: "family/platform-ingest-elastic-agent-ubuntu-2204"
39+
image: "family/platform-ingest-elastic-agent-windows-2022"
40+
matrix:
41+
- default
42+
- fleet
43+
- fleet-privileged
44+
- upgrade
5345

54-
- label: "Upgrade"
55-
key: stateful-ubuntu-upgrade-sudo
46+
- label: "Win2022:non-sudo:{{matrix}}"
5647
command: |
57-
buildkite-agent artifact download build/distributions/** . --step 'package-it'
58-
.buildkite/scripts/steps/integration_tests_tf_sudo.sh "upgrade" "^(TestUpgradeBrokenPackageVersion|TestStandaloneUpgradeWithGPGFallback|TestStandaloneUpgradeWithGPGFallbackOneRemoteFailing|TestStandaloneUpgradeRollback|TestStandaloneUpgradeRollbackOnRestarts|TestStandaloneUpgradeFailsWhenUpgradeIsInProgress|TestStandaloneUpgradeRetryDownload|TestStandaloneUpgradeSameCommit|TestStandaloneUpgrade|TestStandaloneUpgradeUninstallKillWatcher)$$"
48+
buildkite-agent artifact download build/distributions/** . --step 'package-it' --build ${BUILDKITE_TRIGGERED_FROM_BUILD_ID}
49+
.buildkite/scripts/integration-tests.ps1 {{matrix}} false
5950
artifact_paths:
6051
- build/**
52+
- build/diagnostics/**
6153
agents:
6254
provider: "gcp"
63-
imageProject: elastic-images-qa
6455
machineType: "n1-standard-8"
65-
image: "family/platform-ingest-elastic-agent-ubuntu-2204"
56+
image: "family/platform-ingest-elastic-agent-windows-2022"
57+
matrix:
58+
- default
6659

67-
- label: "Fleet"
68-
key: stateful-ubuntu-fleet-sudo
60+
- group: "Stateful:Ubuntu"
61+
key: integration-tests-ubuntu
62+
depends_on:
63+
- integration-ess
64+
steps:
65+
- label: "x86_64:non-sudo: {{matrix}}"
6966
command: |
70-
buildkite-agent artifact download build/distributions/** . --step 'package-it'
71-
ls -lah build/distributions/
72-
.buildkite/scripts/steps/integration_tests_tf_sudo.sh "fleet" "^(TestLongRunningAgentForLeaks|TestDelayEnroll|TestDelayEnrollUnprivileged|TestInstallAndCLIUninstallWithEndpointSecurity|TestInstallAndUnenrollWithEndpointSecurity|TestInstallWithEndpointSecurityAndRemoveEndpointIntegration|TestEndpointSecurityNonDefaultBasePath|TestEndpointSecurityUnprivileged|TestEndpointSecurityCannotSwitchToUnprivileged|TestEndpointLogsAreCollectedInDiagnostics|TestForceInstallOverProtectedPolicy|TestSetLogLevelFleetManaged|TestLogIngestionFleetManaged|TestMetricsMonitoringCorrectBinaries|TestEndpointAgentServiceMonitoring|TestMonitoringPreserveTextConfig|TestMonitoringLivenessReloadable|TestComponentBuildHashInDiagnostics|TestProxyURL|TestFleetManagedUpgradeUnprivileged)$$"
67+
buildkite-agent artifact download build/distributions/** . --step 'package-it' --build ${BUILDKITE_TRIGGERED_FROM_BUILD_ID}
68+
.buildkite/scripts/steps/integration_tests_tf.sh {{matrix}} false
7369
artifact_paths:
7470
- build/**
71+
- build/diagnostics/**
7572
agents:
7673
provider: "gcp"
77-
imageProject: elastic-images-qa
7874
machineType: "n1-standard-8"
79-
image: "family/platform-ingest-elastic-agent-ubuntu-2204"
75+
image: "family/platform-ingest-elastic-agent-ubuntu-2404"
76+
matrix:
77+
- default
8078

81-
- label: "FQDN"
82-
key: stateful-ubuntu-fqdn-sudo
79+
- label: "x86_64:sudo: {{matrix}}"
8380
command: |
84-
buildkite-agent artifact download build/distributions/** . --step 'package-it'
85-
ls -lah build/distributions/
86-
.buildkite/scripts/steps/integration_tests_tf_sudo.sh "fqdn" "^(TestFQDN)$$"
81+
buildkite-agent artifact download build/distributions/** . --step 'package-it' --build ${BUILDKITE_TRIGGERED_FROM_BUILD_ID}
82+
.buildkite/scripts/steps/integration_tests_tf.sh {{matrix}} true
8783
artifact_paths:
8884
- build/**
85+
- build/diagnostics/**
8986
agents:
9087
provider: "gcp"
91-
imageProject: elastic-images-qa
9288
machineType: "n1-standard-8"
93-
image: "family/platform-ingest-elastic-agent-ubuntu-2204"
89+
image: "family/platform-ingest-elastic-agent-ubuntu-2404"
90+
matrix:
91+
- default
92+
- container
93+
- fleet-upgrade-to-pr-build
94+
- upgrade
95+
- fleet
96+
- fqdn
97+
- deb
98+
- fleet-airgapped
99+
- fleet-privileged
100+
- fleet-airgapped-privileged
94101

95-
- label: "Deb"
96-
key: stateful-ubuntu-deb-sudo
102+
- label: "arm:sudo: {{matrix}}"
103+
skip: true
97104
command: |
98-
buildkite-agent artifact download build/distributions/** . --step 'package-it'
99-
ls -lah build/distributions/
100-
.buildkite/scripts/steps/integration_tests_tf_sudo.sh "deb" "^(TestDebLogIngestFleetManaged|TestDebFleetUpgrade)$$"
105+
buildkite-agent artifact download build/distributions/** . --step 'package-it' --build ${BUILDKITE_TRIGGERED_FROM_BUILD_ID}
106+
.buildkite/scripts/steps/integration_tests_tf.sh {{matrix}} true
101107
artifact_paths:
102108
- build/**
109+
- build/diagnostics/**
103110
agents:
104-
provider: "gcp"
105-
imageProject: elastic-images-qa
106-
machineType: "n1-standard-8"
107-
image: "family/platform-ingest-elastic-agent-ubuntu-2204"
111+
provider: "aws"
112+
imagePrefix: "platform-ingest-beats-ubuntu-2404-aarch64"
113+
instanceType: "m6g.2xlarge"
114+
matrix:
115+
- default
116+
- container
117+
- fleet-upgrade-to-pr-build
118+
- upgrade
119+
- fleet
120+
- fqdn
121+
- deb
122+
- fleet-airgapped
123+
- fleet-privileged
124+
- fleet-airgapped-privileged
108125

109-
- label: "Fleet Airgapped"
110-
key: stateful-ubuntu-fleet-airgapped-sudo
126+
- label: "arm:non-sudo: {{matrix}}"
127+
skip: true
111128
command: |
112-
buildkite-agent artifact download build/distributions/** . --step 'package-it'
113-
ls -lah build/distributions/
114-
.buildkite/scripts/steps/integration_tests_tf_sudo.sh "fleet-airgapped" "^(TestFleetAirGappedUpgradeUnprivileged)$$"
129+
buildkite-agent artifact download build/distributions/** . --step 'package-it' --build ${BUILDKITE_TRIGGERED_FROM_BUILD_ID}
130+
.buildkite/scripts/steps/integration_tests_tf.sh {{matrix}} false
115131
artifact_paths:
116132
- build/**
133+
- build/diagnostics/**
117134
agents:
118-
provider: "gcp"
119-
imageProject: elastic-images-qa
120-
machineType: "n1-standard-8"
121-
image: "family/platform-ingest-elastic-agent-ubuntu-2204"
135+
provider: "aws"
136+
imagePrefix: "platform-ingest-beats-ubuntu-2404-aarch64"
137+
instanceType: "m6g.xlarge"
138+
matrix:
139+
- default
122140

123-
- label: "Fleet Privileged"
124-
key: stateful-ubuntu-fleet-privileged-sudo
125-
command: |
126-
buildkite-agent artifact download build/distributions/** . --step 'package-it'
127-
ls -lah build/distributions/
128-
.buildkite/scripts/steps/integration_tests_tf_sudo.sh "fleet-privileged" "^(TestInstallFleetServerBootstrap|TestFleetManagedUpgradePrivileged)$$"
129-
artifact_paths:
130-
- build/**
131-
agents:
132-
provider: "gcp"
133-
imageProject: elastic-images-qa
134-
machineType: "n1-standard-8"
135-
image: "family/platform-ingest-elastic-agent-ubuntu-2204"
136-
137-
- label: "Fleet Airgapped Privileged"
138-
key: stateful-ubuntu-fleet-airgapped-privileged-sudo
141+
- group: "Stateful(Sudo):RHEL8"
142+
key: integration-tests-rhel8
143+
depends_on:
144+
- integration-ess
145+
steps:
146+
- label: "x86_64:sudo:rpm"
139147
command: |
140-
buildkite-agent artifact download build/distributions/** . --step 'package-it'
141-
ls -lah build/distributions/
142-
.buildkite/scripts/steps/integration_tests_tf_sudo.sh "fleet-airgapped-privileged" "^(TestFleetAirGappedUpgradePrivileged)$$"
148+
buildkite-agent artifact download build/distributions/** . --step 'package-it' --build ${BUILDKITE_TRIGGERED_FROM_BUILD_ID}
149+
.buildkite/scripts/steps/integration_tests_tf.sh rpm true
143150
artifact_paths:
144151
- build/**
152+
- build/diagnostics/**
145153
agents:
146154
provider: "gcp"
147-
imageProject: elastic-images-qa
148155
machineType: "n1-standard-8"
149-
image: "family/platform-ingest-elastic-agent-ubuntu-2204"
156+
image: "family/platform-ingest-elastic-agent-rhel-8"
150157

151158
- label: ESS stack cleanup
152-
depends_on: integration-tests
159+
depends_on:
160+
- integration-tests-ubuntu
161+
- integration-tests-win
162+
- integration-tests-rhel8
153163
allow_dependency_failure: true
154164
command: |
155165
buildkite-agent artifact download "test_infra/ess/**" . --step "integration-ess"
@@ -158,3 +168,26 @@ steps:
158168
agents:
159169
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:0.5"
160170
useCustomGlobalHooks: true
171+
172+
- label: Aggregate test reports
173+
# Warning: The key has a hook in pre-command
174+
key: aggregate-reports
175+
depends_on:
176+
- integration-tests-ubuntu
177+
- integration-tests-win
178+
- integration-tests-rhel8
179+
allow_dependency_failure: true
180+
command: |
181+
buildkite-agent artifact download "build/*.xml" .
182+
buildkite-agent artifact download "build\*.xml" .
183+
agents:
184+
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:0.5"
185+
useCustomGlobalHooks: true
186+
soft_fail:
187+
- exit_status: "*"
188+
plugins:
189+
- test-collector#v1.10.1:
190+
files: "build/*.xml"
191+
format: "junit"
192+
branches: "main"
193+
debug: true

.buildkite/hooks/pre-command

+6
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,13 @@ if [[ "$BUILDKITE_STEP_KEY" == *"integration-tests"* ]]; then
6363
echo "--- Prepare BK test analytics token :vault:"
6464
BUILDKITE_ANALYTICS_TOKEN=$(vault kv get -field token kv/ci-shared/platform-ingest/buildkite_analytics_token)
6565
export BUILDKITE_ANALYTICS_TOKEN
66+
fi
6667

68+
if [[ "$BUILDKITE_STEP_KEY" == *"aggregate-reports"* ]]; then
69+
# BK analytics
70+
echo "--- Prepare BK test analytics token :vault:"
71+
BUILDKITE_ANALYTICS_TOKEN=$(vault kv get -field token kv/ci-shared/platform-ingest/buildkite_analytics_token)
72+
export BUILDKITE_ANALYTICS_TOKEN
6773
fi
6874

6975
if [[ "$BUILDKITE_PIPELINE_SLUG" == "elastic-agent-binary-dra" ]]; then

.buildkite/hooks/pre-command.ps1

-30
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,2 @@
11
# Shorten BUILDKITE_MESSAGE if needed to avoid filling the Windows env var buffer
22
$env:BUILDKITE_MESSAGE = $env:BUILDKITE_MESSAGE.Substring(0, [System.Math]::Min(2048, $env:BUILDKITE_MESSAGE.Length))
3-
4-
# Install gcc TODO: Move to the VM image
5-
choco install mingw
6-
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
7-
refreshenv
8-
9-
# Install gvm and go
10-
# TODO: Move GVM download to the base VM image
11-
$env:GvmVersion = "0.5.2"
12-
[Net.ServicePointManager]::SecurityProtocol = "tls12"
13-
$env:GoVersion = Get-Content -Path .go-version
14-
Invoke-WebRequest -URI https://github.com/andrewkroh/gvm/releases/download/v$env:GvmVersion/gvm-windows-amd64.exe -Outfile C:\Windows\System32\gvm.exe
15-
gvm --format=powershell $env:GoVersion | Invoke-Expression
16-
go version
17-
18-
$GOPATH = $(go env GOPATH)
19-
$env:Path = "$GOPATH\bin;" + $env:Path
20-
$env:GOTMPDIR = "$GOPATH\tmp"
21-
New-Item -ItemType Directory -Force -Path $env:GOTMPDIR
22-
[Environment]::SetEnvironmentVariable("GOPATH", "$GOPATH", [EnvironmentVariableTarget]::Machine)
23-
[Environment]::SetEnvironmentVariable("GOTMPDIR", "$GOPATH\tmp", [EnvironmentVariableTarget]::Machine)
24-
[Environment]::SetEnvironmentVariable("Path", "$GOPATH\bin;$env:Path", [EnvironmentVariableTarget]::Machine)
25-
go env
26-
27-
# Install tools
28-
go install github.com/magefile/mage
29-
go install github.com/elastic/go-licenser
30-
go install golang.org/x/tools/cmd/goimports
31-
go install github.com/jstemmer/go-junit-report
32-
go install gotest.tools/gotestsum

.buildkite/integration.pipeline.yml

+5-24
Original file line numberDiff line numberDiff line change
@@ -57,32 +57,13 @@ steps:
5757
- github_commit_status:
5858
context: "buildkite/elastic-agent-extended-testing - Extended runtime leak tests"
5959

60-
- label: "Integration tests"
61-
key: "integration-tests"
60+
- label: "Triggering Integration tests"
6261
depends_on:
6362
- package-it
64-
concurrency_group: elastic-agent-extended-testing/integration
65-
concurrency: 8
66-
env:
67-
TEST_INTEG_AUTH_GCP_DATACENTER: "us-central1-f"
68-
command: |
69-
buildkite-agent artifact download build/distributions/** . --step 'package-it'
70-
.buildkite/scripts/steps/integration_tests.sh stateful
71-
artifact_paths:
72-
- "build/TEST-**"
73-
- "build/diagnostics/*"
74-
agents:
75-
provider: "gcp"
76-
machineType: "n1-standard-8"
77-
notify:
78-
- github_commit_status:
79-
context: "buildkite/elastic-agent-extended-testing - Integration tests"
80-
plugins:
81-
- test-collector#v1.10.1:
82-
files: "build/TEST-*.xml"
83-
format: "junit"
84-
branches: "main"
85-
debug: true
63+
trigger: "elastic-agent-extended-testing-bk"
64+
build:
65+
commit: "${BUILDKITE_COMMIT}"
66+
branch: "${BUILDKITE_BRANCH}"
8667

8768
- label: "Serverless Beats Tests"
8869
depends_on:

0 commit comments

Comments
 (0)