From 71d476b1211a255d2945e5ada2fd906c4f90ede9 Mon Sep 17 00:00:00 2001 From: Florian Ruynat Date: Thu, 28 May 2020 21:37:15 +0200 Subject: [PATCH] Auto detect github target branch in rebase script (#6187) --- tests/scripts/rebase.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/scripts/rebase.sh b/tests/scripts/rebase.sh index 3850ab8d3..36cb7f613 100755 --- a/tests/scripts/rebase.sh +++ b/tests/scripts/rebase.sh @@ -1,9 +1,15 @@ #!/bin/bash set -euxo pipefail -# Rebase PRs on master to get latest changes +KUBESPRAY_NEXT_VERSION=2.$(( ${KUBESPRAY_VERSION:3:2} + 1 )) + +# Rebase PRs on master (or release branch) to get latest changes if [[ $CI_COMMIT_REF_NAME == pr-* ]]; then git config user.email "ci@kubespray.io" git config user.name "CI" - git pull --rebase origin master + if [[ -z "`git branch -a --list origin/release-$KUBESPRAY_NEXT_VERSION`" ]]; then + git pull --rebase origin master + else + git pull --rebase origin release-$KUBESPRAY_NEXT_VERSION + fi fi