Skip to content

Commit 1b4be83

Browse files
donoghucyaauie
authored andcommitted
forward-port observabilitySRE image creation into main
This is a cherry-pick of the merge-commit from the observabilitySRE feature branch into 8.x in PR #17541 (0b1d299), resolving conflicts in `docker/*` and `rakelib/artifacts.rake` by manually migrating the 8.x-style docker structure to the refactored structure present on `main`.
1 parent 95624ab commit 1b4be83

File tree

55 files changed

+1745
-59
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1745
-59
lines changed

.buildkite/pull_request_pipeline.yml

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,27 @@ steps:
1919
export GRADLE_OPTS="-Xmx2g -Dorg.gradle.daemon=false -Dorg.gradle.logging.level=info"
2020
ci/license_check.sh -m 4G
2121
22+
steps:
23+
- label: ":passport_control: License check - Fedramp High Mode"
24+
key: "license-check-fedramp-high"
25+
agents:
26+
provider: gcp
27+
imageProject: elastic-images-prod
28+
image: family/platform-ingest-logstash-ubuntu-2204
29+
machineType: "n2-standard-4"
30+
diskSizeGb: 64
31+
retry:
32+
automatic:
33+
- limit: 3
34+
command: |
35+
set -euo pipefail
36+
37+
source .buildkite/scripts/common/container-agent.sh
38+
export JRUBY_OPTS="-J-Xmx1g"
39+
export GRADLE_OPTS="-Xmx2g -Dorg.gradle.daemon=false -Dorg.gradle.logging.level=info"
40+
docker build -t test-runner-image -f x-pack/distributions/internal/observabilitySRE/docker/Dockerfile .
41+
docker run -e ORG_GRADLE_PROJECT_fedrampHighMode=true test-runner-image ci/license_check.sh -m 4G
42+
2243
- label: ":rspec: Ruby unit tests"
2344
key: "ruby-unit-tests"
2445
agents:
@@ -39,6 +60,25 @@ steps:
3960
artifact_paths:
4061
- "coverage/coverage.json"
4162

63+
- label: ":rspec: Ruby unit tests - FIPS mode"
64+
key: "ruby-unit-tests-fips"
65+
agents:
66+
provider: gcp
67+
imageProject: elastic-images-prod
68+
image: family/platform-ingest-logstash-ubuntu-2204
69+
machineType: "n2-standard-4"
70+
diskSizeGb: 64
71+
retry:
72+
automatic:
73+
- limit: 3
74+
command: |
75+
set -euo pipefail
76+
77+
docker build -t test-runner-image -f x-pack/distributions/internal/observabilitySRE/docker/Dockerfile .
78+
docker run test-runner-image ./gradlew --info --stacktrace -PfedrampHighMode=true rubyTests
79+
artifact_paths:
80+
- "coverage/coverage.json"
81+
4282
- label: ":java: Java unit tests"
4383
key: "java-unit-tests"
4484
agents:
@@ -60,6 +100,29 @@ steps:
60100
- "**/jacocoTestReport.xml"
61101
- "**/build/classes/**/*.*"
62102

103+
- label: ":java: Java unit tests - FIPS mode"
104+
key: "java-unit-tests-fips"
105+
agents:
106+
provider: gcp
107+
imageProject: elastic-images-prod
108+
image: family/platform-ingest-logstash-ubuntu-2204
109+
machineType: "n2-standard-4"
110+
diskSizeGb: 64
111+
retry:
112+
automatic:
113+
- limit: 3
114+
env:
115+
ENABLE_SONARQUBE: true
116+
command: |
117+
set -euo pipefail
118+
119+
docker build -t test-runner-image -f x-pack/distributions/internal/observabilitySRE/docker/Dockerfile .
120+
docker run test-runner-image ./gradlew --info --stacktrace -PfedrampHighMode=true javaTests
121+
artifact_paths:
122+
- "**/build/test-results/javaTests/TEST-*.xml"
123+
- "**/jacocoTestReport.xml"
124+
- "**/build/classes/**/*.*"
125+
63126
- label: ":sonarqube: Continuous Code Inspection"
64127
if: |
65128
build.pull_request.id != null ||
@@ -81,6 +144,82 @@ steps:
81144
manual:
82145
allowed: true
83146

