scripts/container.sh: allow for empty Branch Names and git errors (#2363)

Resolves #2362

(cherry picked from commit 17731ae8fd)
This commit is contained in:
Tom Herbers 2022-01-01 19:20:41 +01:00
parent e7e634396e
commit 2099d8e9be
No known key found for this signature in database
GPG Key ID: 841A5B0DCEDA6192

View File

@ -6,8 +6,8 @@ set -euo pipefail
cd "$(dirname "$0")/.."
# normalize branch name to reflect a valid image name
BRANCH=$(git branch --show-current | sed 's/[^a-z0-9-]/_/ig')
TAG=gluon:${BRANCH}
BRANCH=$(git branch --show-current 2>/dev/null | sed 's/[^a-z0-9-]/_/ig')
TAG="gluon:${BRANCH:-latest}"
if [ "$(command -v podman)" ]
then