Skip to content

Instantly share code, notes, and snippets.

@cdsap
Last active April 22, 2024 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdsap/851c98ea581c5723244c52bac6ad80bd to your computer and use it in GitHub Desktop.
Save cdsap/851c98ea581c5723244c52bac6ad80bd to your computer and use it in GitHub Desktop.
Retrieve R8 duration API < 2023.4
#!/bin/bash
TOKEN="" # Develocity API token
TASK_PATH=":app:minifyDemoReleaseWithR8" # task path under investigation
URL="https://ge.solutions-team.gradle.com" # Develocity url
QUERY="query=user:runner requested:assembleRelease" # Query advanced search: https://docs.gradle.com/enterprise/api-manual/#advanced_search_syntax
# Using `requested:assembleRelease` to filter build scans only requesting this type of build
MAX_BUILDS=50
json_ids=$(curl -s --location -G "$URL/api/builds?maxBuilds=$MAX_BUILDS&reverse=true" \
--header "Authorization: Bearer $TOKEN" \
--data-urlencode "$QUERY" | jq -r '.[].id')
# Check if json_ids is empty
if [[ -z "$json_ids" ]]; then
echo "No IDs found or error in fetching IDs."
exit 1
fi
# Loop through each ID
echo "$json_ids" | while read id; do
response=$(curl -s "$URL/api/builds/$id/gradle-build-cache-performance" \
--header "Authorization: Bearer $TOKEN" | jq --arg tp "$TASK_PATH" '.taskExecution[] | select(.taskPath == $tp).duration')
echo "$response"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment