Skip to content

Commit 14326a5

Browse files
authored
Merge branch '8.19' into mergify/bp/8.19/pr-5123
2 parents c0b9786 + f4470f8 commit 14326a5

File tree

13 files changed

+232
-54
lines changed

13 files changed

+232
-54
lines changed

.buildkite/hooks/pre-command

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ set -euo pipefail
44

55
source .buildkite/scripts/common.sh
66

7-
DOCKER_REGISTRY_SECRET_PATH="kv/ci-shared/platform-ingest/docker_registry_prod"
87
EC_KEY_SECRET_PATH="kv/ci-shared/platform-ingest/platform-ingest-ec-prod"
98
CI_DRA_ROLE_PATH="kv/ci-shared/release/dra-role"
109
JOB_GCS_BUCKET="fleet-server-ci-internal"
@@ -45,14 +44,7 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "fleet-server-package-mbp" ]]; then
4544
check_if_file_exist_in_repo "infra" "${_branch}" #TODO should be changed to "main" for rollback...
4645
fi
4746

48-
if [[ "$BUILDKITE_PIPELINE_SLUG" == "fleet-server" || "$BUILDKITE_PIPELINE_SLUG" == "fleet-server-perf-tests" ]]; then
49-
if [[ "$BUILDKITE_STEP_KEY" == "publish" || "$BUILDKITE_STEP_KEY" == "cloud-e2e-test" || "$BUILDKITE_STEP_KEY" == "cloud-e2e-fips-test" || "$BUILDKITE_STEP_KEY" == "create-image" ]]; then
50-
export DOCKER_USERNAME_SECRET=$(retry 5 vault kv get -field user "${DOCKER_REGISTRY_SECRET_PATH}")
51-
export DOCKER_PASSWORD_SECRET=$(retry 5 vault kv get -field password "${DOCKER_REGISTRY_SECRET_PATH}")
52-
docker login -u "${DOCKER_USERNAME_SECRET}" -p "${DOCKER_PASSWORD_SECRET}" "${DOCKER_REGISTRY}" 2>/dev/null
53-
fi
54-
fi
55-
47+
# TODO: use a builkite plugin to handle this
5648
if [[ "$BUILDKITE_PIPELINE_SLUG" == "fleet-server" ]]; then
5749
if [[ "$BUILDKITE_STEP_KEY" == "cloud-e2e-test" || "$BUILDKITE_STEP_KEY" == "cloud-e2e-fips-test" ]]; then
5850
export EC_API_KEY_SECRET=$(retry 5 vault kv get -field apiKey "${EC_KEY_SECRET_PATH}")
@@ -61,20 +53,9 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "fleet-server" ]]; then
6153
fi
6254
fi
6355

64-
# BK analytics
65-
if [[ "$BUILDKITE_PIPELINE_SLUG" == "fleet-server" ]]; then
66-
if [[ "$BUILDKITE_STEP_KEY" == "int-test" || "$BUILDKITE_STEP_KEY" == "e2e-test" || "$BUILDKITE_STEP_KEY" == "fips-e2e-test" ]]; then
67-
echo "--- Prepare BK test analytics token :vault:"
68-
BUILDKITE_ANALYTICS_TOKEN=$(vault kv get -field token kv/ci-shared/platform-ingest/buildkite_fleet_server_analytics_token)
69-
export BUILDKITE_ANALYTICS_TOKEN
70-
fi
71-
fi
72-
56+
# TODO: use a builkite plugin to handle this
7357
if [[ "$BUILDKITE_PIPELINE_SLUG" == "fleet-server-package-mbp" ]]; then
7458
if [[ "$BUILDKITE_STEP_KEY" == "dra-snapshot" || "$BUILDKITE_STEP_KEY" == "dra-staging" ]]; then
75-
export DOCKER_USERNAME_SECRET=$(retry 5 vault kv get -field user "${DOCKER_REGISTRY_SECRET_PATH}")
76-
export DOCKER_PASSWORD_SECRET=$(retry 5 vault kv get -field password "${DOCKER_REGISTRY_SECRET_PATH}")
77-
docker login -u "${DOCKER_USERNAME_SECRET}" -p "${DOCKER_PASSWORD_SECRET}" "${DOCKER_REGISTRY}" 2>/dev/null
7859
DRA_CREDS_SECRET=$(retry 5 vault kv get -field=data -format=json ${CI_DRA_ROLE_PATH})
7960
export VAULT_ADDR_SECRET=$(echo ${DRA_CREDS_SECRET} | jq -r '.vault_addr')
8061
export VAULT_ROLE_ID_SECRET=$(echo ${DRA_CREDS_SECRET} | jq -r '.role_id')

.buildkite/hooks/pre-exit

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ set -euo pipefail
44

55
source .buildkite/scripts/common.sh
66

7-
if [[ "$BUILDKITE_PIPELINE_SLUG" == "fleet-server" || "$BUILDKITE_PIPELINE_SLUG" == "fleet-server-perf-tests" ]]; then
8-
if [[ "$BUILDKITE_STEP_KEY" == "publish" || "$BUILDKITE_STEP_KEY" == "cloud-e2e-test" || "$BUILDKITE_STEP_KEY" == "create-image" ]]; then
9-
docker logout ${DOCKER_REGISTRY}
10-
fi
11-
fi
12-
137
if [[ "$BUILDKITE_PIPELINE_SLUG" == "fleet-server" && "$BUILDKITE_STEP_KEY" == "release-test" ]]; then
148
cleanup
159
fi
@@ -19,7 +13,6 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "fleet-server-package-mbp" ]]; then
1913
unset VAULT_ROLE_ID_SECRET
2014
unset VAULT_ADDR_SECRET
2115
unset VAULT_SECRET_ID_SECRET
22-
docker logout ${DOCKER_REGISTRY}
2316
cleanup
2417
fi
2518
fi

.buildkite/pipeline.package.mbp.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
name: "fleet server package mbp"
33
env:
44
REPO: 'fleet-server'
5-
DOCKER_REGISTRY: "docker.elastic.co"
65
IMAGE_UBUNTU_X86_64: "family/core-ubuntu-2204"
7-
IMAGE_UBUNTU_ARM_64: "core-ubuntu-2204-aarch64"
6+
IMAGE_UBUNTU_ARM_64: "core-ubuntu-2004-aarch64"
87

98
# This section is used to define the plugins that will be used in the pipeline.
109
# See https://buildkite.com/docs/pipelines/integrations/plugins/using#using-yaml-anchors-with-plugins

.buildkite/pipeline.perf-tests.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
22

33
env:
4-
DOCKER_REGISTRY: "docker.elastic.co"
5-
DOCKER_IMAGE: "${DOCKER_REGISTRY}/observability-ci/fleet-server" # needs to rename for rollback
4+
DOCKER_IMAGE: "docker.elastic.co/observability-ci/fleet-server" # needs to rename for rollback
65
DOCKER_IMAGE_GIT_TAG: "${BUILDKITE_BRANCH}" # needs to rename for rollback
76
DOCKER_IMAGE_LATEST_TAG: "latest" # needs to rename for rollback
87
DOCKER_IMAGE_SHA_TAG: "git-${BUILDKITE_COMMIT:0:12}" # needs to rename for rollback, should be "git-${BUILDKITE_COMMIT:0:12}"
98

9+
# This section is used to define the plugins that will be used in the pipeline.
10+
# See https://buildkite.com/docs/pipelines/integrations/plugins/using#using-yaml-anchors-with-plugins
11+
common:
12+
- docker_elastic_login_plugin: &docker_elastic_login_plugin
13+
elastic/vault-docker-login#v0.6.0:
14+
secret_path: 'kv/ci-shared/platform-ingest/elastic_docker_registry'
15+
1016
steps:
1117
- label: ":docker: Publish docker image"
1218
key: "create-image"
1319
command: ".buildkite/scripts/build_push_docker_image.sh"
1420
agents:
1521
provider: "gcp"
22+
plugins:
23+
- *docker_elastic_login_plugin
1624

1725
- label: "perf test"
1826
key: "obs-perf-test"

.buildkite/pipeline.yml

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@
33
env:
44
DOCKER_COMPOSE_VERSION: "1.25.5"
55
TERRAFORM_VERSION: "1.6.4"
6+
IMAGE_UBUNTU_X86_64_FIPS: "platform-ingest-fleet-server-ubuntu-2204-fips-1751684469"
7+
8+
# This section is used to define the plugins that will be used in the pipeline.
9+
# See https://buildkite.com/docs/pipelines/integrations/plugins/using#using-yaml-anchors-with-plugins
10+
common:
11+
- test_collector_plugin: &test_collector_plugin
12+
test-collector#v1.11.0:
13+
files: "build/test-*.xml"
14+
format: "junit"
15+
branches: "main"
16+
debug: true
17+
- bk_analytics_token_plugin: &bk_analytics_token_plugin
18+
elastic/vault-secrets#v0.1.0:
19+
path: "kv/ci-shared/platform-ingest/buildkite_analytics_token"
20+
field: "token"
21+
env_var: "BUILDKITE_ANALYTICS_TOKEN"
22+
- docker_elastic_login_plugin: &docker_elastic_login_plugin
23+
elastic/vault-docker-login#v0.6.0:
24+
secret_path: 'kv/ci-shared/platform-ingest/elastic_docker_registry'
625

