diff --git a/util/metadata.sh b/util/metadata.sh index 22fb7f8..73607b2 100755 --- a/util/metadata.sh +++ b/util/metadata.sh @@ -120,7 +120,8 @@ EOF then cut_branch=$(echo "${normalized_branch}" | cut -c -${cutoff}) echo "Your branch name ${normalized_branch} + metadata exceeds the maximum length for K8s identifiers, truncating to ${cut_branch}" - normalized_branch="${cut_branch}" + # cut branch should not end in - trim any dashes from the end. + normalized_branch="${cut_branch%%*(-)}" fi echo "Before: '${branch}'"