From 66f1100bc8c38edde0cd234647849c048443f2e1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 18 Nov 2026 07:27:16 +0000 Subject: [PATCH] Added retries for yum update on rhel build hosts testing-pr on rhel-8/rhel-9 build hosts sometimes failed with "Failed to download metadata for repo 'epel': All mirrors were tried" because EPEL mirrors were broken or out of sync. yum update is now retried up to 3 times, cleaning metadata between attempts. Ticket: ENT-14783 Changelog: none Signed-off-by: Ihor Aleksandrychiev (cherry picked from commit 2232e3645aa800ee2028ca6bce48d54f013fe3f7) --- ci/setup-cfengine-build-host.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/ci/setup-cfengine-build-host.sh b/ci/setup-cfengine-build-host.sh index 25158578d..1b3bbb609 100755 --- a/ci/setup-cfengine-build-host.sh +++ b/ci/setup-cfengine-build-host.sh @@ -36,6 +36,21 @@ function chown-root-owned-to-jenkins() { # Make zypper (including calls from cf-agent below) wait for the lock instead. export ZYPP_LOCK_TIMEOUT=300 +# ENT-14783 EPEL mirrors are sometimes broken or out of sync, so retry yum update with metadata clean +function yum-update-with-retries() { + attempts=3 + for attempt in 1 2 3; do + yum update --assumeyes && return 0 + if [ "$attempt" -lt "$attempts" ]; then + echo "yum update failed (attempt $attempt of $attempts), retrying in 30 seconds" + yum clean metadata || true + sleep 30 + fi + done + echo "yum update failed after $attempts attempts" + return 1 +} + ls -la /home/ if ! id -u jenkins; then useradd jenkins -p jenkins @@ -135,7 +150,7 @@ echo "Using buildscripts commit:" echo "Install distribution upgrades and set software alias for platform" if [ -f /etc/os-release ]; then if grep -q rhel /etc/os-release; then - yum update --assumeyes + yum-update-with-retries alias software='yum install --assumeyes' alias erase-packages='yum erase --assumeyes' elif grep -q debian /etc/os-release; then @@ -173,7 +188,7 @@ if [ -f /etc/os-release ]; then exit 1 fi elif [ -f /etc/redhat-release ]; then - yum update --assumeyes + yum-update-with-retries alias software='yum install --assumeyes' alias erase-packages='yum erase --assumeyes' else