Cirrus: Fix bud tests failing to apply patches

For some weeks or longer, the buildah bud tests have been failing under
cirrus-cron with the message:

```
+ git am --reject
Committer identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: empty ident name (for
<some30462dude@cirrus-task-5479994827210752.c.libpod-218412.internal>)
not allowed
```

Fix this by marking the clone directory "safe" when the script is
running under CI.

Signed-off-by: Chris Evich <cevich@redhat.com>
This commit is contained in:
Chris Evich
2023-02-27 12:08:41 -05:00
parent a54a4041c5
commit 0f92e19e8e

View File

@ -149,6 +149,15 @@ if [[ -n $do_checkout ]]; then
failhint="'git clone' failed - this should never happen!"
(set -x;git clone -q $shallow_checkout https://$BUILDAH_REPO $buildah_dir)
# Recent versions of git (like `2.39`) disallow some operations (like `am`)
# without an identity being set. In this case, git will throw an error
# with a helpful error message for humans to ponder. However, when running
# under automation, nobody cares about this condition or message, because
# the environment is disposable.
if [[ "$CI" == "true" ]]; then
git config --system --add safe.directory $buildah_dir
fi
cd $buildah_dir
if [[ -z $shallow_checkout ]]; then
# extract the SHA (rightmost field) from, e.g., v1.2-YYYMMDD-<sha>