147+
- label: "Observability SRE container smoke test"
148+
key: "observability-sre-container-smoke-test"
149+
agents:
150+
provider: gcp
151+
imageProject: elastic-images-prod
152+
image: family/platform-ingest-logstash-ubuntu-2204
153+
machineType: "n2-standard-4"
154+
diskSizeGb: 64
155+
retry:
156+
automatic:
157+
- limit: 3
158+
command: |
159+
set -euo pipefail
160+
source .buildkite/scripts/common/vm-agent.sh
161+
QUALIFIED_VERSION="$(.buildkite/scripts/common/qualified-version.sh)"
162+
# Build the image locally with the gradle task
163+
./gradlew --stacktrace artifactDockerObservabilitySRE -PfedrampHighMode=true
164+
# Ensure it can at least start logstash
165+
docker run docker.elastic.co/logstash/logstash-observability-sre:$${QUALIFIED_VERSION} \
166+
logstash -e 'input { generator { count => 3 } } output { stdout { codec => rubydebug } }'
167+
# Run the smoke tests on the PR code
168+
docker tag docker.elastic.co/logstash/logstash-observability-sre:$${QUALIFIED_VERSION} \
169+
pr-built-observability-sre-image
170+
./gradlew observabilitySREsmokeTests --stacktrace
171+
172+
- label: ":lab_coat: Integration Tests - FIPS mode / part 1-of-3"
173+
key: "integration-tests-fips-part-1-of-3"
174+
agents:
175+
provider: gcp
176+
imageProject: elastic-images-prod
177+
image: family/platform-ingest-logstash-ubuntu-2204
178+
machineType: "n2-standard-4"
179+
diskSizeGb: 64
180+
retry:
181+
automatic:
182+
- limit: 3
183+
command: |
184+
set -euo pipefail
185+
186+
docker build -t test-runner-image -f x-pack/distributions/internal/observabilitySRE/docker/Dockerfile .
187+
docker run -e FEDRAMP_HIGH_MODE=true test-runner-image ci/integration_tests.sh split 0 3
188+
189+
- label: ":lab_coat: Integration Tests - FIPS mode / part 2-of-3"
190+
key: "integration-tests-fips-part-2-of-3"
191+
agents:
192+
provider: gcp
193+
imageProject: elastic-images-prod
194+
image: family/platform-ingest-logstash-ubuntu-2204
195+
machineType: "n2-standard-4"
196+
diskSizeGb: 64
197+
retry:
198+
automatic:
199+
- limit: 3
200+
command: |
201+
set -euo pipefail
202+
203+
docker build -t test-runner-image -f x-pack/distributions/internal/observabilitySRE/docker/Dockerfile .
204+
docker run -e FEDRAMP_HIGH_MODE=true test-runner-image ci/integration_tests.sh split 1 3
205+
206+
- label: ":lab_coat: Integration Tests - FIPS mode / part 3-of-3"
207+
key: "integration-tests-fips-part-3-of-3"
208+
agents:
209+
provider: gcp
210+
imageProject: elastic-images-prod
211+
image: family/platform-ingest-logstash-ubuntu-2204
212+
machineType: "n2-standard-4"
213+
diskSizeGb: 64
214+
retry:
215+
automatic:
216+
- limit: 3
217+
command: |
218+
set -euo pipefail
219+
220+
docker build -t test-runner-image -f x-pack/distributions/internal/observabilitySRE/docker/Dockerfile .
221+
docker run -e FEDRAMP_HIGH_MODE=true test-runner-image ci/integration_tests.sh split 2 3
222+
84223
- label: ":lab_coat: Integration Tests / part 1-of-3"
85224
key: "integration-tests-part-1-of-3"
86225
agents:
@@ -228,6 +367,40 @@ steps:
228367
source .buildkite/scripts/common/container-agent.sh
229368
x-pack/ci/integration_tests.sh
230369
370+
- label: ":lab_coat: x-pack unit tests - FIPS mode"
371+
key: "x-pack-unit-tests-fips"
372+
agents:
373+
provider: gcp
374+
imageProject: elastic-images-prod
375+
image: family/platform-ingest-logstash-ubuntu-2204
376+
machineType: "n2-standard-4"
377+
diskSizeGb: 64
378+
retry:
379+
automatic:
380+
- limit: 3
381+
command: |
382+
set -euo pipefail
383+
384+
docker build -t test-runner-image -f x-pack/distributions/internal/observabilitySRE/docker/Dockerfile .
385+
docker run -e FEDRAMP_HIGH_MODE=true test-runner-image x-pack/ci/unit_tests.sh
386+
387+
- label: ":lab_coat: x-pack integration - FIPS mode"
388+
key: "integration-tests-x-pack-fips"
389+
agents:
390+
provider: gcp
391+
imageProject: elastic-images-prod
392+
image: family/platform-ingest-logstash-ubuntu-2204
393+
machineType: "n2-standard-4"
394+
diskSizeGb: 64
395+
retry:
396+
automatic:
397+
- limit: 3
398+
command: |
399+
set -euo pipefail
400+
401+
docker build -t test-runner-image -f x-pack/distributions/internal/observabilitySRE/docker/Dockerfile .
402+
docker run -e FEDRAMP_HIGH_MODE=true test-runner-image x-pack/ci/integration_tests.sh
403+
231404
- wait: ~
232405
continue_on_failure: true
233406

