mirror of
https://github.com/etcd-io/etcd.git
synced 2026-02-05 06:46:49 +01:00
The GRPC community expressed their concern about a possible breakage on the etcd project when they switch or remove some of the experimental APIs. The GRPC community clearly express their contract around these APIs, however the etcd project has some features that build on that. As a norm we must not build on these kind of APIs, so we can set a linter to avoid this to happen again and run in each presubmit. Signed-off-by: Antonio Ojea <aojea@google.com>
34 lines
876 B
Bash
Executable File
34 lines
876 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
# Ensure we are at the root of the repo
|
|
ROOT_DIR=$(git rev-parse --show-toplevel)
|
|
cd "${ROOT_DIR}"
|
|
|
|
source ./scripts/test_lib.sh
|
|
|
|
TOOL_SRC="${ETCD_ROOT_DIR}/tools/check-grpc-experimental"
|
|
ALLOWLIST="${TOOL_SRC}/allowlist.txt"
|
|
|
|
FAILURES=0
|
|
|
|
for MOD_DIR in $(module_dirs); do
|
|
echo "------------------------------------------------"
|
|
echo "Checking module: ${MOD_DIR}"
|
|
pushd "${MOD_DIR}" > /dev/null
|
|
if ! go run "${TOOL_SRC}" -allow-list="${ALLOWLIST}" ./...; then
|
|
echo "ERROR: Experimental usage found in ${MOD_DIR}"
|
|
FAILURES=$((FAILURES+1))
|
|
fi
|
|
popd > /dev/null
|
|
done
|
|
|
|
echo "------------------------------------------------"
|
|
if [ "$FAILURES" -eq 0 ]; then
|
|
echo "SUCCESS: No experimental gRPC APIs found in any module."
|
|
exit 0
|
|
else
|
|
echo "FAILURE: Found experimental gRPC API usage in ${FAILURES} module(s)."
|
|
exit 1
|
|
fi |