CircleCI-Archived / build-tools-orb

An orb with handy tools for use in CircleCI jobs
https://circleci.com/developer/orbs/orb/circleci/build-tools
MIT License
8 stars 9 forks source link

`merge-with-parent` fails during the `Set Git Identity` step #33

Closed grsterin closed 3 years ago

grsterin commented 3 years ago

Orb version

2.9.0

What happened

Set Git Identity step fails when there is no Git identity configured:

#!/bin/bash -eo pipefail
USER_EMAIL=$(git config --get user.email)
USER_NAME=$(git config --get user.name)

if [ "$USER_EMAIL" = "" ]; then
  git config user.email "circleci@example.com"
fi
if [ "$USER_NAME" = "" ]; then
  git config user.name "CircleCI"
fi

Exited with code exit status 1
CircleCI received exit code 1

The reason is that git config --get user.email returns non-zero return code. Example from SSH debug session:

circleci:~/project$ git config --get user.email
circleci:~/project$ echo $?
1

Expected behavior

Should successfully set default Git identity when there's no current identity configured at all.

yuesaka-m commented 3 years ago

FWIW my team is seeing the same issue. ccing a few folks who might have worked on this: @gmemstr @iynere

Thanks!