From 73f57f45927fdda983852e0f8feac2d7d07d1630 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Wed, 11 Oct 2023 12:47:20 -0500 Subject: [PATCH 1/3] Remove homebrew locks to avoid errors about another active Homebrew process being active Signed-off-by: Addisu Z. Taddese --- jenkins-scripts/lib/_homebrew_cleanup.bash | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jenkins-scripts/lib/_homebrew_cleanup.bash b/jenkins-scripts/lib/_homebrew_cleanup.bash index 40d386055..0b31ede4f 100644 --- a/jenkins-scripts/lib/_homebrew_cleanup.bash +++ b/jenkins-scripts/lib/_homebrew_cleanup.bash @@ -39,6 +39,9 @@ git stash && git clean -d -f ${BREW_BINARY} audit cmake || restore_brew popd 2> /dev/null +# Remove any locks to avoid any errors about another active Homebrew process being active. +rm -rf $(${BREW_BINARY} --prefix)/var/homebrew/locks + # test-bot needs variables and does not work just with config not sure why export GIT_AUTHOR_NAME="OSRF Build Bot" export GIT_COMMITTER_NAME=${GIT_AUTHOR_NAME} From 569680033fd77dc77a2d5a29903ffe8709b7a948 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Thu, 12 Oct 2023 11:33:14 -0500 Subject: [PATCH 2/3] Use retries instead Signed-off-by: Addisu Z. Taddese --- jenkins-scripts/lib/_homebrew_cleanup.bash | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/jenkins-scripts/lib/_homebrew_cleanup.bash b/jenkins-scripts/lib/_homebrew_cleanup.bash index 0b31ede4f..76cd0fb93 100644 --- a/jenkins-scripts/lib/_homebrew_cleanup.bash +++ b/jenkins-scripts/lib/_homebrew_cleanup.bash @@ -39,8 +39,15 @@ git stash && git clean -d -f ${BREW_BINARY} audit cmake || restore_brew popd 2> /dev/null -# Remove any locks to avoid any errors about another active Homebrew process being active. -rm -rf $(${BREW_BINARY} --prefix)/var/homebrew/locks +# 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 update || (( brew_update_retry_count++ > 6 )) +do + brew update + sleep 10 +done # test-bot needs variables and does not work just with config not sure why export GIT_AUTHOR_NAME="OSRF Build Bot" From 33c09517ef63c1140be2fff04d4f78d3c2e43b60 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Thu, 12 Oct 2023 13:49:38 -0500 Subject: [PATCH 3/3] Move retries to _homebrew_base_setup Signed-off-by: Addisu Z. Taddese --- jenkins-scripts/lib/_homebrew_base_setup.bash | 10 +++++++++- jenkins-scripts/lib/_homebrew_cleanup.bash | 10 ---------- 2 files changed, 9 insertions(+), 11 deletions(-) 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} \ diff --git a/jenkins-scripts/lib/_homebrew_cleanup.bash b/jenkins-scripts/lib/_homebrew_cleanup.bash index 76cd0fb93..40d386055 100644 --- a/jenkins-scripts/lib/_homebrew_cleanup.bash +++ b/jenkins-scripts/lib/_homebrew_cleanup.bash @@ -39,16 +39,6 @@ git stash && git clean -d -f ${BREW_BINARY} audit cmake || restore_brew popd 2> /dev/null -# 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 update || (( brew_update_retry_count++ > 6 )) -do - brew update - sleep 10 -done - # test-bot needs variables and does not work just with config not sure why export GIT_AUTHOR_NAME="OSRF Build Bot" export GIT_COMMITTER_NAME=${GIT_AUTHOR_NAME}