From 04adcdace60fe6de37a3c3f6cb9347e6d7119435 Mon Sep 17 00:00:00 2001 From: Dan Mihai Date: Thu, 6 Mar 2025 18:45:47 +0000 Subject: [PATCH 1/2] gha: always delete workspace on rebase error The workplace was already being deleted on non-x86_64 platforms, but x86_64 can be affected by the same problem too. That might have been the case with the SNP and TDX test runs from: https://github.com/kata-containers/kata-containers/actions/runs/13687511270/job/38313758751?pr=10973 https://github.com/kata-containers/kata-containers/actions/runs/13687511270/job/38313760086?pr=10973 Rebase worked fine for the same patch/PR on other platforms. Signed-off-by: Dan Mihai --- tests/git-helper.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/git-helper.sh b/tests/git-helper.sh index 2217caaec..edf935886 100755 --- a/tests/git-helper.sh +++ b/tests/git-helper.sh @@ -19,13 +19,9 @@ function add_kata_bot_info() { function rebase_atop_of_the_latest_target_branch() { 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 [ -n "${GITHUB_WORKSPACE}" ] ; then + echo "Rebase failed, cleaning up the local repository and exiting" cd "${GITHUB_WORKSPACE}"/.. sudo rm -rf "${GITHUB_WORKSPACE}" else From 7b63f256e51f348436c4de66121730ffa26138dc Mon Sep 17 00:00:00 2001 From: Dan Mihai Date: Thu, 6 Mar 2025 20:28:41 +0000 Subject: [PATCH 2/2] gha: fix git-helper issues reported by shellcheck ./tests/git-helper.sh:20:5: note: Prefer [[ ]] over [ ] for tests in Bash/Ksh. [SC2292] ./tests/git-helper.sh:22:26: note: Double quote to prevent globbing and word splitting. [SC2086] ./tests/git-helper.sh:23:7: note: Prefer [[ ]] over [ ] for tests in Bash/Ksh. [SC2292] Signed-off-by: Dan Mihai --- tests/git-helper.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/git-helper.sh b/tests/git-helper.sh index edf935886..734462689 100755 --- a/tests/git-helper.sh +++ b/tests/git-helper.sh @@ -17,10 +17,10 @@ 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}" - if ! git rebase origin/${TARGET_BRANCH}; then - if [ -n "${GITHUB_WORKSPACE}" ] ; then + 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}"