Skip to content

KAFKA-20085 Replace verbose version instructions with updateVersion task#22065

Merged
chia7712 merged 1 commit intoapache:4.2from
FrankYang0529:KAFKA-20085
Apr 15, 2026
Merged

KAFKA-20085 Replace verbose version instructions with updateVersion task#22065
chia7712 merged 1 commit intoapache:4.2from
FrankYang0529:KAFKA-20085

Conversation

@FrankYang0529
Copy link
Copy Markdown
Member

@FrankYang0529 FrankYang0529 commented Apr 15, 2026

cherry picked from commit 62206cf

Reviewers: Chia-Ping Tsai chia7712@gmail.com

@FrankYang0529 FrankYang0529 requested a review from chia7712 April 15, 2026 11:40
@FrankYang0529
Copy link
Copy Markdown
Member Author

CI will be fixed in #22066

…ask (apache#21340)

Replaces verbose manual version instructions with a new Gradle task
`updateVersion` and introduces a verification task
`verifyVersionConsistency` to enforce version consistency.

**Features**

1. **Automated Verification (`check` lifecycle):**
The `verifyVersionConsistency` task is hooked into `./gradlew check`.
If `gradle.properties` is updated but dependent files are not, the build
will **fail** with a descriptive error prompting the user to run
`updateVersion`.
2. **Automated Update (`updateVersion` task):**
* **Sync Mode:** `./gradlew updateVersion`
(Syncs the current version from `gradle.properties` to all dependent
files)
* **Update Mode:** `./gradlew updateVersion -PnewVersion=4.3.0-SNAPSHOT`
(Updates `gradle.properties` first, then syncs to all dependent files)

**Affected Files**

* `gradle.properties` (only if `-PnewVersion` is used)
* `committer-tools/kafka-merge-pr.py`
* `tests/kafkatest/version.py`
* `tests/kafkatest/__init__.py`
* `streams/quickstart/pom.xml`
* `streams/quickstart/java/pom.xml`
*
`streams/quickstart/java/src/main/resources/archetype-resources/pom.xml`

*Simulating a Release Manager manually updating `gradle.properties` but
forgetting others.*

1. Manually modify `gradle.properties` to a new version.
2. Run `./gradlew check` (or just the verification task).

**Result: Build Fails (Expected)**
```text
> Task :verifyVersionConsistency FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':verifyVersionConsistency'.
> Found inconsistent versions in the following files:
committer-tools/kafka-merge-pr.py
tests/kafkatest/version.py
...

Please run './gradlew updateVersion -PnewVersion=...' to fix them.

```

1. Run `./gradlew updateVersion -PnewVersion="4.2.0-SNAPSHOT"`
```text
> Task :updateVersion
Updated gradle.properties to version 4.2.0-SNAPSHOT
Updated committer-tools/kafka-merge-pr.py
Updated tests/kafkatest/version.py
Updated tests/kafkatest/__init__.py
Updated streams/quickstart/pom.xml
Updated streams/quickstart/java/pom.xml
Updated
streams/quickstart/java/src/main/resources/archetype-resources/pom.xml

BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed

```

2. Run `./gradlew check` again.

**Result: Build Passes**
```text
> Task :verifyVersionConsistency
All versions are consistent with gradle.properties.

BUILD SUCCESSFUL

```

1. `./gradlew updateVersion -PnewVersion="invalid-version"`
```text
> Task :updateVersion FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':updateVersion'.
> Invalid version format: 'invalid-version'. Expected format: X.Y.Z or
X.Y.Z-SNAPSHOT

```

Reviewers: PoAn Yang <payang@apache.org>, Chia-Ping Tsai
 <chia7712@gmail.com>
(cherry picked from commit 62206cf)
@chia7712 chia7712 merged commit 61b8b29 into apache:4.2 Apr 15, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants