This is an automated email from the ASF dual-hosted git repository.
chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new 2c444485123 MINOR: Upgrade release.py to run with JDK 25 (#20699)
2c444485123 is described below
commit 2c444485123a5790170856284f613384b4b033c2
Author: Hong-Yi Chen <[email protected]>
AuthorDate: Wed Oct 22 23:53:30 2025 +0800
MINOR: Upgrade release.py to run with JDK 25 (#20699)
Related
discussion:https://github.com/apache/kafka/pull/20561#issuecomment-3400369008
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:
https://github.com/apache/kafka/pull/19513#issuecomment-3390127934)
Reviewers: Mickael Maison <[email protected]>, Ming-Yen Chung
<[email protected]>, kuoche1712003 <[email protected]>,
Chia-Ping Tsai <[email protected]>
---
release/git.py | 6 ++++--
release/release.py | 23 +++++++++++++----------
release/templates.py | 2 +-
3 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/release/git.py b/release/git.py
index 02d7dc8cbe2..3fe47d721a2 100644
--- a/release/git.py
+++ b/release/git.py
@@ -31,14 +31,16 @@ def __defaults(kwargs):
kwargs["cwd"] = repo_dir
-def has_staged_changes(**kwargs):
+def ensure_no_staged_changes(**kwargs):
__defaults(kwargs)
execute("git diff --cached --exit-code --quiet", **kwargs)
+ return True
-def has_unstaged_changes(**kwargs):
+def ensure_no_unstaged_changes(**kwargs):
__defaults(kwargs)
execute("git diff --exit-code --quiet", **kwargs)
+ return True
def fetch_tags(remote=push_remote_name, **kwargs):
diff --git a/release/release.py b/release/release.py
index 92b76dee1e3..2620d449f8a 100644
--- a/release/release.py
+++ b/release/release.py
@@ -89,7 +89,7 @@ def get_jdk(version):
else: jdk_java_home = jdk_env["JAVA_HOME"]
java_version = execute(f"{jdk_java_home}/bin/java -version", env=jdk_env)
if (version == 8 and "1.8.0" not in java_version) or \
- (f"{version}.0" not in java_version and '"{version}"' not in
java_version):
+ (f"{version}.0" not in java_version and f'"{version}"' not in
java_version):
preferences.unset(key)
fail(f"JDK {version} is required")
return jdk_env
@@ -127,14 +127,17 @@ def command_stage_docs():
if not os.path.exists(kafka_site_repo_path) or not
os.path.exists(os.path.join(kafka_site_repo_path, "powered-by.html")):
fail("{kafka_site_repo_path} doesn't exist or does not appear to be
the kafka-site repository")
- jdk21_env = get_jdk(21)
+ jdk25_env = get_jdk(25)
# We explicitly override the version of the project that we normally get
from gradle.properties since we want to be
# able to run this from a release branch where we made some updates, but
the build would show an incorrect SNAPSHOT
# version due to already having bumped the bugfix version number.
gradle_version_override = detect_docs_release_version(project_version)
- cmd("Building docs", f"./gradlew -Pversion={gradle_version_override} clean
siteDocsTar aggregatedJavadoc", cwd=repo_dir, env=jdk21_env)
+ cmd("Building docs",f"./gradlew -Pversion={gradle_version_override} clean
siteDocsTar", cwd=repo_dir, env=jdk25_env,)
+ # Disable parallel execution for aggregatedJavadoc due to Gradle 9 issues
+ cmd("Building docs", f"./gradlew -Pversion={gradle_version_override}
aggregatedJavadoc --no-parallel", cwd=repo_dir, env=jdk25_env,)
+
docs_tar = os.path.join(repo_dir, "core", "build", "distributions",
f"kafka_2.13-{gradle_version_override}-site-docs.tgz")
@@ -229,7 +232,7 @@ gpg_key_pass_id = gpg.key_pass_id(gpg_key_id,
gpg_passphrase)
preferences.once(f"verify_gpg_key_{gpg_key_pass_id}", verify_gpg_key)
apache_id = preferences.get('apache_id', lambda: prompt("Please enter your
apache-id: "))
-jdk21_env = get_jdk(21)
+jdk25_env = get_jdk(25)
def verify_prerequisites():
@@ -245,8 +248,8 @@ def verify_prerequisites():
fail(f"Pre-requisite not met: {name}. Error: {e}")
prereq('Apache Maven CLI (mvn) in PATH', lambda: "Apache Maven" in
execute("mvn -v"))
prereq("svn CLI in PATH", lambda: "svn" in execute("svn --version"))
- prereq("Verifying that you have no unstaged git changes", lambda:
git.has_unstaged_changes())
- prereq("Verifying that you have no staged git changes", lambda:
git.has_staged_changes())
+ prereq("Verifying that you have no unstaged git changes", lambda:
git.ensure_no_unstaged_changes())
+ prereq("Verifying that you have no staged git changes", lambda:
git.ensure_no_staged_changes())
return True
@@ -328,9 +331,9 @@ except Exception as e:
git.targz(rc_tag, f"kafka-{release_version}-src/",
f"{artifacts_dir}/kafka-{release_version}-src.tgz")
-cmd("Building artifacts", "./gradlew clean && ./gradlew releaseTarGz
-PscalaVersion=2.13", cwd=kafka_dir, env=jdk21_env, shell=True)
+cmd("Building artifacts", "./gradlew clean && ./gradlew releaseTarGz
-PscalaVersion=2.13", cwd=kafka_dir, env=jdk25_env, shell=True)
cmd("Copying artifacts", f"cp {kafka_dir}/core/build/distributions/*
{artifacts_dir}", shell=True)
-cmd("Building docs", "./gradlew clean aggregatedJavadoc", cwd=kafka_dir,
env=jdk21_env)
+cmd("Building docs", "./gradlew clean aggregatedJavadoc --no-parallel",
cwd=kafka_dir, env=jdk25_env)
cmd("Copying docs", f"cp -R {kafka_dir}/build/docs/javadoc {artifacts_dir}")
for filename in os.listdir(artifacts_dir):
@@ -355,8 +358,8 @@ confirm_or_fail(f"Going to check in artifacts to svn under
{SVN_DEV_URL}/{rc_tag
svn.commit_artifacts(rc_tag, artifacts_dir, work_dir)
confirm_or_fail("Going to build and upload mvn artifacts based on these
settings:\n" + textfiles.read(global_gradle_props) + '\nOK?')
-cmd("Building and uploading archives", "./gradlew publish
-PscalaVersion=2.13", cwd=kafka_dir, env=jdk21_env, shell=True)
-cmd("Building and uploading archives", "mvn deploy -Pgpg-signing",
cwd=os.path.join(kafka_dir, "streams/quickstart"), env=jdk21_env, shell=True)
+cmd("Building and uploading archives", "./gradlew publish
-PscalaVersion=2.13", cwd=kafka_dir, env=jdk25_env, shell=True)
+cmd("Building and uploading archives", "mvn deploy -Pgpg-signing",
cwd=os.path.join(kafka_dir, "streams/quickstart"), env=jdk25_env, shell=True)
# TODO: Many of these suggested validation steps could be automated
# and would help pre-validate a lot of the stuff voters test
diff --git a/release/templates.py b/release/templates.py
index 2f9f07b0e3c..528b6732c1a 100644
--- a/release/templates.py
+++ b/release/templates.py
@@ -25,7 +25,7 @@ def requirements_instructions(prefs_file, prefs):
return f"""
Requirements:
1. Updated docs to reference the new release version where appropriate.
-2. JDK8 and JDK17 compilers and libraries
+2. JDK25 compiler and libraries
3. Your Apache ID, already configured with SSH keys on id.apache.org and SSH
keys available in this shell session
4. All issues in the target release resolved with valid resolutions (if not,
this script will report the problematic JIRAs)
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