diff --git a/tests/git-helper.sh b/tests/git-helper.sh index 2217caaec..734462689 100755 --- a/tests/git-helper.sh +++ b/tests/git-helper.sh @@ -17,15 +17,11 @@ function add_kata_bot_info() { } function rebase_atop_of_the_latest_target_branch() { - if [ -n "${TARGET_BRANCH}" ]; then + if [[ -n "${TARGET_BRANCH}" ]]; then echo "Rebasing atop of the latest ${TARGET_BRANCH}" - # Recover from any previous rebase left halfway - git rebase --abort 2> /dev/null || true - if ! git rebase origin/${TARGET_BRANCH}; then - # if GITHUB_WORKSPACE is defined and an architecture is not equal to x86_64 - # (mostly self-hosted runners), then remove the repository - if [ -n "${GITHUB_WORKSPACE}" ] && [ "$(uname -m)" != "x86_64" ]; then - echo "Rebase failed, cleaning up a repository for self-hosted runners and exiting" + if ! git rebase "origin/${TARGET_BRANCH}"; then + if [[ -n "${GITHUB_WORKSPACE}" ]] ; then + echo "Rebase failed, cleaning up the local repository and exiting" cd "${GITHUB_WORKSPACE}"/.. sudo rm -rf "${GITHUB_WORKSPACE}" else