Skip to content

KAFKA-18903: update-cache.sh use curl + jq to get sha contains gradle cache instead of gh cli #19753

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

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from
Open
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
19 changes: 3 additions & 16 deletions committer-tools/update-cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,9 @@
# specific language governing permissions and limitations
# under the License.

if ! git config --get alias.update-cache > /dev/null; then
printf '\e[36m%s\n\n %s\n\e[0m\n' \
'Hint: you can create a Git alias to execute this script. Example:' \
"git config alias.update-cache '!bash $(realpath "$0")'"
fi

key="$(
gh cache list \
--key 'gradle-home-v1|Linux-X64|test' \
--sort 'created_at' \
--limit 1 \
--json 'key' \
--jq '.[].key'
)"

sha="$(cut -d '-' -f 5 <<< "$key")"
# Get the latest commit SHA that contains the Gradle build cache.
sha=$(curl -s "https://api.github.com/repos/apache/kafka/actions/caches?key=gradle-home-v1&ref=refs/heads/trunk" \
| jq -r '.actions_caches | max_by(.created_at) | .key | split("-")[4]')

if ! git show "$sha" &> /dev/null; then
printf '\e[33m%s\n%s\e[0m\n' \
Expand Down