dejan2609 commented on code in PR #24243: URL: https://github.com/apache/kafka/pull/24243#discussion_r4589397919
########## wrapper.gradle: ########## @@ -18,34 +18,83 @@ */ // This file contains tasks for the gradle wrapper generation. - -// Ensure the wrapper script is generated based on the version defined in the project -// and not the version installed on the machine running the task. +// +// To upgrade Gradle, run: +// ./gradlew wrapper --gradle-version <version> +// The published distribution checksum, the published wrapper jar checksum and the gradle/gradle commit to +// fetch the wrapper jar from are looked up automatically and written into gradle/wrapper/gradle-wrapper.properties +// and gradlew. // Read more about the wrapper here: https://docs.gradle.org/current/userguide/gradle_wrapper.html -wrapper { - gradleVersion = versions.gradle + +import groovy.json.JsonSlurper +import java.security.MessageDigest + +def fetchBytes = { String url -> + HttpURLConnection conn = (HttpURLConnection) URI.create(url).toURL().openConnection() + conn.connectTimeout = 15_000 + conn.readTimeout = 60_000 + conn.setRequestProperty("User-Agent", "apache-kafka-build") + def token = System.getenv("GITHUB_TOKEN") + if (token && url.startsWith("https://api.github.com/")) { + conn.setRequestProperty("Authorization", "Bearer $token") + } Review Comment: Small suggestion: is `GITHUB_TOKEN` required here ? The lookup makes a single **_api.github.com_** call per run and the wrapper jars are fetched from **_raw.githubusercontent.com_** (which doesn't count against the API rate limit). I commented out the token code locally and the upgrade from 9.8.2 to 9.9.1 worked fine without a token set. Not a blocker, just my 2 cents. Fine to keep it if there's a reason for it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