.buildkite/scripts/common/qualified-version.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ export QUALIFIED_VERSION="$(
1717
# e.g: 8.0.0-alpha1
1818
printf '%s' "${VERSION_QUALIFIER:+-${VERSION_QUALIFIER}}"
1919
20+
# Include git SHA if requested
21+
if [[ -n "${INCLUDE_COMMIT_ID:+x}" ]]; then
22+
printf '%s' "-$(git rev-parse --short HEAD)"
23+
fi
24+
2025
# add the SNAPSHOT tag unless WORKFLOW_TYPE=="staging" or RELEASE=="1"
2126
if [[ ! ( "${WORKFLOW_TYPE:-}" == "staging" || "${RELEASE:+$RELEASE}" == "1" ) ]]; then
2227
printf '%s' "-SNAPSHOT"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
# Script to build and publish ObservabilitySRE container
3+
# Currently this is built on a host with the target architecture.
4+
# This allows us to utilize the make file for building the container and
5+
# to ensure the best compatability with the host architecture.
6+
# A later step in CI will take care of pushing a tag that references the right
7+
# image using `docker manifest` commands.
8+
9+
echo "Setting up environment"
10+
source .buildkite/scripts/common/vm-agent.sh
11+
source .buildkite/scripts/dra/docker-env-setup.sh
12+
13+
echo "Building ObservabilitySRE container"
14+
./gradlew --stacktrace artifactDockerObservabilitySRE -PfedrampHighMode=true
15+
16+
echo "Pushing ObservabilitySRE container to Docker repository"
17+
docker_login
18+
19+
# Get qualified version without SHA (this is what the gradle task will produce)
20+
QUALIFIED_VERSION="$(.buildkite/scripts/common/qualified-version.sh)"
21+
22+
# Set environment variable to include SHA and get version with SHA
23+
QUALIFIED_VERSION_WITH_SHA="$(INCLUDE_COMMIT_ID=1 .buildkite/scripts/common/qualified-version.sh)"
24+
25+
REGISTRY_PATH=docker.elastic.co/logstash/logstash-observability-sre
26+
27+
# Current architecture
28+
ARCH="${ARCH:-x86_64}" # Default to x86_64 if ARCH is not set
29+
echo "Architecture: ${ARCH}"
30+
31+
# Create the full tag with SHA and architecture
32+
FULL_TAG="${QUALIFIED_VERSION_WITH_SHA}-${ARCH}"
33+
echo "Tagging and pushing: ${REGISTRY_PATH}:${QUALIFIED_VERSION} as ${REGISTRY_PATH}:${FULL_TAG}"
34+
docker tag ${REGISTRY_PATH}:${QUALIFIED_VERSION} ${REGISTRY_PATH}:${FULL_TAG}
35+
docker push ${REGISTRY_PATH}:${FULL_TAG}
36+
37+
# Teardown Docker environment
38+
source .buildkite/scripts/dra/docker-env-teardown.sh

