CI: check for possible diff after make vendor

We can commit broken vendoring here because there is no actual test to
verify that the vendor directory is clean after make vendor.

PR[1] had a renovate bug[2] which causes it to not run go mod tidy, this was
not caused by CI because of it.

[1] https://github.com/containers/common/pull/1555
[2] https://github.com/containers/automation/pull/148

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger 2023-07-12 14:15:48 +02:00
parent d383a0b593
commit b456f02fbb
2 changed files with 20 additions and 0 deletions

View File

@ -52,6 +52,7 @@ testing_task:
- export PATH="$PATH:$GOPATH/bin" - export PATH="$PATH:$GOPATH/bin"
- gpg --batch --passphrase '' --quick-gen-key tester@localhost default default never - gpg --batch --passphrase '' --quick-gen-key tester@localhost default default never
- make vendor - make vendor
- hack/tree_status.sh
- make build - make build
- make build-cross - make build-cross
- make test - make test

19
common/hack/tree_status.sh Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -e
SUGGESTION="${SUGGESTION:-run \"make vendor\" and commit all changes.}"
STATUS=$(git status --porcelain)
if [[ -z $STATUS ]]
then
echo "tree is clean"
else
echo "tree is dirty, please $SUGGESTION"
echo ""
echo "$STATUS"
echo ""
echo "---------------------- Diff below ----------------------"
echo ""
git --no-pager diff
exit 1
fi