Skip to content

Commit a2781b6

Browse files
committed
fix: authenticate cassandra latest lookup
1 parent 45f1ffb commit a2781b6

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

Makefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,15 @@ resolve-cassandra-version: .prepare-get-version
108108
exit 0
109109
fi
110110

111-
if [[ "${CASSANDRA_VERSION}" == "4-LATEST" ]]; then
112-
CASSANDRA_VERSION_RESOLVED=$$(get-version -source github-tag -repo apache/cassandra -prefix "cassandra-" -out-no-prefix -filters "^[0-9]+$$.^[0-9]+$$.^[0-9]+$$ and 4.LAST.LAST" | tr -d '\"')
113-
elif [[ "${CASSANDRA_VERSION}" == "3-LATEST" ]]; then
114-
CASSANDRA_VERSION_RESOLVED=$$(get-version -source github-tag -repo apache/cassandra -prefix "cassandra-" -out-no-prefix -filters "^[0-9]+$$.^[0-9]+$$.^[0-9]+$$ and 3.LAST.LAST" | tr -d '\"')
111+
if [[ "${CASSANDRA_VERSION}" == "4-LATEST" || "${CASSANDRA_VERSION}" == "3-LATEST" ]]; then
112+
# Resolve latest Cassandra tags through the authenticated GitHub API to avoid
113+
# anonymous rate limits when the integration matrix fans out.
114+
major=$${CASSANDRA_VERSION%%-*}
115+
CASSANDRA_VERSION_RESOLVED=$$(gh api repos/apache/cassandra/tags --paginate --jq '.[].name' \
116+
| sed 's/^cassandra-//' \
117+
| awk -F. -v major="$$major" '$$1 == major && $$2 ~ /^[0-9]+$$/ && $$3 ~ /^[0-9]+$$/ { print }' \
118+
| sort -V \
119+
| tail -n 1)
115120
elif echo "${CASSANDRA_VERSION}" | grep -P '^[0-9\.]+'; then
116121
CASSANDRA_VERSION_RESOLVED=${CASSANDRA_VERSION}
117122
else

0 commit comments

Comments
 (0)