From 0c59cc84dd24aebc2477e7a9f6f4846566b66822 Mon Sep 17 00:00:00 2001 From: Max Gautier Date: Mon, 17 Mar 2025 16:45:55 +0100 Subject: [PATCH] CI: simplify rebase.sh With the base ref (aka: target branch) available, we don't need to guess stuff from the branch name --- .gitlab-ci.yml | 5 +++++ tests/scripts/rebase.sh | 17 ++++------------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cf4c017b8..c1095a1e3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,6 +9,11 @@ variables: KUBESPRAY_VERSION: v2.27.0 FAILFASTCI_NAMESPACE: 'kargo-ci' GITLAB_REPOSITORY: 'kargo-ci/kubernetes-sigs-kubespray' + GIT_CONFIG_COUNT: 1 + GIT_CONFIG_KEY_0: user.key + GIT_CONFIG_VALUE_0: "ci@kubespray.io" + GIT_CONFIG_KEY_1: user.name + GIT_CONFIG_VALUE_1: "CI" ANSIBLE_FORCE_COLOR: "true" MAGIC: "ci check this" GS_ACCESS_KEY_ID: $GS_KEY diff --git a/tests/scripts/rebase.sh b/tests/scripts/rebase.sh index 36cb7f613..6ea59e317 100755 --- a/tests/scripts/rebase.sh +++ b/tests/scripts/rebase.sh @@ -1,15 +1,6 @@ -#!/bin/bash -set -euxo pipefail +#!/bin/sh +set -ex -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" - 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 +if [ "${GITHUB_BASE_REF}" ]; then + git pull --rebase origin $GITHUB_BASE_REF fi