Skip to content

Commit

Permalink
strip trailing - with sed (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgreat authored Feb 22, 2023
1 parent 3b0859f commit 44b4467
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions util/metadata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ EOF

if [[ ${#normalized_branch} -gt ${cutoff} ]]
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}"
# cut branch should not end in - trim any dashes from the end.
normalized_branch="${cut_branch%%*(-)}"
cut_branch=$(echo "${normalized_branch}" | cut -c -${cutoff} | sed -e 's!-*$!!')
echo "Your branch name ${normalized_branch} + metadata exceeds the maximum length for K8s identifiers, truncating to ${cut_branch}"
normalized_branch="${cut_branch}"
fi

echo "Before: '${branch}'"
Expand Down

0 comments on commit 44b4467

Please sign in to comment.