uranusjr commented on code in PR #71527:
URL: https://github.com/apache/airflow/pull/71527#discussion_r3774131217
##########
dev/breeze/src/airflow_breeze/commands/kubernetes_commands.py:
##########
@@ -2509,12 +2510,39 @@ def deploy_cluster(
"aws://test:test@/?region_name=us-east-1&"
"endpoint_url=http%3A%2F%2Flocalstack.airflow.svc.cluster.local%3A4566"
)
-# The Go/Java SDKs are always built from upstream main so branches with stale
or missing
-# go-sdk/java-sdk copies still test current SDK sources. See
kubernetes-tests/lang_sdk/README.md.
+# Runs targeting a branch other than main build the Go/Java SDKs from upstream
main, so
+# release/backport branches with stale or missing go-sdk/java-sdk copies still
test current SDK
+# sources. See kubernetes-tests/lang_sdk/README.md.
LANG_SDK_UPSTREAM_GIT_URL = "https://github.com/apache/airflow.git"
LANG_SDK_UPSTREAM_REF = "main"
+def _lang_sdk_target_branch() -> str:
+ """Branch this run targets. GITHUB_BASE_REF for PRs, DEFAULT_BRANCH in CI,
else this checkout's."""
+ return os.environ.get("GITHUB_BASE_REF") or
os.environ.get("DEFAULT_BRANCH") or AIRFLOW_BRANCH
+
+
+def _lang_sdk_resolve_sdk_sources(staging: Path, output: Output | None) ->
tuple[Path, Path]:
+ """Resolve the go-sdk/java-sdk trees the lang-SDK artifacts are built from.
+
+ A run targeting main builds the checked-out branch's own SDK sources, so a
PR's SDK changes
+ are what the k8s test exercises -- without this,
``java_example``/``go_example`` (harness code
+ that tracks the branch) is compiled against a different SDK than the
branch it belongs to, and
+ any SDK rename breaks the build. Runs targeting anything else fall back to
upstream main.
+ """
+ target = _lang_sdk_target_branch()
+ if target == LANG_SDK_UPSTREAM_REF:
+ get_console(output=output).print(
+ f"[info]Run targets {target}: building the lang-SDK Go/Java
artifacts from this branch"
+ )
+ return AIRFLOW_ROOT_PATH / "go-sdk", AIRFLOW_ROOT_PATH / "java-sdk"
Review Comment:
`LANG_SDK_UPSTREAM_REF` is doing double duty; it's "the ref to fetch from
the upstream remote" and, via this comparison, "the sentinel meaning use local
sources." I would separate the two semantics; this one here can maybe be
`LANG_SDK_LOCAL_SOURCE_BRANCH`.
--
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]