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

Fix Version fetching in quick start script for Zipkin-Server #174

Merged
merged 1 commit into from
Nov 30, 2023
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
20 changes: 19 additions & 1 deletion quickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,25 @@ fetch_latest_version() {
local artifact_group="$1"; shift
local artifact_id="$1"; shift
local url="${repo}/${artifact_group_with_slashes}/${artifact_id}/maven-metadata.xml"
printf $(curl -sSL $url | sed -n '/<version>/s/.*<version>\([^<]*\)<\/version>.*/\1/p'|tail -1)
versions=$(curl -sSL $url | sed -n '/<version>/s/.*<version>\([^<]*\)<\/version>.*/\1/p')

IFS=$'\n' version_array=($versions)
found_version=false
for ((i=${#version_array[@]}-1; i>=0; i--)); do
version=${version_array[i]}
if [[ $version =~ ^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]$ ]]; then
printf "%s\n" "$version"
found_version=true
break
fi
done

if [ "$found_version" = false ]; then
cat <<EOF
${color_bad}Cannot found any valid Zipkin release version number; this script is confused. Bailing out. ${color_reset}
EOF
exit 1
fi
}

artifact_part() {
Expand Down
Loading