Improve git-commit-proxy-version (#7891)

git-commit-proxy-version doesn't include `--signoff`, so these changes
fail to pass DCO by default.

This change also adds validation for version strings, prepending the `v`
prefix if it is omitted.

Signed-off-by: Oliver Gould <ver@buoyant.io>
This commit is contained in:
Oliver Gould 2022-02-15 17:48:07 -08:00 committed by GitHub
parent dcb0636ac1
commit cb876cc7fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
set -eu
@ -6,7 +6,11 @@ if [ $# -ne 1 ]; then
echo "usage: ${0##*/} v2.N.P" >&2
exit 64
fi
new_proxy_version="$1"
new_proxy_version="v${1#v}"
if [[ "$new_proxy_version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then :; else
echo "Invalid version: $new_proxy_version" >&2
exit 1
fi
bindir=$( cd "${0%/*}" && pwd )
rootdir=$( cd "$bindir"/.. && pwd )
@ -57,7 +61,7 @@ fi
cd "$rootdir"
echo "$new_proxy_version" >"$rootdir/.proxy-version"
git commit --file="$tmp/commit.txt" --edit -- "$rootdir/.proxy-version"
git commit --signoff --file="$tmp/commit.txt" --edit -- "$rootdir/.proxy-version"
rm -rf "$tmp"