This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 0953e0f844 Mount selected sources of Airflow to image when running
mypy checks (#36038)
0953e0f844 is described below
commit 0953e0f844fa5db81c2b461ec2433de1935260b3
Author: Jarek Potiuk <[email protected]>
AuthorDate: Mon Dec 4 12:15:07 2023 +0100
Mount selected sources of Airflow to image when running mypy checks (#36038)
When Mypy runs its check it uses breeze image to do so, and by
default on CI the images are built using `main` version of scripts/ci
and workflow files. This basically means that running static checks with
the breeze image reguies mounting the sources if we want to run those
checks on the scripts/ci/ folder or .workflow and breeze CI image is
used.
The `mypy-dev` check is doing it - it checks `scripts/ci` folder,
which means that for mypy checks we need to force mounting the
selected sources rather than the ones that are baked in the image.
---
scripts/ci/pre_commit/pre_commit_mypy.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/scripts/ci/pre_commit/pre_commit_mypy.py
b/scripts/ci/pre_commit/pre_commit_mypy.py
index b89afa41b2..61fc4baede 100755
--- a/scripts/ci/pre_commit/pre_commit_mypy.py
+++ b/scripts/ci/pre_commit/pre_commit_mypy.py
@@ -45,6 +45,10 @@ res = run_command_via_breeze_shell(
warn_image_upgrade_needed=True,
extra_env={
"INCLUDE_MYPY_VOLUME": "true",
+ # Need to mount local sources when running it - to not have to rebuild
the image
+ # and to let CI work on it when running on PRs from forks - because
mypy-dev uses files
+ # that are not available at the time when image is built in CI
+ "MOUNT_SOURCES": "selected",
},
)
if res.returncode != 0: