Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid breeze self-upgrade run in some pre-commits. #35802

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions scripts/ci/pre_commit/pre_commit_breeze_cmd_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ def verify_all_commands_described_in_docs():


def is_regeneration_needed() -> bool:
env = os.environ.copy()
env["AIRFLOW_SOURCES_ROOT"] = str(AIRFLOW_SOURCES_DIR)
# needed to keep consistent output
env["PYTHONPATH"] = str(BREEZE_SOURCES_DIR)
return_code = call(
[
sys.executable,
Expand All @@ -72,12 +68,15 @@ def is_regeneration_needed() -> bool:
"regenerate-command-images",
"--check-only",
],
env=env,
)
return return_code != 0


if __name__ == "__main__":
os.environ["AIRFLOW_SOURCES_ROOT"] = str(AIRFLOW_SOURCES_DIR)
# needed to keep consistent output
os.environ["PYTHONPATH"] = str(BREEZE_SOURCES_DIR)
os.environ["SKIP_UPGRADE_CHECK"] = "true"
return_code = 0
verify_all_commands_described_in_docs()
if is_regeneration_needed():
Expand Down
39 changes: 20 additions & 19 deletions scripts/ci/pre_commit/pre_commit_local_yml_mounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,35 @@
# under the License.
from __future__ import annotations

import os
import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).parent.resolve())) # make sure common_precommit_utils is imported
if __name__ == "__main__":
os.environ["SKIP_UPGRADE_CHECK"] = "true"
sys.path.insert(0, str(Path(__file__).parent.resolve())) # make sure common_precommit_utils is imported

from common_precommit_utils import AIRFLOW_SOURCES_ROOT_PATH # isort: skip # noqa: E402
from common_precommit_utils import AIRFLOW_SOURCES_ROOT_PATH # isort: skip

sys.path.insert(0, str(AIRFLOW_SOURCES_ROOT_PATH)) # make sure setup is imported from Airflow
sys.path.insert(
0, str(AIRFLOW_SOURCES_ROOT_PATH / "dev" / "breeze" / "src")
) # make sure setup is imported from Airflow
# flake8: noqa: F401
from airflow_breeze.utils.docker_command_utils import VOLUMES_FOR_SELECTED_MOUNTS # isort: skip # noqa: E402
sys.path.insert(0, str(AIRFLOW_SOURCES_ROOT_PATH)) # make sure setup is imported from Airflow
sys.path.insert(
0, str(AIRFLOW_SOURCES_ROOT_PATH / "dev" / "breeze" / "src")
) # make sure setup is imported from Airflow

from common_precommit_utils import insert_documentation # isort: skip # noqa: E402
from airflow_breeze.utils.docker_command_utils import VOLUMES_FOR_SELECTED_MOUNTS
from common_precommit_utils import insert_documentation

sys.path.append(str(AIRFLOW_SOURCES_ROOT_PATH))
sys.path.append(str(AIRFLOW_SOURCES_ROOT_PATH))

MOUNTS_HEADER = (
" # START automatically generated volumes from "
"VOLUMES_FOR_SELECTED_MOUNTS in docker_command_utils.py"
)
MOUNTS_FOOTER = (
" # END automatically generated volumes from "
"VOLUMES_FOR_SELECTED_MOUNTS in docker_command_utils.py"
)
MOUNTS_HEADER = (
" # START automatically generated volumes from "
"VOLUMES_FOR_SELECTED_MOUNTS in docker_command_utils.py"
)
MOUNTS_FOOTER = (
" # END automatically generated volumes from "
"VOLUMES_FOR_SELECTED_MOUNTS in docker_command_utils.py"
)

if __name__ == "__main__":
local_mount_file_path = AIRFLOW_SOURCES_ROOT_PATH / "scripts" / "ci" / "docker-compose" / "local.yml"
PREFIX = " "
volumes = []
Expand Down
2 changes: 2 additions & 0 deletions scripts/ci/pre_commit/pre_commit_mypy.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

if __name__ == "__main__":
sys.path.insert(0, str(Path(__file__).parent.resolve())) # make sure common_precommit_utils is imported

os.environ["SKIP_UPGRADE_CHECK"] = "true"
from common_precommit_utils import filter_out_providers_on_non_main_branch

sys.path.insert(0, str(AIRFLOW_SOURCES / "dev" / "breeze" / "src"))
Expand Down
Loading