Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect the latest API version from each submodule #211

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions tools/collect-manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,45 @@ walk_overlays() {
fi
}

# Find the latest API version used in each submodule.
collect_api_versions() {

for SUBMODULE in $DO_MODULES; do
SUBMOD_DIR="$TREEDIR/$SUBMODULE"
apiver=
[[ ! -d $SUBMODULE/api ]] && continue
echo "Collecting the API version from $SUBMODULE"
if [[ $(/bin/ls -1 "$SUBMODULE"/api | wc -l) -eq 1 ]]; then
fname=$(/bin/ls -1 "$SUBMODULE"/api)
if [[ -d $SUBMODULE/api/$fname && $fname == v* ]]; then
apiver="$fname"
fi
elif [[ $(/bin/ls -1 "$SUBMODULE"/api | wc -l) -gt 1 ]]; then
# Find the API hub.
conversion_files=$(find "$SUBMODULE"/api -name conversion.go)
if [[ -n $conversion_files ]]; then
for fname in $conversion_files; do
if grep -q " Hub() " "$fname"; then
# Found the hub.
apiver="$(basename "$(dirname "$fname")")"
break
fi
done
fi
fi
if [[ -n $apiver ]]; then
# Pick the first group/domain from PROJECT.
group=$(grep -E '^ group:' "$SUBMODULE"/PROJECT | sed 1q | awk '{print $2}')
domain=$(grep -E '^ domain:' "$SUBMODULE"/PROJECT | sed 1q | awk '{print $2}')
echo "$group.$domain/$apiver" > "$SUBMOD_DIR"/api-version.txt
fi
done
}

walk_overlays

echo "$NNF_VERSION" > "$TREEDIR/manifest-release.txt"
collect_api_versions

mkdir "$TREEDIR/cert-mgr"
# Wishing for yq(1)...
Expand Down
Loading