From 3b360599c4e218d5ac34deba260fb7e258c283dd Mon Sep 17 00:00:00 2001 From: David Galloway Date: Wed, 12 Dec 2018 14:48:32 -0500 Subject: [PATCH] sync-pull: Check chacra repos for doneness Helps fix issues like http://tracker.ceph.com/issues/37434 and http://tracker.ceph.com/issues/37545 Signed-off-by: David Galloway --- scripts/sync-pull | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/scripts/sync-pull b/scripts/sync-pull index f3b09759..327dd001 100644 --- a/scripts/sync-pull +++ b/scripts/sync-pull @@ -24,6 +24,20 @@ done echo "Found the most packages ($current_highest_count) in $highest_combo." +# Check the the DEB and RPM chacra endpoints to see if the repos are or need updating. +# This helps prevent packages from getting missed when signing and pushing. +need_rerun=false +for endpoint in https://chacra.ceph.com/repos/$project/$release/$sha1/$highest_combo https://chacra.ceph.com/repos/$project/$release/$sha1/centos/7; do + chacra_repo_status=$(curl -s -L $endpoint) + # python is only used here because jq isn't installed on the signer box + chacra_needs_update=$(echo $chacra_repo_status | python -mjson.tool | grep needs_update | awk '{ print $2 }' | sed 's/,$//') + chacra_is_updating=$(echo $chacra_repo_status | python -mjson.tool | grep is_updating | awk '{ print $2 }' | sed 's/,$//') + + if [ "$chacra_needs_update" == "true" ] || [ "$chacra_is_updating" == "true" ]; then + need_rerun=true + fi +done + # Replace $highest_combo with your own DISTRO/VERSION if you don't want to sync from the repo with the most packages. deb_cmd="ubuntu@chacra.ceph.com:/opt/repos/$project/$release/$sha1/$highest_combo/flavors/default/* /opt/repos/$project/$release/debian/jessie/" echo $deb_cmd @@ -34,3 +48,14 @@ el7_cmd="ubuntu@chacra.ceph.com:/opt/repos/$project/$release/$sha1/centos/7/flav echo $el7_cmd echo "--------------------------------------------" rsync -Lavh -e 'ssh -p 2222' --progress $el7_cmd + +if $need_rerun; then + echo + echo "********************************************" + echo + echo "At least one of the Chacra repos synced was " + echo " still updating before the rsync started." + echo " You should re-run this script!" + echo + echo "********************************************" +fi -- 2.39.5