This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v3-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-4-test by this push:
new 0ba62b88035 [v3-4-test] Keep Java SDK snapshot docs out of the
published documentation (#76165) (#76166)
0ba62b88035 is described below
commit 0ba62b880353e8e9fd658fdea463445392320637
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Oct 31 19:45:48 2026 +0100
[v3-4-test] Keep Java SDK snapshot docs out of the published documentation
(#76165) (#76166)
Publishing all docs for Airflow 3.4.0rc2 also built the Java SDK Javadoc
from that ref, where the Java SDK carries its 1.0.0-SNAPSHOT development
version between releases. It was published as a versioned folder, and
the packages metadata regeneration that followed failed on it, since a
Maven snapshot is not a valid Python version. Snapshot Javadoc is never
a release to publish, and a snapshot folder that already reached S3
must not keep every later metadata regeneration failing.
(cherry picked from commit fe579ea0752b52f4f1f11f63b6f3e9767c6ee8eb)
Generated-by: Claude Opus 5
Co-authored-by: Jarek Potiuk <[email protected]>
---
.github/workflows/publish-docs-to-s3.yml | 14 ++++++--
.../src/airflow_breeze/utils/publish_docs_to_s3.py | 31 ++++++++++++-----
dev/breeze/tests/test_publish_docs_to_s3.py | 40 +++++++++++++++++++++-
3 files changed, 72 insertions(+), 13 deletions(-)
diff --git a/.github/workflows/publish-docs-to-s3.yml
b/.github/workflows/publish-docs-to-s3.yml
index 8cc9f6829fd..d69319ad315 100644
--- a/.github/workflows/publish-docs-to-s3.yml
+++ b/.github/workflows/publish-docs-to-s3.yml
@@ -505,14 +505,22 @@ jobs:
# wave like "amazon cncf.kubernetes ..."), the Java SDK must NOT be
added
# automatically — a providers-only publish should not suddenly
refresh the
# java-sdk docs as a side effect.
+ #
+ # Between Java SDK releases java-sdk/gradle.properties carries a
-SNAPSHOT development
+ # version. Its Javadoc must not be published: it would become a
versioned folder and the
+ # stable docs of the Java SDK, for example when an Airflow release
publishes all docs.
if [[ "${INCLUDE_DOCS}" != "all" && " ${INCLUDE_DOCS} " != *"
java-sdk "* ]]; then
echo "exists=false" >> "${GITHUB_OUTPUT}"
echo "include-docs='${INCLUDE_DOCS}' is a specific package list
without 'java-sdk' — skipping Javadoc build."
- elif [[ -f "java-sdk/gradlew" ]]; then
- echo "exists=true" >> "${GITHUB_OUTPUT}"
- else
+ elif [[ ! -f "java-sdk/gradlew" ]]; then
echo "exists=false" >> "${GITHUB_OUTPUT}"
echo "java-sdk/ not found at ref ${REF} — skipping Javadoc build."
+ elif grep -Eq
'^[[:space:]]*projectVersion[[:space:]]*=[[:space:]]*[^[:space:]]+-SNAPSHOT[[:space:]]*$'
\
+ java-sdk/gradle.properties; then
+ echo "exists=false" >> "${GITHUB_OUTPUT}"
+ echo "The Java SDK at ref ${REF} has a -SNAPSHOT development
version — skipping Javadoc build."
+ else
+ echo "exists=true" >> "${GITHUB_OUTPUT}"
fi
- name: "Install Breeze"
if: steps.sdk-present.outputs.exists == 'true'
diff --git a/dev/breeze/src/airflow_breeze/utils/publish_docs_to_s3.py
b/dev/breeze/src/airflow_breeze/utils/publish_docs_to_s3.py
index 0b914fa7639..7c8fb990596 100644
--- a/dev/breeze/src/airflow_breeze/utils/publish_docs_to_s3.py
+++ b/dev/breeze/src/airflow_breeze/utils/publish_docs_to_s3.py
@@ -47,6 +47,9 @@ s3_client = boto3.client("s3")
cloudfront_client = boto3.client("cloudfront")
+SNAPSHOT_SUFFIX = "-SNAPSHOT"
+
+
class VersionError:
"""Class to track version errors during processing."""
@@ -321,15 +324,20 @@ class S3DocsPublish:
console_print(f"[success]CloudFront cache request invalidated
successfully: {distribution_id}\n")
def dump_docs_package_metadata(self, package_versions: dict[str,
list[str]]):
- all_packages_infos = [
- {
- "package-name": package_name,
- "all-versions": (all_versions :=
self.get_latest_minor_versions(package_name, versions)),
- "stable-version": all_versions[-1],
- }
- for package_name, versions in package_versions.items()
- ]
-
+ all_packages_infos = []
+ for package_name, versions in package_versions.items():
+ all_versions = self.get_latest_minor_versions(package_name,
versions)
+ # A package with only development builds, such as Java SDK
snapshots, has no release yet.
+ if not all_versions:
+ console_print(f"[warning]No released versions of
{package_name}; left out of the metadata\n")
+ continue
+ all_packages_infos.append(
+ {
+ "package-name": package_name,
+ "all-versions": all_versions,
+ "stable-version": all_versions[-1],
+ }
+ )
return all_packages_infos
@staticmethod
@@ -340,6 +348,11 @@ class S3DocsPublish:
console_print(versions)
all_versions: list[Version] = []
for v in versions:
+ # A Maven development build such as the Java SDK's
`1.0.0-SNAPSHOT` is not a release and
+ # is not a valid Python version either; one that reached S3 is
left out, not an error.
+ if v.upper().endswith(SNAPSHOT_SUFFIX):
+ console_print(f"[warning]Skipping development build {v} of
{package_name}\n")
+ continue
try:
all_versions.append(Version(v))
except ValueError as e:
diff --git a/dev/breeze/tests/test_publish_docs_to_s3.py
b/dev/breeze/tests/test_publish_docs_to_s3.py
index 814fd37f2f1..531b1ff0a2a 100644
--- a/dev/breeze/tests/test_publish_docs_to_s3.py
+++ b/dev/breeze/tests/test_publish_docs_to_s3.py
@@ -21,7 +21,7 @@ from unittest.mock import MagicMock, PropertyMock, mock_open,
patch
import pytest
-from airflow_breeze.utils.publish_docs_to_s3 import S3DocsPublish
+from airflow_breeze.utils.publish_docs_to_s3 import S3DocsPublish, VersionError
class TestPublishDocsToS3:
@@ -298,3 +298,41 @@ class TestPublishDocsToS3:
self.publish_docs_to_s3.run_publish()
assert mock_generate_packages_metadata.call_count == expected_calls
+
+
[email protected](
+ ("versions", "expected"),
+ [
+ pytest.param(["1.0.0-SNAPSHOT", "1.0.0-beta1"], ["1.0.0b1"],
id="maven-snapshot-skipped"),
+ pytest.param(["2.1.0-snapshot", "2.0.0"], ["2.0.0"],
id="lowercase-snapshot-skipped"),
+ ],
+)
+def test_get_latest_minor_versions_skips_development_builds(versions,
expected):
+ VersionError.set_version_error(False)
+
+ assert S3DocsPublish.get_latest_minor_versions("java-sdk", versions) ==
expected
+ assert VersionError.has_any_error() is False
+
+
+def test_get_latest_minor_versions_still_fails_on_other_invalid_versions():
+ VersionError.set_version_error(False)
+ try:
+ assert S3DocsPublish.get_latest_minor_versions("java-sdk",
["not-a-version", "1.0.0"]) == ["1.0.0"]
+ assert VersionError.has_any_error() is True
+ finally:
+ VersionError.set_version_error(False)
+
+
+def
test_dump_docs_package_metadata_leaves_out_packages_with_only_development_builds():
+ publish = S3DocsPublish(
+ source_dir_path="source_dir_path",
+ destination_location="destination_location",
+ exclude_docs="",
+ dry_run=False,
+ overwrite=False,
+ parallelism=1,
+ )
+
+ assert publish.dump_docs_package_metadata(
+ {"java-sdk": ["1.0.0-SNAPSHOT"], "apache-airflow": ["3.3.0", "3.4.0"]}
+ ) == [{"package-name": "apache-airflow", "all-versions": ["3.3.0",
"3.4.0"], "stable-version": "3.4.0"}]