lhotari opened a new pull request, #26014: URL: https://github.com/apache/pulsar/pull/26014
### Motivation Release builds must include the real git commit / build metadata in the binaries, enabled with the `pulsar.includeBuildInfo=true` project property. There are two problems with the current solution: 1. The property name contains dots, so it cannot be passed as an environment variable with Gradle's `ORG_GRADLE_PROJECT_` prefix; the release process has to resort to `GRADLE_OPTS="-Dorg.gradle.project.pulsar.includeBuildInfo=true"`. 2. The release process consists of multiple separate Gradle invocations (assemble + license checks, publishing to the ASF Nexus repository, building docker images). If the captured metadata (for example `git.build.time`) changes between the invocations, it invalidates the build outputs and the binaries get rebuilt and change in the middle of the release. ### Modifications - Rename the `pulsar.includeBuildInfo` property to `pulsarIncludeBuildInfo` so that it can be set with the `ORG_GRADLE_PROJECT_pulsarIncludeBuildInfo` environment variable. - Add an optional `pulsarBuildInfoFile` property pointing to a build info snapshot file. If the file exists, the build info entries are read from it as-is (a `version` key in the file is ignored — the version always comes from the project). If it doesn't exist, the metadata is captured and written to the file so that subsequent invocations reuse it. A relative path is resolved against the root project directory. The snapshot file contents participate in the up-to-date checking of the `generatePulsarBuildInfo` task. - Update the comments in `gradle.properties` and the `PulsarVersion` javadoc accordingly. The release process documentation in `apache/pulsar-site` (`contribute/release-process.md`) will be updated separately to export `ORG_GRADLE_PROJECT_pulsarIncludeBuildInfo=true` and `ORG_GRADLE_PROJECT_pulsarBuildInfoFile=$HOME/pulsar-build-info-$VERSION_RC.properties`. ### Verifying this change - [x] Make sure that the change passes the CI checks. This change is a trivial rework / code cleanup without any test coverage. Verified manually: - First invocation with `-PpulsarIncludeBuildInfo=true -PpulsarBuildInfoFile=...` captures the metadata, writes the snapshot file and generates `pulsar-version.properties` with the metadata. - A second invocation reuses the snapshot (same `git.build.time`) and produces a byte-identical resource; a third invocation is `UP-TO-DATE`. - The default build (property `false` in `gradle.properties`) still generates a version-only resource. - The `ORG_GRADLE_PROJECT_pulsarIncludeBuildInfo` / `ORG_GRADLE_PROJECT_pulsarBuildInfoFile` environment variable form works. ### Does this pull request potentially affect one of the following parts: *If the box was checked, please highlight the changes* - [ ] Dependencies (add or upgrade a dependency) - [ ] The public API - [ ] The schema - [ ] The default values of configurations - [ ] The threading model - [ ] The binary protocol - [ ] The REST endpoints - [ ] The admin CLI options - [ ] The metrics - [ ] Anything that affects deployment -- 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]
