Skip to content

Commit 2c44448

Browse files
authored
MINOR: Upgrade release.py to run with JDK 25 (#20699)
Related discussion:#20561 (comment) This PR primarily upgrades release tooling to JDK 25, and includes two fixes identified while dry-running `release.py` locally. 1. JDK upgrade: Switches `release.py` to run under JDK 25. 2. Pre‑req check false negative in git clean‑state verification task * When running `release.py` with a clean working tree, the script incorrectly failed the pre‑requisite check. ```bash $ git status On branch MINOR-1014 nothing to commit, working tree clean $ python release.py ... FAILURE: Pre-requisite not met: Verifying that you have no unstaged git changes. ``` * Root cause: the checks used `has_unstaged_changes()` / `has_staged_changes()` in a way that treated success as “has changes”. The fix inverts the logic to assert **no** changes. 3. Gradle 9 aggregatedJavadoc failure * With **Gradle 9**, `aggregatedJavadoc` currently fails in parallel mode. ``` FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':aggregatedJavadoc'. > Resolution of the configuration ':connect:compileClasspath' was attempted without an exclusive lock. This is unsafe and not allowed. ``` * The change adds `--no-parallel` for the aggregated Javadoc step to avoid build failures (discussion: #19513 (comment)) Reviewers: Mickael Maison <[email protected]>, Ming-Yen Chung <[email protected]>, kuoche1712003 <[email protected]>, Chia-Ping Tsai <[email protected]>
1 parent 61587ed commit 2c44448

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

release/git.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ def __defaults(kwargs):
3131
kwargs["cwd"] = repo_dir
3232

3333

34-
def has_staged_changes(**kwargs):
34+
def ensure_no_staged_changes(**kwargs):
3535
__defaults(kwargs)
3636
execute("git diff --cached --exit-code --quiet", **kwargs)
37+
return True
3738

3839

39-
def has_unstaged_changes(**kwargs):
40+
def ensure_no_unstaged_changes(**kwargs):
4041
__defaults(kwargs)
4142
execute("git diff --exit-code --quiet", **kwargs)
43+
return True
4244

4345

4446
def fetch_tags(remote=push_remote_name, **kwargs):

release/release.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def get_jdk(version):
8989
else: jdk_java_home = jdk_env["JAVA_HOME"]
9090
java_version = execute(f"{jdk_java_home}/bin/java -version", env=jdk_env)
9191
if (version == 8 and "1.8.0" not in java_version) or \
92-
(f"{version}.0" not in java_version and '"{version}"' not in java_version):
92+
(f"{version}.0" not in java_version and f'"{version}"' not in java_version):
9393
preferences.unset(key)
9494
fail(f"JDK {version} is required")
9595
return jdk_env
@@ -127,14 +127,17 @@ def command_stage_docs():
127127
if not os.path.exists(kafka_site_repo_path) or not os.path.exists(os.path.join(kafka_site_repo_path, "powered-by.html")):
128128
fail("{kafka_site_repo_path} doesn't exist or does not appear to be the kafka-site repository")
129129

130-
jdk21_env = get_jdk(21)
130+
jdk25_env = get_jdk(25)
131131

132132
# We explicitly override the version of the project that we normally get from gradle.properties since we want to be
133133
# able to run this from a release branch where we made some updates, but the build would show an incorrect SNAPSHOT
134134
# version due to already having bumped the bugfix version number.
135135
gradle_version_override = detect_docs_release_version(project_version)
136136

137-
cmd("Building docs", f"./gradlew -Pversion={gradle_version_override} clean siteDocsTar aggregatedJavadoc", cwd=repo_dir, env=jdk21_env)
137+
cmd("Building docs",f"./gradlew -Pversion={gradle_version_override} clean siteDocsTar", cwd=repo_dir, env=jdk25_env,)
138+
# Disable parallel execution for aggregatedJavadoc due to Gradle 9 issues
139+
cmd("Building docs", f"./gradlew -Pversion={gradle_version_override} aggregatedJavadoc --no-parallel", cwd=repo_dir, env=jdk25_env,)
140+
138141

139142
docs_tar = os.path.join(repo_dir, "core", "build", "distributions", f"kafka_2.13-{gradle_version_override}-site-docs.tgz")
140143

@@ -229,7 +232,7 @@ def verify_gpg_key():
229232
preferences.once(f"verify_gpg_key_{gpg_key_pass_id}", verify_gpg_key)
230233

231234
apache_id = preferences.get('apache_id', lambda: prompt("Please enter your apache-id: "))
232-
jdk21_env = get_jdk(21)
235+
jdk25_env = get_jdk(25)
233236

234237

235238
def verify_prerequisites():
@@ -245,8 +248,8 @@ def prereq(name, soft_check):
245248
fail(f"Pre-requisite not met: {name}. Error: {e}")
246249
prereq('Apache Maven CLI (mvn) in PATH', lambda: "Apache Maven" in execute("mvn -v"))
247250
prereq("svn CLI in PATH", lambda: "svn" in execute("svn --version"))
248-
prereq("Verifying that you have no unstaged git changes", lambda: git.has_unstaged_changes())
249-
prereq("Verifying that you have no staged git changes", lambda: git.has_staged_changes())
251+
prereq("Verifying that you have no unstaged git changes", lambda: git.ensure_no_unstaged_changes())
252+
prereq("Verifying that you have no staged git changes", lambda: git.ensure_no_staged_changes())
250253
return True
251254

252255

@@ -328,9 +331,9 @@ def delete_gitrefs():
328331

329332

330333
git.targz(rc_tag, f"kafka-{release_version}-src/", f"{artifacts_dir}/kafka-{release_version}-src.tgz")
331-
cmd("Building artifacts", "./gradlew clean && ./gradlew releaseTarGz -PscalaVersion=2.13", cwd=kafka_dir, env=jdk21_env, shell=True)
334+
cmd("Building artifacts", "./gradlew clean && ./gradlew releaseTarGz -PscalaVersion=2.13", cwd=kafka_dir, env=jdk25_env, shell=True)
332335
cmd("Copying artifacts", f"cp {kafka_dir}/core/build/distributions/* {artifacts_dir}", shell=True)
333-
cmd("Building docs", "./gradlew clean aggregatedJavadoc", cwd=kafka_dir, env=jdk21_env)
336+
cmd("Building docs", "./gradlew clean aggregatedJavadoc --no-parallel", cwd=kafka_dir, env=jdk25_env)
334337
cmd("Copying docs", f"cp -R {kafka_dir}/build/docs/javadoc {artifacts_dir}")
335338

336339
for filename in os.listdir(artifacts_dir):
@@ -355,8 +358,8 @@ def delete_gitrefs():
355358
svn.commit_artifacts(rc_tag, artifacts_dir, work_dir)
356359

357360
confirm_or_fail("Going to build and upload mvn artifacts based on these settings:\n" + textfiles.read(global_gradle_props) + '\nOK?')
358-
cmd("Building and uploading archives", "./gradlew publish -PscalaVersion=2.13", cwd=kafka_dir, env=jdk21_env, shell=True)
359-
cmd("Building and uploading archives", "mvn deploy -Pgpg-signing", cwd=os.path.join(kafka_dir, "streams/quickstart"), env=jdk21_env, shell=True)
361+
cmd("Building and uploading archives", "./gradlew publish -PscalaVersion=2.13", cwd=kafka_dir, env=jdk25_env, shell=True)
362+
cmd("Building and uploading archives", "mvn deploy -Pgpg-signing", cwd=os.path.join(kafka_dir, "streams/quickstart"), env=jdk25_env, shell=True)
360363

361364
# TODO: Many of these suggested validation steps could be automated
362365
# and would help pre-validate a lot of the stuff voters test

release/templates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def requirements_instructions(prefs_file, prefs):
2525
return f"""
2626
Requirements:
2727
1. Updated docs to reference the new release version where appropriate.
28-
2. JDK8 and JDK17 compilers and libraries
28+
2. JDK25 compiler and libraries
2929
3. Your Apache ID, already configured with SSH keys on id.apache.org and SSH keys available in this shell session
3030
4. All issues in the target release resolved with valid resolutions (if not, this script will report the problematic JIRAs)
3131
5. A GPG key used for signing the release. This key should have been added to public Apache servers and the KEYS file on the Kafka site

0 commit comments

Comments
 (0)