forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 2
/
check_repositories.sh
executable file
·27 lines (23 loc) · 1.13 KB
/
check_repositories.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env bash
set -eu
# Check whether any git repositories are defined.
# Git repository definition contains `commit` and `remote` fields.
if git grep -n "commit =\|remote =" -- '*.bzl'; then
echo "Using git repositories is not allowed."
echo "To ensure that all dependencies can be stored offline in distdir, only HTTP repositories are allowed."
exit 1
fi
# Check whether number of defined `url =` or `urls =` and `sha256 =` kwargs in
# repository definitions is equal.
urls_count=$(git grep -E "\<url(s)? =" -- '*.bzl' -- ':!bazel/external/cargo/crates.bzl' | wc -l)
sha256sums_count=$(git grep -E "\<sha256 =" -- '*.bzl' -- ':!bazel/external/cargo/crates.bzl' | wc -l)
if [[ $urls_count != "$sha256sums_count" ]]; then
echo "Found more defined repository URLs than SHA256 sums, which means that there are some repositories without sums."
echo "Dependencies without SHA256 sums cannot be stored in distdir."
echo "Please ensure that every repository has a SHA256 sum."
echo "Repositories are defined in the following files:"
echo ""
echo " bazel/repository_locations.bzl"
echo " api/bazel/repositories.bzl"
exit 1
fi