Skip to content

Commit

Permalink
Fix retrieval of the right branch in pre-commits (#23297)
Browse files Browse the repository at this point in the history
(cherry picked from commit d93908d)
  • Loading branch information
potiuk authored and ephraimbuddy committed Apr 27, 2022
1 parent 331ed72 commit 4b7c308
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
6 changes: 5 additions & 1 deletion scripts/ci/pre_commit/pre_commit_flake8.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@

AIRFLOW_SOURCES = Path(__file__).parents[3].absolute()
GITHUB_REPOSITORY = os.environ.get('GITHUB_REPOSITORY', "apache/airflow")
AIRFLOW_CI_IMAGE = f"ghcr.io/{GITHUB_REPOSITORY}/main/ci/python3.7"

if __name__ == '__main__':
sys.path.insert(0, str(Path(__file__).parents[3].absolute() / "dev" / "breeze" / "src"))
from airflow_breeze.branch_defaults import AIRFLOW_BRANCH

AIRFLOW_CI_IMAGE = f"ghcr.io/{GITHUB_REPOSITORY}/{AIRFLOW_BRANCH}/ci/python3.7"

if subprocess.call(args=["docker", "inspect", AIRFLOW_CI_IMAGE], stdout=subprocess.DEVNULL) != 0:
print(f'[red]The image {AIRFLOW_CI_IMAGE} is not available.[/]\n')
print("\n[yellow]Please run at the earliest convenience:[/]\n\nbreeze build-image --python 3.7\n\n")
Expand Down
5 changes: 4 additions & 1 deletion scripts/ci/pre_commit/pre_commit_migration_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@

AIRFLOW_SOURCES = Path(__file__).parents[3].absolute()
GITHUB_REPOSITORY = os.environ.get('GITHUB_REPOSITORY', "apache/airflow")
AIRFLOW_CI_IMAGE = f"ghcr.io/{GITHUB_REPOSITORY}/main/ci/python3.7"

if __name__ == '__main__':
sys.path.insert(0, str(Path(__file__).parents[3].absolute() / "dev" / "breeze" / "src"))
from airflow_breeze.branch_defaults import AIRFLOW_BRANCH

AIRFLOW_CI_IMAGE = f"ghcr.io/{GITHUB_REPOSITORY}/{AIRFLOW_BRANCH}/ci/python3.7"
if subprocess.call(args=["docker", "inspect", AIRFLOW_CI_IMAGE], stdout=subprocess.DEVNULL) != 0:
print(f'[red]The image {AIRFLOW_CI_IMAGE} is not available.[/]\n')
print("\n[yellow]Please run at the earliest convenience:[/]\n\nbreeze build-image --python 3.7\n\n")
Expand Down
7 changes: 6 additions & 1 deletion scripts/ci/pre_commit/pre_commit_mypy.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@
f"To run this script, run the ./{__file__} command"
)


AIRFLOW_SOURCES = Path(__file__).parents[3].absolute()
GITHUB_REPOSITORY = os.environ.get('GITHUB_REPOSITORY', "apache/airflow")
AIRFLOW_CI_IMAGE = f"ghcr.io/{GITHUB_REPOSITORY}/main/ci/python3.7"

if __name__ == '__main__':
sys.path.insert(0, str(Path(__file__).parents[3].absolute() / "dev" / "breeze" / "src"))
from airflow_breeze.branch_defaults import AIRFLOW_BRANCH

AIRFLOW_CI_IMAGE = f"ghcr.io/{GITHUB_REPOSITORY}/{AIRFLOW_BRANCH}/ci/python3.7"

if subprocess.call(args=["docker", "inspect", AIRFLOW_CI_IMAGE], stdout=subprocess.DEVNULL) != 0:
print(f'[red]The image {AIRFLOW_CI_IMAGE} is not available.[/]\n')
print("\n[yellow]Please run at the earliest convenience:[/]\n\nbreeze build-image --python 3.7\n\n")
Expand Down
4 changes: 4 additions & 0 deletions scripts/ci/pre_commit/pre_commit_ui_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
AIRFLOW_CI_IMAGE = f"ghcr.io/{GITHUB_REPOSITORY}/main/ci/python3.7"

if __name__ == '__main__':
sys.path.insert(0, str(Path(__file__).parents[3].absolute() / "dev" / "breeze" / "src"))
from airflow_breeze.branch_defaults import AIRFLOW_BRANCH

AIRFLOW_CI_IMAGE = f"ghcr.io/{GITHUB_REPOSITORY}/{AIRFLOW_BRANCH}/ci/python3.7"
if subprocess.call(args=["docker", "inspect", AIRFLOW_CI_IMAGE], stdout=subprocess.DEVNULL) != 0:
print(f'[red]The image {AIRFLOW_CI_IMAGE} is not available.[/]\n')
print("\n[yellow]Please run at the earliest convenience:[/]\n\nbreeze build-image --python 3.7\n\n")
Expand Down
4 changes: 4 additions & 0 deletions scripts/ci/pre_commit/pre_commit_www_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
AIRFLOW_CI_IMAGE = f"ghcr.io/{GITHUB_REPOSITORY}/main/ci/python3.7"

if __name__ == '__main__':
sys.path.insert(0, str(Path(__file__).parents[3].absolute() / "dev" / "breeze" / "src"))
from airflow_breeze.branch_defaults import AIRFLOW_BRANCH

AIRFLOW_CI_IMAGE = f"ghcr.io/{GITHUB_REPOSITORY}/{AIRFLOW_BRANCH}/ci/python3.7"
if subprocess.call(args=["docker", "inspect", AIRFLOW_CI_IMAGE], stdout=subprocess.DEVNULL) != 0:
print(f'[red]The image {AIRFLOW_CI_IMAGE} is not available.[/]\n')
print("\n[yellow]Please run at the earliest convenience:[/]\n\nbreeze build-image --python 3.7\n\n")
Expand Down

0 comments on commit 4b7c308

Please sign in to comment.