This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-1-test by this push:
     new f8c64937ff5 [v3-1-test] Run hatch always in a clean env (#61970) 
(#62051)
f8c64937ff5 is described below

commit f8c64937ff5cb5ccfe3f8ed0248b60d5c3a53a63
Author: Jens Scheffler <[email protected]>
AuthorDate: Mon Feb 16 23:19:09 2026 +0100

    [v3-1-test] Run hatch always in a clean env (#61970) (#62051)
    
    * Run hatch always in a clean env
    
    * Add PATH to env
    (cherry picked from commit 736c262a272814bd829b8299f66ba329c6112ecf)
---
 .../commands/release_candidate_command.py               |  5 ++---
 .../commands/release_management_commands.py             | 17 +++++++----------
 .../in_container/run_prepare_airflow_distributions.py   |  7 +++----
 3 files changed, 12 insertions(+), 17 deletions(-)

diff --git 
a/dev/breeze/src/airflow_breeze/commands/release_candidate_command.py 
b/dev/breeze/src/airflow_breeze/commands/release_candidate_command.py
index 9df625b6e54..87ed11974cf 100644
--- a/dev/breeze/src/airflow_breeze/commands/release_candidate_command.py
+++ b/dev/breeze/src/airflow_breeze/commands/release_candidate_command.py
@@ -364,11 +364,10 @@ def create_artifacts_with_hatch(source_date_epoch: int):
     console_print("[info]Creating artifacts with hatch")
     shutil.rmtree(AIRFLOW_DIST_PATH, ignore_errors=True)
     AIRFLOW_DIST_PATH.mkdir(exist_ok=True)
-    env_copy = os.environ.copy()
-    env_copy["SOURCE_DATE_EPOCH"] = str(source_date_epoch)
+    hatch_env = {"SOURCE_DATE_EPOCH": str(source_date_epoch), "PATH": 
os.environ["PATH"]}
     # Build Airflow packages
     run_command(
-        ["hatch", "build", "-c", "-t", "custom", "-t", "sdist", "-t", 
"wheel"], check=True, env=env_copy
+        ["hatch", "build", "-c", "-t", "custom", "-t", "sdist", "-t", 
"wheel"], check=True, env=hatch_env
     )
     # Build Task SDK packages
     run_command(
diff --git 
a/dev/breeze/src/airflow_breeze/commands/release_management_commands.py 
b/dev/breeze/src/airflow_breeze/commands/release_management_commands.py
index 4d3f7fa85ba..7e76086647b 100644
--- a/dev/breeze/src/airflow_breeze/commands/release_management_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/release_management_commands.py
@@ -444,8 +444,7 @@ def 
apply_distribution_format_to_hatch_command(build_command: list[str], distrib
 
 
 def _build_airflow_packages_with_hatch(distribution_format: str, 
source_date_epoch: int, version_suffix: str):
-    env_copy = os.environ.copy()
-    env_copy["SOURCE_DATE_EPOCH"] = str(source_date_epoch)
+    hatch_env = {"SOURCE_DATE_EPOCH": str(source_date_epoch), "PATH": 
os.environ["PATH"]}
     build_airflow_core_command = ["hatch", "build", "-c", "-t", "custom"]
     apply_distribution_format_to_hatch_command(build_airflow_core_command, 
distribution_format)
     get_console().print(f"[bright_blue]Building apache-airflow-core 
distributions: {distribution_format}\n")
@@ -458,7 +457,7 @@ def _build_airflow_packages_with_hatch(distribution_format: 
str, source_date_epo
         run_command(
             build_airflow_core_command,
             check=True,
-            env=env_copy,
+            env=hatch_env,
             cwd=AIRFLOW_CORE_ROOT_PATH,
         )
     get_console().print(f"[bright_blue]Building apache-airflow distributions: 
{distribution_format}\n")
@@ -473,7 +472,7 @@ def _build_airflow_packages_with_hatch(distribution_format: 
str, source_date_epo
         run_command(
             build_airflow_command,
             check=True,
-            env=env_copy,
+            env=hatch_env,
             cwd=AIRFLOW_ROOT_PATH,
         )
     for distribution_path in (AIRFLOW_CORE_ROOT_PATH / 
"dist").glob("apache_airflow_core*"):
@@ -612,12 +611,11 @@ def _prepare_non_core_distributions(
             command += ["-t", "sdist"]
         if build_distribution_format == "wheel" or build_distribution_format 
== "both":
             command += ["-t", "wheel"]
-        env_copy = os.environ.copy()
-        env_copy["SOURCE_DATE_EPOCH"] = str(source_date_epoch)
+        hatch_env = {"SOURCE_DATE_EPOCH": str(source_date_epoch), "PATH": 
os.environ["PATH"]}
         run_command(
             cmd=command,
             cwd=root_path,
-            env=env_copy,
+            env=hatch_env,
             check=True,
         )
         shutil.copytree(distribution_path, AIRFLOW_DIST_PATH, 
dirs_exist_ok=True)
@@ -3438,12 +3436,11 @@ def 
_build_client_packages_with_hatch(source_date_epoch: int, distribution_forma
         command += ["-t", "sdist"]
     if distribution_format == "wheel" or distribution_format == "both":
         command += ["-t", "wheel"]
-    env_copy = os.environ.copy()
-    env_copy["SOURCE_DATE_EPOCH"] = str(source_date_epoch)
+    hatch_env = {"SOURCE_DATE_EPOCH": str(source_date_epoch), "PATH": 
os.environ["PATH"]}
     run_command(
         cmd=command,
         cwd=PYTHON_CLIENT_DIR_PATH,
-        env=env_copy,
+        env=hatch_env,
         check=True,
     )
     shutil.copytree(PYTHON_CLIENT_DIST_DIR_PATH, AIRFLOW_DIST_PATH, 
dirs_exist_ok=True)
diff --git a/scripts/in_container/run_prepare_airflow_distributions.py 
b/scripts/in_container/run_prepare_airflow_distributions.py
index 6dfc64a8d38..1c61f52ad84 100755
--- a/scripts/in_container/run_prepare_airflow_distributions.py
+++ b/scripts/in_container/run_prepare_airflow_distributions.py
@@ -86,8 +86,7 @@ def apply_distribution_format_to_hatch_command(build_command: 
list[str], distrib
 
 def build_airflow_packages(distribution_format: str):
     reproducible_date = 
yaml.safe_load(REPRODUCIBLE_BUILD_YAML_PATH.read_text())["source-date-epoch"]
-    envcopy = os.environ.copy()
-    envcopy["SOURCE_DATE_EPOCH"] = str(reproducible_date)
+    hatch_env = {"SOURCE_DATE_EPOCH": str(reproducible_date), "PATH": 
os.environ["PATH"]}
     airflow_core_build_command = [sys.executable, "-m", "hatch", "build", 
"-t", "custom"]
     apply_distribution_format_to_hatch_command(airflow_core_build_command, 
distribution_format)
     console.print(f"[bright_blue]Building apache-airflow-core distributions: 
{distribution_format}\n")
@@ -96,7 +95,7 @@ def build_airflow_packages(distribution_format: str):
         check=False,
         capture_output=False,
         cwd=AIRFLOW_CORE_ROOT_PATH,
-        env=envcopy,
+        env=hatch_env,
     )
     if build_process.returncode != 0:
         console.print("[red]Error building Airflow packages")
@@ -109,7 +108,7 @@ def build_airflow_packages(distribution_format: str):
         check=False,
         capture_output=False,
         cwd=AIRFLOW_ROOT_PATH,
-        env=envcopy,
+        env=hatch_env,
     )
     if build_process.returncode != 0:
         console.print("[red]Error building Airflow packages")

Reply via email to