fix the repo name detection when we don't have an origin set

Look at the directory we're given as the location of the code when we
can't find the repo name using the git remote.

This should only be needed until we move more metadata like the team
owner and some of these name values into the git commit message and
pass them from the tagging job to the announce job using that metadata
channel.

http://logs.openstack.org/08/08e872a2fad9734446030aa94d064049a0db371c/release/announce-release/864dea0/job-output.txt.gz#_2017-10-19_15_31_21_974136

Change-Id: I139d8177e68d2c3c2fd1e06d7dfb5baaedc220c3
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-10-19 17:09:52 -04:00
parent 9a7f57202d
commit 239af90a15
1 changed files with 10 additions and 2 deletions

View File

@ -46,8 +46,16 @@ fi
# repository is, if we're running under CI or someone has checked it
# out locally to an alternate name. Use the git remote URL as a source
# of better information for the real repository name.
SHORTNAME=$(basename $(cd $REPODIR && git config --get remote.origin.url))
REPOORGNAME=$(basename $(dirname $(cd $REPODIR && git config --get remote.origin.url)))
REMOTE_URL=$(cd $REPODIR && git config --get remote.origin.url)
if [ ! -z "$REMOTE_URL" ]; then
SHORTNAME=$(basename $REMOTE_URL)
REPOORGNAME=$(basename $(dirname $REMOTE_URL))
else
# WARNING(dhellmann): This formulation only works in CI where the
# workspace structure matches the git repo names upstream.
SHORTNAME=$(basename $REPODIR)
REPOORGNAME=$(basename $(dirname $REPODIR))
fi
# Assign a default "from" email address if one is not specified by the
# user's environment.