From 178ea7fa6c663037d71c6e338d1cf20de1288c36 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Thu, 12 Oct 2023 17:15:56 -0500 Subject: [PATCH] Retry brew update to fix errors about another active Homebrew process being active (#1032) Signed-off-by: Addisu Z. Taddese --- jenkins-scripts/lib/_homebrew_base_setup.bash | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/jenkins-scripts/lib/_homebrew_base_setup.bash b/jenkins-scripts/lib/_homebrew_base_setup.bash index 35d2308fc..dfd607e91 100644 --- a/jenkins-scripts/lib/_homebrew_base_setup.bash +++ b/jenkins-scripts/lib/_homebrew_base_setup.bash @@ -16,7 +16,15 @@ fi git -C $(${BREW_BINARY} --repo) fsck export HOMEBREW_UPDATE_TO_TAG=1 -${BREW_BINARY} update + +# There might be a background process that blocks `brew update`, so we try to +# run it several times until it succeeds. +# See https://github.com/Homebrew/brew/issues/1155 +brew_update_retry_count=0 +until ${BREW_BINARY} update || (( brew_update_retry_count++ > 6 )) +do + sleep 10 +done # manually exclude a ruby warning that jenkins thinks is from clang # https://github.com/osrf/homebrew-simulation/issues/1343 ${BREW_BINARY} install ${BREW_BASE_DEPENDCIES} \