Skip to content

Commit 8cc2b90

Browse files
committed
Move POC code into DRA pipeline
This commit takes the POC from the pull_request_pipeline and adds it to the DRA pipeline. Noteably, we take care to not disrupt anything about the existing DRA pipeline by making this wait until after the artifacts are published and we set a soft_fail. While this is being introduced and stabilized we want to ensure the existing DRA pipeline continues to work without interruption. As we get more stability we can look at a tigther integration.
1 parent 297226b commit 8cc2b90

File tree

3 files changed

+74
-25
lines changed

3 files changed

+74
-25
lines changed

.buildkite/pull_request_pipeline.yml

-24
Original file line numberDiff line numberDiff line change
@@ -142,30 +142,6 @@ steps:
142142
docker run docker.elastic.co/logstash/logstash-observability-sre:$${QUALIFIED_VERSION} \
143143
logstash -e 'input { generator { count => 3 } } output { stdout { codec => rubydebug } }'
144144
145-
- label: "Observability SRE publishing POC"
146-
key: "observability-sre-container-publishing-poc"
147-
agents:
148-
provider: gcp
149-
imageProject: elastic-images-prod
150-
image: family/platform-ingest-logstash-ubuntu-2204
151-
machineType: "n2-standard-4"
152-
diskSizeGb: 64
153-
command: |
154-
set -euo pipefail
155-
source .buildkite/scripts/common/vm-agent.sh
156-
source .buildkite/scripts/dra/docker-env-setup.sh
157-
docker_login
158-
QUALIFIED_VERSION="$(.buildkite/scripts/common/qualified-version.sh)"
159-
SHA="$(git rev-parse --short HEAD)"
160-
DOCKER_REPOSITORY=docker.elastic.co/logstash/logstash-observability-sre
161-
echo $${DOCKER_REPOSITORY}:$${QUALIFIED_VERSION}-$${SHA}
162-
./gradlew --stacktrace artifactDockerObservabilitySRE -PfedrampHighMode=true
163-
docker tag $${DOCKER_REPOSITORY}:$${QUALIFIED_VERSION} $${DOCKER_REPOSITORY}:$${QUALIFIED_VERSION}-$${SHA}
164-
docker push $${DOCKER_REPOSITORY}:$${QUALIFIED_VERSION}-$${SHA}
165-
docker tag $${DOCKER_REPOSITORY}:$${QUALIFIED_VERSION} $${DOCKER_REPOSITORY}:$${QUALIFIED_VERSION}-latest
166-
docker push $${DOCKER_REPOSITORY}:$${QUALIFIED_VERSION}-latest
167-
source .buildkite/scripts/dra/docker-env-teardown.sh
168-
169145
- label: ":lab_coat: Integration Tests - FIPS mode / part 1-of-3"
170146
key: "integration-tests-fips-part-1-of-3"
171147
agents:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
# Script to build and publish ObservabilitySRE container
3+
4+
echo "Setting up environment"
5+
source .buildkite/scripts/common/vm-agent.sh
6+
source .buildkite/scripts/dra/docker-env-setup.sh
7+
8+
echo "Building ObservabilitySRE container"
9+
./gradlew --stacktrace artifactDockerObservabilitySRE -PfedrampHighMode=true
10+
11+
echo "Pushing ObservabilitySRE container to Docker repository"
12+
docker_login
13+
QUALIFIED_VERSION="$(.buildkite/scripts/common/qualified-version.sh)"
14+
SHA="$(git rev-parse --short HEAD)"
15+
REGISTRY_PATH=docker.elastic.co/logstash/logstash-observability-sre
16+
17+
if [[ "${WORKFLOW_TYPE}" == "staging" ]]; then
18+
# For staging builds, Push the original qualified version
19+
# Ex: docker.elastic.co/logstash/logstash-observability-sre:8.19.0
20+
docker push ${REGISTRY_PATH}:${QUALIFIED_VERSION}
21+
fi
22+
23+
# For both staging and snapshot builds push the qualified version + the sha
24+
# Ex: docker.elastic.co/logstash/logstash-observability-sre:8.19.0-SNAPSHOT-297226b1df
25+
SHA_TAG="${QUALIFIED_VERSION}-${SHA}"
26+
docker tag ${REGISTRY_PATH}:${QUALIFIED_VERSION} ${REGISTRY_PATH}:${SHA_TAG}
27+
docker push ${REGISTRY_PATH}:${SHA_TAG}
28+
29+
# Teardown Docker environment
30+
source .buildkite/scripts/dra/docker-env-teardown.sh

.buildkite/scripts/dra/generatesteps.py

+44-1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,44 @@ 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+
agents:
88+
provider: aws
89+
imagePrefix: platform-ingest-logstash-ubuntu-2204-aarch64
90+
instanceType: "m6g.4xlarge"
91+
diskSizeGb: 200
92+
artifact_paths:
93+
- "**/*.hprof"
94+
command: |
95+
export WORKFLOW_TYPE="{workflow_type}"
96+
export PATH="/opt/buildkite-agent/.rbenv/bin:/opt/buildkite-agent/.pyenv/bin:$PATH"
97+
export ARCH="aarch64"
98+
eval "$(rbenv init -)"
99+
.buildkite/scripts/dra/build-and-push-observability-sre.sh
100+
- label: ":package: Build & Ship x86_64 ObservabilitySRE container / {branch}-{workflow_type.upper()}"
101+
key: "logstash_build_and_ship_observability_sre_x86_64"
102+
soft_fail: true
103+
agents:
104+
provider: gcp
105+
imageProject: elastic-images-prod
106+
image: family/platform-ingest-logstash-ubuntu-2204
107+
machineType: "n2-standard-16"
108+
diskSizeGb: 200
109+
artifact_paths:
110+
- "**/*.hprof"
111+
command: |
112+
export WORKFLOW_TYPE="{workflow_type}"
113+
export PATH="/opt/buildkite-agent/.rbenv/bin:/opt/buildkite-agent/.pyenv/bin:$PATH"
114+
export ARCH="x86_64"
115+
eval "$(rbenv init -)"
116+
.buildkite/scripts/dra/build-and-push-observability-sre.sh
117+
'''
118+
return step
119+
82120
def publish_dra_step(branch, workflow_type, depends_on):
83121
step = f'''
84122
- label: ":elastic-stack: Publish / {branch}-{workflow_type.upper()} DRA artifacts"
@@ -139,9 +177,14 @@ def build_steps_to_yaml(branch, workflow_type):
139177
"steps": build_steps_to_yaml(branch, workflow_type),
140178
})
141179

142-
# Final step: pull artifacts built above and publish them via the release-manager
180+
# Pull artifacts built above and publish them via the release-manager
143181
structure["steps"].extend(
144182
yaml.safe_load(publish_dra_step(branch, workflow_type, depends_on=group_key)),
145183
)
146184

185+
# Once published, do the same for observabilitySRE image
186+
structure["steps"].extend(
187+
yaml.safe_load(ship_observability_sre_image_steps(branch, workflow_type)),
188+
)
189+
147190
print(YAML_HEADER + yaml.dump(structure, Dumper=yaml.Dumper, sort_keys=False))

0 commit comments

Comments
 (0)