mirror of https://github.com/linkerd/linkerd2.git
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:
parent
dcb0636ac1
commit
cb876cc7fd
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
|
@ -6,7 +6,11 @@ if [ $# -ne 1 ]; then
|
||||||
echo "usage: ${0##*/} v2.N.P" >&2
|
echo "usage: ${0##*/} v2.N.P" >&2
|
||||||
exit 64
|
exit 64
|
||||||
fi
|
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 )
|
bindir=$( cd "${0%/*}" && pwd )
|
||||||
rootdir=$( cd "$bindir"/.. && pwd )
|
rootdir=$( cd "$bindir"/.. && pwd )
|
||||||
|
@ -57,7 +61,7 @@ fi
|
||||||
cd "$rootdir"
|
cd "$rootdir"
|
||||||
echo "$new_proxy_version" >"$rootdir/.proxy-version"
|
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"
|
rm -rf "$tmp"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue