Skip to content

Commit 117fd69

Browse files
Merge pull request #25309 from Luap99/cirrus-branch
cirrus: figure out DEST_BRANCH automatically
2 parents a5f6148 + 731ef3f commit 117fd69

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

.cirrus.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ env:
55
####
66
#### Global variables used for all tasks
77
####
8-
# Name of the ultimate destination branch for this CI run, PR or post-merge.
9-
DEST_BRANCH: "main"
108
# Sane (default) value for GOPROXY and GOSUMDB.
119
GOPROXY: "https://proxy.golang.org,direct"
1210
GOSUMDB: "sum.golang.org"
@@ -106,6 +104,11 @@ validate-source_task:
106104
cd /
107105
rm -rf $CIRRUS_WORKING_DIR
108106
mkdir -p $CIRRUS_WORKING_DIR
107+
if [[ -z "$CIRRUS_PR" ]]; then
108+
DEST_BRANCH="$CIRRUS_BRANCH"
109+
else
110+
DEST_BRANCH="$CIRRUS_BASE_BRANCH"
111+
fi
109112
git clone --recursive --branch=$DEST_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR
110113
cd $CIRRUS_WORKING_DIR
111114
git remote update origin
@@ -772,7 +775,7 @@ podman_machine_windows_task:
772775
<<: *windows
773776
type: m5zn.metal
774777
platform: windows
775-
timeout_in: 45m
778+
timeout_in: 60m
776779
env: *winenv
777780
matrix:
778781
- env:
@@ -795,7 +798,7 @@ podman_machine_mac_task:
795798
skip: *skip_rhel_release
796799
depends_on: *build
797800
persistent_worker: *mac_pw
798-
timeout_in: 45m
801+
timeout_in: 60m
799802
env:
800803
<<: *mac_env
801804
DISTRO_NV: "darwin"

contrib/cirrus/lib.sh

+19
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,25 @@ fi
3636
# Managed by setup_environment.sh; holds task-specific definitions.
3737
if [[ -r "/etc/ci_environment" ]]; then source /etc/ci_environment; fi
3838

39+
# Set DEST_BRANCH automatically, this var used for many checks,
40+
# i.e. to find out the merge base to do build/commit checks.
41+
# To avoid having to set it manually for each branch try to
42+
# generate based of the CIRRUS env.
43+
# shellcheck disable=SC2154
44+
if [[ -z "$CIRRUS_PR" ]]; then
45+
# shellcheck disable=SC2154
46+
DEST_BRANCH="$CIRRUS_BRANCH"
47+
else
48+
# shellcheck disable=SC2154
49+
DEST_BRANCH="$CIRRUS_BASE_BRANCH"
50+
fi
51+
if [[ -z "${DEST_BRANCH}" ]]; then
52+
die "DEST_BRANCH is undefined, not running under cirrus?"
53+
fi
54+
msg "DEST_BRANCH is $DEST_BRANCH"
55+
export DEST_BRANCH
56+
57+
3958
# This is normally set from .cirrus.yml but default is necessary when
4059
# running under hack/get_ci_vm.sh since it cannot infer the value.
4160
DISTRO_NV="${DISTRO_NV:-$OS_REL_VER}"

contrib/cirrus/prebuild.sh

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ set -eo pipefail
1212
set -a
1313
source /etc/automation_environment
1414
source $AUTOMATION_LIB_PATH/common_lib.sh
15+
# shellcheck source=contrib/cirrus/lib.sh
16+
source $(dirname $0)/lib.sh
1517
set +a
1618

1719
req_env_vars CI DEST_BRANCH IMAGE_SUFFIX TEST_FLAVOR TEST_ENVIRON \

0 commit comments

Comments
 (0)