jason810496 commented on code in PR #69444: URL: https://github.com/apache/airflow/pull/69444#discussion_r3533967889
########## java-sdk/build.gradle.kts: ########## @@ -0,0 +1,109 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +plugins { + id("io.github.gradle-nexus.publish-plugin") version "2.0.0" +} + +val projectVersion: String by project + +group = "org.apache.airflow" +version = projectVersion + +if (!project.hasProperty("mavenUrl")) { + nexusPublishing { + repositories { + create("apache") { + nexusUrl.set(uri("https://repository.apache.org/service/local/")) + snapshotRepositoryUrl.set( + uri("https://repository.apache.org/content/repositories/snapshots/"), + ) + username.set( + providers.gradleProperty("mavenUsername") + .orElse(providers.environmentVariable("ASF_NEXUS_USERNAME")), + ) + password.set( + providers.gradleProperty("mavenPassword") + .orElse(providers.environmentVariable("ASF_NEXUS_PASSWORD")), + ) + } + } + } +} + +val sourceReleaseDir = layout.buildDirectory.dir("distributions") +val sourceReleaseTarball = sourceReleaseDir.map { it.file("apache-airflow-java-sdk-$version-src.tar.gz") } Review Comment: `$version` here (and in the `--prefix` below) comes from the *current checkout's* `gradle.properties`, while the tarball contents come from `-PgitRef`. Running `sourceRelease` from `main` (`1.0.0-SNAPSHOT`) against the rc tag yields `apache-airflow-java-sdk-1.0.0-SNAPSHOT-src.tar.gz` containing beta1 content — an easy foot-gun during a release. Consider deriving the version from the ref instead (configuration-cache-safe since `providers.exec` runs at configuration time): ```kotlin val refVersion = providers.gradleProperty("gitRef").flatMap { ref -> providers.exec { commandLine("git", "show", "$ref:java-sdk/gradle.properties") } .standardOutput.asText.map { text -> text.lineSequence().first { it.startsWith("projectVersion=") }.substringAfter("=") } } ``` or, at minimum, comparing the two in `doFirst` and failing with a clear message when they disagree. ########## java-sdk/README.md: ########## @@ -116,6 +122,30 @@ projectVersion=1.0.0 Commit the change and push it to the release branch. +Use a Maven-compatible version string, as defined by the +[Maven version order specification](https://maven.apache.org/pom.html#Version_Order_Specification). +For example, version 1 beta 1 is `1.0.0-beta1`, and the eventual +general-availability release is `1.0.0`. + +*NOTE:* Editing `gradle.properties` as above is the standard procedure. You can +alternatively override the version for a single command without editing the +file, by passing `-PprojectVersion=1.0.0-beta1` to any Gradle invocation. This +is handy for one-off or pre-release builds. Either way, `main` should stay on a +`-SNAPSHOT` version between releases: a snapshot sorts after `1.0.0-beta1` and +before the `1.0.0` GA, so no extra bump is needed after a beta. + +### Tag the release candidate + +Tag the release commit, keeping the RC number in the tag name so a failed vote +simply bumps to the next RC (the artifact version itself does not carry the RC +suffix). Push the tag before sending the vote so reviewers can check out the +exact source being voted on. + +```bash +git tag -s java-sdk/1.0.0-beta1-rc1 -m "Java SDK 1.0.0-beta1 RC 1" +git push origin java-sdk/1.0.0-beta1-rc1 Review Comment: ```suggestion git push upstream java-sdk/1.0.0-beta1-rc1 ``` Under the repo's remote naming convention (`upstream` = apache/airflow, `origin` = the contributor's fork), `git push origin` would put the tag on the RM's fork — the vote requires it on apache/airflow. Same applies to the final-tag push further down. ########## java-sdk/README.md: ########## @@ -185,13 +220,109 @@ newlines, which does not work well in a Gradle properties file. credentials instead: `ASF_NEXUS_USERNAME`, `ASF_NEXUS_PASSWORD`, `SIGNING_KEY`, and `SIGNING_PASSWORD`. This is especially useful on e.g. CI. +*NOTE:* We enable Gradle's configuration cache globally, but the staging tasks +(`publishToApache`, `closeApacheStagingRepository`, `releaseApacheStagingRepository`) +talk to the Nexus REST API and are not configuration-cache compatible. Hence +the `--no-configuration-cache` flag on the release commands. + ### Verify the upload -Verify all artifacts have been released correctly to the -[ASF Nexus server](https://repository.apache.org/#nexus-search;quick~org.apache.airflow). +Under *Staging Repositories* on the +[ASF Nexus server](https://repository.apache.org/), open the closed repository +and verify it contains all modules, each with its jar, `-sources.jar`, +`-javadoc.jar` (where applicable), `.pom`, and `.asc` signature. Check *Updated by* (should be your ID), *Uploaded Date*, and *Last Modified*. +### Upload the source package + +The closed staging repository from the previous step is the convenience-binary +URL you link in the vote. + +The signed source package is the artifact the vote is formally on; the Maven +artifacts are convenience binaries. The `sourceRelease` task builds it from the +committed `java-sdk` sources (`LICENSE` and `NOTICE` included) and produces its +signature and checksum in one step: + +```bash +# Signing uses your local gpg keyring, so have your key/passphrase ready. +./gradlew sourceRelease -PgitRef=java-sdk/1.0.0-beta1-rc1 +``` + +This writes three files to `build/distributions/`: + +``` +apache-airflow-java-sdk-1.0.0-beta1-src.tar.gz +apache-airflow-java-sdk-1.0.0-beta1-src.tar.gz.asc +apache-airflow-java-sdk-1.0.0-beta1-src.tar.gz.sha512 +``` + +Copy the three files into your checkout of the ASF dist *dev* repo and commit +them with Subversion. If you don't already have the repo checked out, replace +`<dist-dev-checkout>` with wherever you want it and `<path-to>` with this +project's location: + +```bash +# One-time: check out the Airflow dist dev area. +svn checkout https://dist.apache.org/repos/dist/dev/airflow <dist-dev-checkout> + +cd <dist-dev-checkout> +mkdir -p java-sdk/1.0.0-beta1-rc1 +cp <path-to>/java-sdk/build/distributions/apache-airflow-java-sdk-1.0.0-beta1-src.tar.gz* \ + java-sdk/1.0.0-beta1-rc1/ + +svn add --parents java-sdk/1.0.0-beta1-rc1 +svn commit -m "Add Apache Airflow Java SDK 1.0.0-beta1-rc1 source release candidate" +``` + +The commit publishes them under +`https://dist.apache.org/repos/dist/dev/airflow/java-sdk/1.0.0-beta1-rc1/`, which +is the source-package URL you link in the vote. + +### Call the vote + +Send a `[VOTE]` email to `[email protected]` linking the git tag and +commit, the source package in `dist/dev`, the closed Nexus staging repository, +and the `KEYS` file. + +### After a successful vote + +Reply with a `[RESULT][VOTE]` tally, then: + +1. **Release** the staging repository so the artifacts sync to Maven Central + (a few hours). Nothing is rebuilt or re-signed: + + ```bash + ./gradlew releaseApacheStagingRepository --no-configuration-cache + ``` + + (Or click *Release* on the repository in the Nexus UI.) + +2. **Move** the source package from `dist/dev` to `dist/release`: + + ```bash + svn mv https://dist.apache.org/repos/dist/dev/airflow/java-sdk/1.0.0-beta1-rc1 \ + https://dist.apache.org/repos/dist/release/airflow/java-sdk/1.0.0-beta1 \ + -m "Release Apache Airflow Java SDK 1.0.0-beta1" + ``` + +3. **Tag** the final version on the same commit that was voted: + + ```bash + git tag -s java-sdk/1.0.0-beta1 <voted-commit-hash> -m "Apache Airflow Java SDK 1.0.0-beta1" + git push origin java-sdk/1.0.0-beta1 Review Comment: ```suggestion git push upstream java-sdk/1.0.0-beta1 ``` Same remote-convention point as the RC tag above: the release tag must land on apache/airflow (`upstream`), not the fork. ########## java-sdk/build.gradle.kts: ########## @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.gradle.process.CommandLineArgumentProvider + +plugins { + id("io.github.gradle-nexus.publish-plugin") version "2.0.0" +} + +val projectVersion: String by project + +group = "org.apache.airflow" +version = projectVersion + +if (!project.hasProperty("mavenUrl")) { + nexusPublishing { + repositories { + create("apache") { + nexusUrl.set(uri("https://repository.apache.org/service/local/")) + snapshotRepositoryUrl.set( + uri("https://repository.apache.org/content/repositories/snapshots/"), + ) + username.set( + providers.gradleProperty("mavenUsername") + .orElse(providers.environmentVariable("ASF_NEXUS_USERNAME")), + ) + password.set( + providers.gradleProperty("mavenPassword") + .orElse(providers.environmentVariable("ASF_NEXUS_PASSWORD")), + ) + } + } + } +} + +val sourceReleaseDir = layout.buildDirectory.dir("distributions") +val sourceReleaseTarball = sourceReleaseDir.map { it.file("apache-airflow-java-sdk-$version-src.tar.gz") } + +val sourceTarball by tasks.registering(Exec::class) { + group = "release" + description = "Assembles the source tarball from committed java-sdk sources." + executable = "git" + workingDir = rootDir + + // Capture early to keep compatibility to the Gradle configuration cache. + val gitRef = providers.gradleProperty("gitRef").getOrNull() + val archiveVersion = version.toString() + val tarball = sourceReleaseTarball.get().asFile + + argumentProviders.add( + CommandLineArgumentProvider { + if (gitRef == null) throw GradleException("sourceRelease requires -PgitRef=<tag>") + listOf( + "archive", + "--format=tar.gz", + "--prefix=apache-airflow-java-sdk-$archiveVersion/", + "-o", tarball.absolutePath, + gitRef, Review Comment: Now that #69527 vendors the supervisor schema inside `java-sdk/sdk/schema/`, the source package only needs the `java-sdk` subtree — but archiving the bare ref packs the entire monorepo into the tarball (~69 MB at the rc1 tag, vs ~121 KB for the subtree): ```suggestion "$gitRef:java-sdk", ``` With the subtree form the unpacked root is the Gradle build root (matching the README's `./gradlew build` instructions), and `LICENSE`/`NOTICE` from this PR plus the vendored schema from #69527 make the package fully self-contained — no network needed at build time (the sync task is a no-op when the vendored `api_version` matches `airflowSupervisorSchemaVersion`). I verified the vendored schema is byte-identical to the hosted `2026-06-16.json` and to the file at the rc1 tag. -- 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]
