Skip to content

Commit

Permalink
CI: Add explicit static check script vendor test
Browse files Browse the repository at this point in the history
Update the `check_vendor()` function in the static check script to run
our current vendoring tool (`dep`) in check mode. This will ensure our
vendoring does not get silently broken [1].

Fixes kata-containers#1506.

[1] - See for example kata-containers/runtime#1442.

Signed-off-by: James O. D. Hunt <[email protected]>
(cherry picked from commit 830983f)
Signed-off-by: Ganesh Maharaj Mahalingam <[email protected]>
  • Loading branch information
jodh-intel authored and jcvenegas committed May 2, 2019
1 parent 23d8194 commit 2a3cbb9
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions .ci/static-checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -608,11 +608,15 @@ check_files()
exit 1
}

# Ensure that changes to vendored code are accompanied by an update to the
# vendor tooling config file. If not, the user simply hacked the vendor files
# rather than following the correct process:
# Perform vendor checks:
#
# - https://github.com/kata-containers/community/blob/master/VENDORING.md
# - Ensure that changes to vendored code are accompanied by an update to the
# vendor tooling config file. If not, the user simply hacked the vendor files
# rather than following the correct process:
#
# https://github.com/kata-containers/community/blob/master/VENDORING.md
#
# - Ensure vendor metadata is valid.
check_vendor()
{
local files
Expand Down Expand Up @@ -642,6 +646,14 @@ check_vendor()
[ -n "$result" ] || die "PR changes vendor files, but does not update ${vendor_ctl_file}"
fi
fi

info "Checking vendoring metadata"

# Get the vendoring tool
go get github.com/golang/dep/cmd/dep

# Check, but don't touch!
dep ensure -no-vendor -dry-run
}

main()
Expand Down

0 comments on commit 2a3cbb9

Please sign in to comment.