Fix library shortname identification in announce script

Git repo origins are now removed in CI jobs, so our detection of project
short name from looking at the git remote now fails. This resulted in
release announcements linking to "null" instead of the actual project
location [0].

This updates the script logic to detect if that is the case and fall
back to getting the repo name from the directory, which should be safe
in a CI job since there is no manipulation of the clones repo directory
name.

Also cleans up an unused variable that was left from a previous
refactoring.

[0] http://lists.openstack.org/pipermail/release-announce/2019-December/008306.html

Change-Id: I84e2cf258e9bc4541b7edde55a22a4be24bdb232
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2019-12-20 12:30:26 -06:00
parent 62eef1a6f2
commit bcb61fece9

View File

@ -48,15 +48,13 @@ fi
# out locally to an alternate name. Use the git remote URL as a source
# of better information for the real repository name.
REMOTE_URL=$(cd $REPODIR && git config --get remote.origin.url || echo "")
if [ ! -z "$REMOTE_URL" ]; then
if [ ! -z "$REMOTE_URL" ] && [ "$REMOTE_URL" != "file:///dev/null" ]; then
# Make sure .git extensions are not included
SHORTNAME=$(basename $REMOTE_URL .git)
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