.buildkite/scripts/dra/generatesteps.py

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,61 @@ def package_aarch64_docker_step(branch, workflow_type):
7979

8080
return step
8181

82+
def ship_observability_sre_image_steps(branch, workflow_type):
83+
step = f'''
84+
- label: ":package: Build & Ship aarch64 ObservabilitySRE container / {branch}-{workflow_type.upper()}"
85+
key: "logstash_build_and_ship_observability_sre_aarch64"
86+
soft_fail: true
87+
depends_on: logstash_publish_dra
88+
agents:
89+
provider: aws
90+
imagePrefix: platform-ingest-logstash-ubuntu-2204-aarch64
91+
instanceType: "m6g.4xlarge"
92+
diskSizeGb: 200
93+
artifact_paths:
94+
- "**/*.hprof"
95+
command: |
96+
export WORKFLOW_TYPE="{workflow_type}"
97+
export PATH="/opt/buildkite-agent/.rbenv/bin:/opt/buildkite-agent/.pyenv/bin:$PATH"
98+
export ARCH="aarch64"
99+
eval "$(rbenv init -)"
100+
.buildkite/scripts/dra/build-and-push-observability-sre.sh
101+
- label: ":package: Build & Ship x86_64 ObservabilitySRE container / {branch}-{workflow_type.upper()}"
102+
key: "logstash_build_and_ship_observability_sre_x86_64"
103+
soft_fail: true
104+
depends_on: logstash_publish_dra
105+
agents:
106+
provider: gcp
107+
imageProject: elastic-images-prod
108+
image: family/platform-ingest-logstash-ubuntu-2204
109+
machineType: "n2-standard-16"
110+
diskSizeGb: 200
111+
artifact_paths:
112+
- "**/*.hprof"
113+
command: |
114+
export WORKFLOW_TYPE="{workflow_type}"
115+
export PATH="/opt/buildkite-agent/.rbenv/bin:/opt/buildkite-agent/.pyenv/bin:$PATH"
116+
export ARCH="x86_64"
117+
eval "$(rbenv init -)"
118+
.buildkite/scripts/dra/build-and-push-observability-sre.sh
119+
- label: ":docker: Create & Push ObservabilitySRE Multi-Arch Manifest / {branch}-{workflow_type.upper()}"
120+
key: "logstash_create_observability_sre_manifest"
121+
depends_on:
122+
- "logstash_build_and_ship_observability_sre_aarch64"
123+
- "logstash_build_and_ship_observability_sre_x86_64"
124+
agents:
125+
provider: gcp
126+
imageProject: elastic-images-prod
127+
image: family/platform-ingest-logstash-ubuntu-2204
128+
machineType: "n2-standard-8"
129+
command: |
130+
export WORKFLOW_TYPE="{workflow_type}"
131+
export PATH="/opt/buildkite-agent/.rbenv/bin:/opt/buildkite-agent/.pyenv/bin:$PATH"
132+
eval "$(rbenv init -)"
133+
.buildkite/scripts/dra/multi-architecture-observability-sre.sh
134+
'''
135+
return step
136+
82137
def publish_dra_step(branch, workflow_type, depends_on):
83138
step = f'''
84139
- label: ":elastic-stack: Publish / {branch}-{workflow_type.upper()} DRA artifacts"
@@ -139,9 +194,14 @@ def build_steps_to_yaml(branch, workflow_type):
139194
"steps": build_steps_to_yaml(branch, workflow_type),
140195
})
141196

142-
# Final step: pull artifacts built above and publish them via the release-manager
197+
# Pull artifacts built above and publish them via the release-manager
143198
structure["steps"].extend(
144199
yaml.safe_load(publish_dra_step(branch, workflow_type, depends_on=group_key)),
145200
)
146201

202+
# Once published, do the same for observabilitySRE image
203+
structure["steps"].extend(
204+
yaml.safe_load(ship_observability_sre_image_steps(branch, workflow_type)),
205+
)
206+
147207
print(YAML_HEADER + yaml.dump(structure, Dumper=yaml.Dumper, sort_keys=False))
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
# Script to create and push Docker manifest for multi-architecture support
3+
# This MUST be run after build-and-push-observabilty-sre.sh!
4+
5+
source .buildkite/scripts/common/vm-agent.sh
6+
source .buildkite/scripts/dra/docker-env-setup.sh
7+
8+
docker_login
9+
10+
# Set INCLUDE_COMMIT_ID to include git SHA in version
11+
QUALIFIED_VERSION="$(INCLUDE_COMMIT_ID=1 .buildkite/scripts/common/qualified-version.sh)"
12+
REGISTRY_PATH=docker.elastic.co/logstash/logstash-observability-sre
13+
14+
# Architecture-specific tags (created by the build steps)
15+
X86_64_TAG="${QUALIFIED_VERSION}-x86_64"
16+
AARCH64_TAG="${QUALIFIED_VERSION}-aarch64"
17+
18+
# Target manifest tags - already has SHA from QUALIFIED_VERSION
19+
VERSION_MANIFEST_TAG="${QUALIFIED_VERSION}"
20+
21+
# Create and push manifest with version (which already includes SHA)
22+
echo "Creating manifest list for: ${REGISTRY_PATH}:${VERSION_MANIFEST_TAG}"
23+
docker manifest create ${REGISTRY_PATH}:${VERSION_MANIFEST_TAG} \
24+
${REGISTRY_PATH}:${X86_64_TAG} \
25+
${REGISTRY_PATH}:${AARCH64_TAG}
26+
27+
docker manifest annotate ${REGISTRY_PATH}:${VERSION_MANIFEST_TAG} \
28+
${REGISTRY_PATH}:${X86_64_TAG} --os linux --arch amd64
29+
30+
docker manifest annotate ${REGISTRY_PATH}:${VERSION_MANIFEST_TAG} \
31+
${REGISTRY_PATH}:${AARCH64_TAG} --os linux --arch arm64
32+
33+
echo "Pushing manifest: ${REGISTRY_PATH}:${VERSION_MANIFEST_TAG}"
34+
docker manifest push ${REGISTRY_PATH}:${VERSION_MANIFEST_TAG}
35+
36+
# Also create version without SHA for effective "latest" tag
37+
BASE_VERSION="$(.buildkite/scripts/common/qualified-version.sh)"
38+
echo "Creating manifest list for: ${REGISTRY_PATH}:${BASE_VERSION}"
39+
docker manifest create ${REGISTRY_PATH}:${BASE_VERSION} \
40+
${REGISTRY_PATH}:${X86_64_TAG} \
41+
${REGISTRY_PATH}:${AARCH64_TAG}
42+
43+
docker manifest annotate ${REGISTRY_PATH}:${BASE_VERSION} \
44+
${REGISTRY_PATH}:${X86_64_TAG} --os linux --arch amd64
45+
46+
docker manifest annotate ${REGISTRY_PATH}:${BASE_VERSION} \
47+
${REGISTRY_PATH}:${AARCH64_TAG} --os linux --arch arm64
48+
49+
echo "Pushing manifest: ${REGISTRY_PATH}:${BASE_VERSION}"
50+
docker manifest push ${REGISTRY_PATH}:${BASE_VERSION}
51+
52+
# Teardown Docker environment
53+
source .buildkite/scripts/dra/docker-env-teardown.sh

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
jruby-9.4.9.0
1+
jruby-9.4.13.0

0 commit comments

Comments
 (0)