2019-01-26 06:29:13 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
set -eu
|
2017-06-13 08:40:22 +00:00
|
|
|
|
2019-01-26 06:29:13 +00:00
|
|
|
case ${1:-} in
|
2020-07-25 03:36:55 +00:00
|
|
|
'')
|
|
|
|
. $(dirname $0)/util
|
2020-11-21 20:36:45 +00:00
|
|
|
buildxCmd build \
|
|
|
|
--target validate \
|
|
|
|
--file ./hack/dockerfiles/vendor.Dockerfile \
|
|
|
|
.
|
2019-01-26 06:29:13 +00:00
|
|
|
;;
|
2020-07-25 03:36:55 +00:00
|
|
|
check)
|
|
|
|
status="$(git status --porcelain -- go.mod go.sum vendor 2>/dev/null)"
|
|
|
|
diffs=$(echo "$status" | grep -v '^[RAD] ' || true)
|
|
|
|
if [ "$diffs" ]; then
|
2019-01-26 06:29:13 +00:00
|
|
|
{
|
2020-07-25 03:36:55 +00:00
|
|
|
set +x
|
2019-01-26 06:29:13 +00:00
|
|
|
echo 'The result of "make vendor" differs'
|
2017-06-13 08:40:22 +00:00
|
|
|
echo
|
|
|
|
echo "$diffs"
|
|
|
|
echo
|
2019-01-26 06:29:13 +00:00
|
|
|
echo 'Please vendor your package with "make vendor"'
|
2017-06-13 08:40:22 +00:00
|
|
|
echo
|
2019-01-26 06:29:13 +00:00
|
|
|
} >&2
|
|
|
|
exit 1
|
2020-07-25 03:36:55 +00:00
|
|
|
fi
|
|
|
|
echo 'Congratulations! All vendoring changes are done the right way.'
|
|
|
|
;;
|
2019-01-26 06:29:13 +00:00
|
|
|
esac
|