From bf5d7206e8884cb8aae1b583704581278b67207b Mon Sep 17 00:00:00 2001 From: Adrian Edbert Luman Date: Tue, 19 Aug 2025 13:42:59 +0800 Subject: [PATCH] Fix https access token repo url --- providers/git/src/airflow/providers/git/bundles/git.py | 4 ++-- providers/git/tests/unit/git/bundles/test_git.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/providers/git/src/airflow/providers/git/bundles/git.py b/providers/git/src/airflow/providers/git/bundles/git.py index 28241ab045dc4..dea0ae41054b3 100644 --- a/providers/git/src/airflow/providers/git/bundles/git.py +++ b/providers/git/src/airflow/providers/git/bundles/git.py @@ -79,11 +79,11 @@ def __init__( self._log.debug("bundle configured") self.hook: GitHook | None = None try: - self.hook = GitHook(git_conn_id=git_conn_id or "git_default") + self.hook = GitHook(git_conn_id=git_conn_id or "git_default", repo_url=self.repo_url) except AirflowException as e: self._log.warning("Could not create GitHook", conn_id=git_conn_id, exc=e) - if not repo_url and self.hook and self.hook.repo_url: + if self.hook and self.hook.repo_url: self.repo_url = self.hook.repo_url self._log.debug("repo_url updated from hook") diff --git a/providers/git/tests/unit/git/bundles/test_git.py b/providers/git/tests/unit/git/bundles/test_git.py index 6fc73fcab24ec..45db241d15245 100644 --- a/providers/git/tests/unit/git/bundles/test_git.py +++ b/providers/git/tests/unit/git/bundles/test_git.py @@ -121,7 +121,7 @@ def test_https_access_token_repo_url_overrides_connection_host_when_provided(sel tracking_ref=GIT_DEFAULT_BRANCH, repo_url="https://github.com/apache/zzzairflow", ) - assert bundle.repo_url == "https://github.com/apache/zzzairflow" + assert bundle.repo_url == f"https://user:{ACCESS_TOKEN}@github.com/apache/zzzairflow" def test_falls_back_to_connection_host_when_no_repo_url_provided(self): bundle = GitDagBundle(name="test", git_conn_id=CONN_HTTPS, tracking_ref=GIT_DEFAULT_BRANCH)