Skip to content

Commit eea8460

Browse files
[9.0] [CI] Clear EPR cached docker image in an EPR cache verification scenario (elastic#235187) (elastic#235245)
# Backport This will backport the following commits from `main` to `9.0`: - [[CI] Clear EPR cached docker image in an EPR cache verification scenario (elastic#235187)](elastic#235187) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Alex Szabo","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-09-16T16:12:46Z","message":"[CI] Clear EPR cached docker image in an EPR cache verification scenario (elastic#235187)\n\n## Summary\nWe've been getting errors about running out of disk space in EPR image\nvalidation pipelines.\n\nIn those pipelines, we are pulling a new version of EPR, that together\nwith the VM-cached image will deplete our disk in several cases. This PR\nadds an executor-setup step at buildkite's pre-command hook that would\nclear the cache, and make room for the validated image.\n\nCorrect behavior (without FTR retries) can be observed here:\nhttps://buildkite.com/elastic/kibana-package-registry-verify-and-promote/builds/276#_","sha":"15640633f4997245c8695ac1a59c10e275068d79","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Operations","release_note:skip","backport:all-open","v9.2.0"],"title":"[CI] Clear EPR cached docker image in an EPR cache verification scenario","number":235187,"url":"https://github.com/elastic/kibana/pull/235187","mergeCommit":{"message":"[CI] Clear EPR cached docker image in an EPR cache verification scenario (elastic#235187)\n\n## Summary\nWe've been getting errors about running out of disk space in EPR image\nvalidation pipelines.\n\nIn those pipelines, we are pulling a new version of EPR, that together\nwith the VM-cached image will deplete our disk in several cases. This PR\nadds an executor-setup step at buildkite's pre-command hook that would\nclear the cache, and make room for the validated image.\n\nCorrect behavior (without FTR retries) can be observed here:\nhttps://buildkite.com/elastic/kibana-package-registry-verify-and-promote/builds/276#_","sha":"15640633f4997245c8695ac1a59c10e275068d79"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/235187","number":235187,"mergeCommit":{"message":"[CI] Clear EPR cached docker image in an EPR cache verification scenario (elastic#235187)\n\n## Summary\nWe've been getting errors about running out of disk space in EPR image\nvalidation pipelines.\n\nIn those pipelines, we are pulling a new version of EPR, that together\nwith the VM-cached image will deplete our disk in several cases. This PR\nadds an executor-setup step at buildkite's pre-command hook that would\nclear the cache, and make room for the validated image.\n\nCorrect behavior (without FTR retries) can be observed here:\nhttps://buildkite.com/elastic/kibana-package-registry-verify-and-promote/builds/276#_","sha":"15640633f4997245c8695ac1a59c10e275068d79"}}]}] BACKPORT--> Co-authored-by: Alex Szabo <[email protected]>
1 parent 97fd6c3 commit eea8460

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Executor-related setup
5+
6+
echo '--- Executor Setup'
7+
8+
# if FLEET_PACKAGE_REGISTRY_DOCKER_IMAGE is set,
9+
# we should clear previously cached EPR images,
10+
# (as the package registry image is quite big to keep 2 versions of)
11+
DEFAULT_FLEET_PACKAGE_REGISTRY_DOCKER_IMAGE='docker.elastic.co/kibana-ci/package-registry-distribution:lite'
12+
13+
# Test docker is available
14+
if [[ `command -v docker` \
15+
&& -n "${FLEET_PACKAGE_REGISTRY_DOCKER_IMAGE:-}" \
16+
&& "${FLEET_PACKAGE_REGISTRY_DOCKER_IMAGE}" != "${DEFAULT_FLEET_PACKAGE_REGISTRY_DOCKER_IMAGE}" \
17+
]]; then
18+
echo 'Clearing previously cached EPR images'
19+
EPR_IMAGES=$(docker images -q "${DEFAULT_FLEET_PACKAGE_REGISTRY_DOCKER_IMAGE}")
20+
if [[ -n "${EPR_IMAGES}" ]]; then
21+
docker rmi -f "${EPR_IMAGES}"
22+
echo "Cleared ${EPR_IMAGES} EPR images"
23+
fi
24+
fi

.buildkite/scripts/lifecycle/pre_command.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set -euo pipefail
55
source .buildkite/scripts/common/util.sh
66
source .buildkite/scripts/common/env.sh
77
source .buildkite/scripts/common/setup_job_env.sh
8+
source .buildkite/scripts/common/setup_executors.sh
89

910
if [[ "${SKIP_NODE_SETUP:-}" =~ ^(1|true)$ ]]; then
1011
echo "Skipping node setup (SKIP_NODE_SETUP=$SKIP_NODE_SETUP)"

0 commit comments

Comments
 (0)