summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2019-01-16 15:20:15 -0800
committerTim Smith <tsmith@chef.io>2019-01-16 15:20:15 -0800
commit5ec7f47ea75b563fc40a2ef297a4191318f7c254 (patch)
tree068ad15c2bdfe4c5311ecc68ea5180d9689c4bd3
parent064a7dbe5b3bc4e225f5d657638283f3fb8b9f95 (diff)
downloadchef-5ec7f47ea75b563fc40a2ef297a4191318f7c254.tar.gz
Pull in the gem update retry logic from DK
Pulls in the logic that tyler wrote in DK that performs retries and validates that the gem was actually updated. This preventts empty PRs from being opened and shortens the time the job takes to run. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--.expeditor/update_dep.sh21
1 files changed, 15 insertions, 6 deletions
diff --git a/.expeditor/update_dep.sh b/.expeditor/update_dep.sh
index 6114e71b73..5b7029525c 100644
--- a/.expeditor/update_dep.sh
+++ b/.expeditor/update_dep.sh
@@ -11,6 +11,10 @@
set -evx
+function new_gem_included() {
+ git diff | grep -E '^\+' | grep "${GEM_NAME} (${VERSION})"
+}
+
release_branch="chef-14"
new_branch="expeditor/${GEM_NAME}_${VERSION}"
git checkout "$release_branch"
@@ -18,12 +22,17 @@ git checkout -b "$new_branch"
bundle install
-# it appears that the gem that triggers this script fires off this script before
-# the gem is actually available via bundler on rubygems.org.
-sleep 240
-
-gem install rake
-rake dependencies:update_gemfile_lock
+tries=12
+for (( i=1; i<=$tries; i+=1 )); do
+ bundle exec rake dependencies:update_gemfile_lock
+ new_gem_included && break || sleep 20
+ if [ $i -eq $tries ]; then
+ echo "Searching for '${GEM_NAME} (${VERSION})' ${i} times and did not find it"
+ exit 1
+ else
+ echo "Searched ${i} times for '${GEM_NAME} (${VERSION})'"
+ fi
+done
git add .