Verify both repos before attempting release
[releng/global-jjb.git] / shell / release-job.sh
index 6510ce5..3a36a57 100644 (file)
@@ -75,11 +75,17 @@ nexus_release(){
     lftools nexus release -v --server https://"$NEXUS_URL" "$STAGING_REPO"
     echo "Merge will run"
     echo "lftools nexus release --server https://$NEXUS_URL $STAGING_REPO"
-    if [[ "$JOB_NAME" =~ "merge" ]]; then
+  done
+  #Run the loop twice, to catch errors on either nexus repo
+
+  if [[ "$JOB_NAME" =~ "merge" ]]; then
+    for staging_url in $(zcat "$PATCH_DIR"/staging-repo.txt.gz | awk -e '{print $2}'); do
+      NEXUS_URL=$(echo "$staging_url" | sed -e 's|^[^/]*//||' -e 's|/.*$||')
+      STAGING_REPO=${staging_url#*repositories/}
       echo "Promoting $STAGING_REPO on $NEXUS_URL."
       lftools nexus release --server https://"$NEXUS_URL" "$STAGING_REPO"
-    fi
-  done
+    done
+  fi
 }