Skip to content
Snippets Groups Projects
Commit 0143b247 authored by Recolic Keghart's avatar Recolic Keghart
Browse files

curl better error check, uploading validation

parent a13de524
No related branches found
No related tags found
No related merge requests found
......@@ -238,15 +238,16 @@ function cis_wait_for_upload () {
release_ver="$2"
echo2 "Waiting for CIS to create package..."
while true; do
echo2 -n .
sleep 5
# Fail if uploading job failed or blocked, success if pkgid is ready.
try_grep_pkgid "$workflow_name" "$release_ver" && return 0
upload_jobid=`curl_wrapped "https://beta-cps.trafficmanager.net/cis.client.svc/Public/$cis_namespace.$workflow_name/Packages?null" | json2table Actions/ActionLink,Version -p | grep -F "|$release_ver|" | grep -oE '[0-9]+_[0-9a-f-]{36}'` # Ignore the failure because jobid need time to generate.
[[ $novalidate != 1 ]] && upload_jobid=`curl_wrapped "https://beta-cps.trafficmanager.net/cis.client.svc/Public/$cis_namespace.$workflow_name/Packages?null" | json2table Actions/ActionLink,Version -p | grep -F "|$release_ver|" | grep -oE '[0-9]+_[0-9a-f-]{36}'` || continue # Ignore the failure because jobid need time to generate.
if [[ "$upload_jobid" != "" ]]; then
upload_jobstat=`cis_namespace=System cis_get_job_status "$upload_jobid"` || ! echo2 "Failed to check the status of uploading job... The error checking is now disabled, and we are not waiting anymore. " || return 2
upload_jobstat=`cis_namespace=System cis_get_job_status "$upload_jobid"` || ! echo2 "Failed to check the status of uploading job... The error checking is now disabled, and it might wait forever. " || novalidate=1
[[ "$upload_jobstat" = "Blocked" ]] || [[ "$upload_jobstat" = "Failed" ]] && echo2 "Uploading job $upload_jobstat. Stop waiting..." && return 2
fi
echo2 -n .
sleep 5
done
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment