]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
script/ceph-backport.sh: set target_branch in API case
authorNathan Cutler <ncutler@suse.com>
Mon, 23 Mar 2020 15:46:02 +0000 (16:46 +0100)
committerNathan Cutler <ncutler@suse.com>
Tue, 24 Mar 2020 09:36:57 +0000 (10:36 +0100)
When we falling back to the GitHub API to determine the milestone
number, we were not initializing target_branch, so the script was
broken for octopus backports.

Signed-off-by: Nathan Cutler <ncutler@suse.com>
src/script/ceph-backport.sh

index 5b969263ac640d48c4efba51416e37c071f6778e..c37821fd3ed0ba31a8fa67ebd75b0a5ceeed60c4 100755 (executable)
@@ -895,7 +895,6 @@ function milestone_number_from_remote_api {
     local mtt="$1"  # milestone to try
     local mn=""     # milestone number
     local milestones
-    warning "Milestone ->$mtt<- unknown to script - falling back to GitHub API"
     remote_api_output=$(curl -u ${github_user}:${github_token} --silent -X GET "https://api.github.com/repos/ceph/ceph/milestones")
     mn=$(echo "$remote_api_output" | jq --arg milestone "$mtt" '.[] | select(.title==$milestone) | .number')
     if [ "$mn" -gt "0" ] >/dev/null 2>&1 ; then
@@ -1620,10 +1619,12 @@ fi
 
 milestone_number=$(try_known_milestones "$milestone")
 if [ "$milestone_number" -gt "0" ] >/dev/null 2>&1 ; then
-    target_branch="$milestone"
+    debug "Milestone ->$milestone<- is known to have number ->$milestone_number<-: skipping remote API call"
 else
+    warning "Milestone ->$milestone<- is unknown to the script: falling back to GitHub API"
     milestone_number=$(milestone_number_from_remote_api "$milestone")
 fi
+target_branch="$milestone"
 info "milestone/release is $milestone"
 debug "milestone number is $milestone_number"