From: Nathan Cutler Date: Thu, 5 Sep 2019 09:53:47 +0000 (+0200) Subject: script/ceph-backport.sh: stop if GitHub API returns "null" X-Git-Tag: v15.1.0~1586^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=97b6b658ad554336963a9d18455d05ec9457514b;p=ceph.git script/ceph-backport.sh: stop if GitHub API returns "null" Signed-off-by: Nathan Cutler --- diff --git a/src/script/ceph-backport.sh b/src/script/ceph-backport.sh index 0b0f6780d8b0..d3ccccbf87af 100755 --- a/src/script/ceph-backport.sh +++ b/src/script/ceph-backport.sh @@ -445,7 +445,13 @@ if [[ $title =~ \" ]] ; then fi debug "Opening backport PR" -number=$(curl --silent --data-binary '{"title":"'"$title"'","head":"'$github_user':'$local_branch'","base":"'$target_branch'","body":"'"${desc}"'"}' 'https://api.github.com/repos/ceph/ceph/pulls?access_token='$github_token | jq -r .number) +remote_api_output=$(curl --silent --data-binary '{"title":"'"$title"'","head":"'$github_user':'$local_branch'","base":"'$target_branch'","body":"'"${desc}"'"}' 'https://api.github.com/repos/ceph/ceph/pulls?access_token='$github_token) +number=$(echo "$remote_api_output" | jq -r .number) +if [ "$number" = "null" ] ; then + error "Remote API call failed" + echo "$remote_api_output" + exit 1 +fi component=${COMPONENT:-core} info "Opened backport PR ${github_endpoint}/pull/$number" debug "Setting ${component} label"