726
steps:
827
- group: "Check and build"
@@ -81,24 +100,31 @@ steps:
81100
- build/*.xml
82101
- build/coverage*.out
83102

84-
- label: ":smartbear-testexecute: Run unit tests with requirefips build tag"
103+
- label: ":smartbear-testexecute: Run unit tests with requirefips build tag and FIPS provider"
85104
key: unit-test-fips-tag
86105
command: ".buildkite/scripts/unit_test.sh"
87106
env:
88107
FIPS: "true"
108+
GOEXPERIMENT: "systemcrypto"
109+
GO_DISTRO: "microsoft"
89110
agents:
90-
provider: "gcp"
111+
provider: "aws"
112+
image: "${IMAGE_UBUNTU_X86_64_FIPS}"
113+
instanceType: "m5.xlarge"
91114
artifact_paths:
92115
- build/*.xml
93116
- build/coverage*.out
94117

95-
- label: ":smartbear-testexecute: Run fips140=only unit tests"
118+
- label: ":smartbear-testexecute: Run fips140=only unit tests with FIPS provider"
96119
key: unit-test-fips140-only
97120
command: ".buildkite/scripts/unit_test_fipsonly.sh"
98121
env:
99122
FIPS: "true"
123+
GO_DISTRO: "stdlib"
100124
agents:
101-
provider: "gcp"
125+
provider: "aws"
126+
image: "${IMAGE_UBUNTU_X86_64_FIPS}"
127+
instanceType: "m5.xlarge"
102128
artifact_paths:
103129
- build/*.xml
104130
- build/coverage*.out
@@ -166,7 +192,6 @@ steps:
166192
- label: ":gcloud: Cloud e2e Test"
167193
key: "cloud-e2e-test"
168194
env:
169-
DOCKER_REGISTRY: "docker.elastic.co"
170195
DOCKER_IMAGE: "docker.elastic.co/beats-ci/elastic-agent-cloud-fleet"
171196
DOCKER_IMAGE_TAG: "pr-${BUILDKITE_PULL_REQUEST}-${BUILDKITE_COMMIT:0:12}"
172197
SNAPSHOT: "true"
@@ -175,6 +200,8 @@ steps:
175200
command: ".buildkite/scripts/cloud_e2e_test.sh"
176201
agents:
177202
provider: "gcp"
203+
plugins:
204+
- *docker_elastic_login_plugin
178205
depends_on:
179206
- step: "unit-test"
180207
allow_failure: false
@@ -191,7 +218,6 @@ steps:
191218
- label: ":gcloud: Cloud e2e FIPS Test"
192219
key: "cloud-e2e-fips-test"
193220
env:
194-
DOCKER_REGISTRY: "docker.elastic.co"
195221
DOCKER_BASE_IMAGE: "docker.elastic.co/cloud-release/elastic-agent-cloud-fips"
196222
DOCKER_IMAGE: "docker.elastic.co/beats-ci/elastic-agent-cloud-fips"
197223
DOCKER_IMAGE_TAG: "pr-${BUILDKITE_PULL_REQUEST}-${BUILDKITE_COMMIT:0:12}"
@@ -202,6 +228,8 @@ steps:
202228
command: ".buildkite/scripts/cloud_e2e_test.sh"
203229
agents:
204230
provider: "gcp"
231+
plugins:
232+
- *docker_elastic_login_plugin
205233
depends_on:
206234
- step: "unit-test"
207235
allow_failure: false
@@ -219,14 +247,15 @@ steps:
219247
key: "publish"
220248
command: ".buildkite/scripts/build_push_docker_image.sh"
221249
env:
222-
DOCKER_REGISTRY: "docker.elastic.co"
223250
DOCKER_IMAGE: "docker.elastic.co/observability-ci/fleet-server" # needs to rename for rollback
224251
DOCKER_IMAGE_SHA_TAG: "git-${BUILDKITE_COMMIT:0:12}" # needs to rename for rollback, should be "git-${BUILDKITE_COMMIT:0:12}"
225252
DOCKER_IMAGE_LATEST_TAG: "latest" # needs to rename for rollback
226253
DOCKER_IMAGE_GIT_TAG: "${BUILDKITE_BRANCH}" # needs to rename for rollback
227254
if: "build.env('BUILDKITE_PULL_REQUEST') == 'false' && build.env('BUILDKITE_BRANCH') == 'main'"
228255
agents:
229256
provider: "gcp"
257+
plugins:
258+
- *docker_elastic_login_plugin
230259
depends_on:
231260
- step: "tests"
232261
allow_failure: false

.buildkite/scripts/common.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ with_msft_go() {
5555
echo "Setting up microsoft/go"
5656
create_workspace
5757
check_platform_architeture
58+
59+
# Use a temporary folder to house the Go SDK downloaded from Microsoft
60+
tempfolder=$(mktemp -d)
5861
MSFT_DOWNLOAD_URL=https://aka.ms/golang/release/latest/go$(cat .go-version).${platform_type}-${arch_type}.tar.gz
59-
retry 5 $(curl -sL -o - $MSFT_DOWNLOAD_URL | tar -xz -f - -C ${WORKSPACE})
60-
export PATH="${PATH}:${WORKSPACE}/go/bin"
62+
retry 5 $(curl -sL -o - $MSFT_DOWNLOAD_URL | tar -xz -f - -C ${tempfolder}/)
63+
export PATH="${PATH}:${tempfolder}/go/bin"
6164
go version
6265
which go
6366
export PATH="${PATH}:$(go env GOPATH)/bin"
@@ -90,11 +93,6 @@ retry() {
9093
return 0
9194
}
9295

93-
docker_logout() {
94-
echo "Logging out from Docker..."
95-
docker logout ${DOCKER_REGISTRY}
96-
}
97-
9896
with_Terraform() {
9997
echo "Setting up the Terraform environment..."
10098
local path_to_file="${WORKSPACE}/terraform.zip"

.buildkite/scripts/unit_test.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ source .buildkite/scripts/common.sh
66

77
add_bin_path
88

9-
with_go
9+
if [[ ${FIPS:-false} == "true" && ${GO_DISTRO:-stdlib} == "microsoft" ]]; then
10+
with_msft_go
11+
else
12+
with_go
13+
fi
1014

1115
with_mage
1216

.buildkite/scripts/unit_test_fipsonly.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ source .buildkite/scripts/common.sh
66

77
add_bin_path
88

9-
with_go
9+
if [[ ${FIPS:-false} == "true" && ${GO_DISTRO:-stdlib} == "microsoft" ]]; then
10+
with_msft_go
11+
else
12+
with_go
13+
fi
1014

1115
with_mage
1216

0 commit comments

Comments
 (0)