Skip to content

Commit c709a93

Browse files
skitttpantelis
authored andcommitted
Check non-release dependencies across modules
The check for Submariner dependencies referencing unmerged commits only checks the main module. That isn't sufficient: Lighthouse for example has a coredns submodule with Submariner dependencies. This extends check-non-release-versions.sh to loop over all submodules. Dependencies are only cloned once, and all dependencies are processed before returning the result so that all invalid dependencies are identified. Submodules for which this check is irrelevant are processed too, but since they don't have Submariner dependencies that's fine; and if they ever do end up with Submariner dependencies, they'll be covered automatically. Signed-off-by: Stephen Kitt <skitt@redhat.com>
1 parent bb16651 commit c709a93

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

scripts/shared/check-non-release-versions.sh

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,21 @@ trap 'rm -rf $tmpdir' EXIT
88
# vX.Y.Z-0.YYYYMMDDhhmmss-hash
99
failed=0
1010
shopt -s lastpipe
11-
GOWORK=off go list -m -mod=mod -json all |
12-
jq -r 'select(.Path | contains("/submariner-io/")) | select(.Main != true) | select(.Version | contains ("-")) | select(.Version | length > 14) | "\(.Path) \(.Version)"' |
13-
while read -r project version; do
14-
cd "$tmpdir" || exit 1
15-
git clone "https://$project"
16-
cd "${project##*/}" || exit 1
17-
hash="${version##*-}"
18-
branch="${GITHUB_BASE_REF:-devel}"
19-
if ! git merge-base --is-ancestor "$hash" "origin/$branch"; then
20-
printf "This project depends on %s %s\n" "$project" "$version"
21-
printf "but %s branch %s does not contain commit %s\n" "$project" "$branch" "$hash"
22-
failed=1
23-
fi
24-
done
11+
while read -d $'\0' -r module <&3; do
12+
GOWORK=off go -C "$module" list -m -mod=mod -json all |
13+
jq -r 'select(.Path | contains("/submariner-io/")) | select(.Main != true) | select(.Version | contains ("-")) | select(.Version | length > 14) | "\(.Path) \(.Version)"' |
14+
while read -r project version; do
15+
cd "$tmpdir" || exit 1
16+
[ -d "${project##*/}" ] || git clone "https://$project"
17+
cd "${project##*/}" || exit 1
18+
hash="${version##*-}"
19+
branch="${GITHUB_BASE_REF:-devel}"
20+
if ! git merge-base --is-ancestor "$hash" "origin/$branch"; then
21+
printf "This project depends on %s %s\n" "$project" "$version"
22+
printf "but %s branch %s does not contain commit %s\n" "$project" "$branch" "$hash"
23+
failed=1
24+
fi
25+
done
26+
done 3< <(find . -name go.mod -printf '%h\0')
2527

2628
exit $failed

0 commit comments

Comments
 (0)