]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph-backport.sh: refuse to cherry-pick from PR that isn't merged
authorNathan Cutler <ncutler@suse.com>
Wed, 23 Oct 2019 11:24:53 +0000 (13:24 +0200)
committerNathan Cutler <ncutler@suse.com>
Wed, 23 Oct 2019 11:25:26 +0000 (13:25 +0200)
Signed-off-by: Nathan Cutler <ncutler@suse.com>
src/script/ceph-backport.sh

index 09e98f862ff494d40ac06a6f285682451802e03a..09585744cc5f604b8179121b4c47dab5d8e4d758 100755 (executable)
@@ -123,6 +123,7 @@ function check_tracker_status {
 
 function cherry_pick_phase {
     local base_branch=
+    local merged=
     local number_of_commits=
     local offset=0
     local singular_or_plural_commit=
@@ -153,6 +154,13 @@ function cherry_pick_phase {
         info "You can still use the script to stage the backport, though. Just prepare the local branch \"${local_branch}\" manually and re-run the script."
         false
     fi
+    merged=$(echo ${remote_api_output} | jq -r .merged)
+    if [ "$merged" = "true" ] ; then
+        true
+    else
+        error "${original_pr_url} is not merged yet: cowardly refusing to perform automated cherry-pick"
+        false
+    fi
     number_of_commits=$(echo ${remote_api_output} | jq .commits)
     if [ "$number_of_commits" -eq "$number_of_commits" ] 2>/dev/null ; then
         # \$number_of_commits is set, and is an integer