summaryrefslogtreecommitdiff
path: root/.expeditor
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2019-01-16 15:24:08 -0800
committerTim Smith <tsmith@chef.io>2019-01-16 15:24:08 -0800
commita2898c7b12c4ee8219fcb11ee449bfa91018dbd6 (patch)
tree1bab5925cca951ce551e7482f065711240b5008b /.expeditor
parentc86f10dfb9c898874a58cff92804ef437e3e8e98 (diff)
downloadchef-a2898c7b12c4ee8219fcb11ee449bfa91018dbd6.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>
Diffstat (limited to '.expeditor')
-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 a95ef794e9..4784a0b236 100644
--- a/.expeditor/update_dep.sh
+++ b/.expeditor/update_dep.sh
@@ -11,17 +11,26 @@
set -evx
+function new_gem_included() {
+ git diff | grep -E '^\+' | grep "${GEM_NAME} (${VERSION})"
+}
+
branch="expeditor/${GEM_NAME}_${VERSION}"
git checkout -b "$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 .