Skip to content

Commit 86a27f2

Browse files
Merge pull request #21777 from cevich/fix_mac_clone
Cirrus: Reuse shared clone script on Mac
2 parents 59b6f48 + c4e68bd commit 86a27f2

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

.cirrus.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ build_task:
133133
# the 'origin' remote must be defined, and all remote branches/tags
134134
# must be available for reference from CI scripts.
135135
clone_script: &full_clone |
136+
set -exuo pipefail
136137
cd /
137138
rm -rf $CIRRUS_WORKING_DIR
138139
mkdir -p $CIRRUS_WORKING_DIR
@@ -145,10 +146,6 @@ build_task:
145146
else
146147
git reset --hard $CIRRUS_CHANGE_IN_REPO
147148
fi
148-
# Some test operations & checks require a git "identity"
149-
_gc='git config --file /root/.gitconfig'
150-
$_gc user.email "[email protected]"
151-
$_gc user.name "Testy McTestface"
152149
# Attempt to prevent flakes by confirming basic environment expectations,
153150
# network service connectivity and essential container image availability.
154151
prebuild_script: &prebuild $SCRIPT_BASE/prebuild.sh
@@ -462,6 +459,7 @@ osx_alt_build_task:
462459
GOCACHE: "$CIRRUS_WORKING_DIR/.go/cache"
463460
GOENV: "$CIRRUS_WORKING_DIR/.go/support"
464461
GOSRC: "$HOME/ci/task-${CIRRUS_TASK_ID}"
462+
clone_script: *full_clone
465463
# This host is/was shared with potentially many other CI tasks.
466464
# The previous task may have been canceled or aborted.
467465
prep_script: &mac_cleanup "contrib/cirrus/mac_cleanup.sh"

contrib/cirrus/mac_setup.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,10 @@ echo "TMPDIR=/private/tmp/ci" >> $CIRRUS_ENV
3131

3232
# Removed completely during cleanup.
3333
mkdir -p /private/tmp/ci
34+
35+
# Some test operations & checks require a git "identity"
36+
# N/B: $HOME in this context does not include the /ci part automatically
37+
# (see above) but it will when the next Cirrus-CI "_script" section
38+
# takes over.
39+
git config --file "$HOME/ci/.gitconfig" \
40+
--add safe.directory $CIRRUS_WORKING_DIR

contrib/cirrus/setup_environment.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,8 @@ done
4040

4141
cp hack/podman-registry /bin
4242

43-
# Some test operations & checks require a git "identity"
44-
_gc='git config --file /root/.gitconfig'
45-
showrun $_gc user.email "[email protected]"
46-
showrun $_gc user.name "Testy McTestface"
4743
# Bypass git safety/security checks when operating in a throwaway environment
48-
showrun git config --system --add safe.directory $GOSRC
44+
showrun git config --global --add safe.directory $GOSRC
4945

5046
# Ensure that all lower-level contexts and child-processes have
5147
# ready access to higher level orchestration (e.g Cirrus-CI)

0 commit comments

Comments
 (0)