You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "jedcunningham (via GitHub)" <gi...@apache.org> on 2025/02/13 05:58:41 UTC

[PR] Fix `repo_url` kwarg for git dag bundle with https private repos [airflow]

jedcunningham opened a new pull request, #46710:
URL: https://github.com/apache/airflow/pull/46710

   We weren't doing the kwargs override for `repo_url` correctly - it was overriding it, but it wasn't getting the access token either. This does the override _then_ mutates with auth.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix `repo_url` kwarg for git dag bundle with https private repos [airflow]

Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on code in PR #46710:
URL: https://github.com/apache/airflow/pull/46710#discussion_r1953953963


##########
airflow/dag_processing/bundles/git.py:
##########
@@ -148,8 +148,8 @@ def __init__(
         self.git_conn_id = git_conn_id
         self.repo_url = repo_url
         try:
-            self.hook = GitHook(git_conn_id=self.git_conn_id)
-            self.repo_url = self.repo_url or self.hook.repo_url
+            self.hook = GitHook(git_conn_id=self.git_conn_id, repo_url=self.repo_url)
+            self.repo_url = self.hook.repo_url
         except AirflowException as e:

Review Comment:
   Maybe. The most obvious failure mode is missing connection. But I wonder if there are others... I'll look into this tomorrow, I've taken a note.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix `repo_url` kwarg for git dag bundle with https private repos [airflow]

Posted by "ephraimbuddy (via GitHub)" <gi...@apache.org>.
ephraimbuddy commented on code in PR #46710:
URL: https://github.com/apache/airflow/pull/46710#discussion_r1954020740


##########
airflow/dag_processing/bundles/git.py:
##########
@@ -68,10 +68,10 @@ def get_ui_field_behaviour(cls) -> dict[str, Any]:
             },
         }
 
-    def __init__(self, git_conn_id="git_default", *args, **kwargs):
+    def __init__(self, git_conn_id: str = "git_default", repo_url: str | None = None, *args, **kwargs) -> None:

Review Comment:
   Do we need the repo_url on the hook or just take it from the connection host? Should we remove the repo_url on the GitDagBundle itself?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix `repo_url` kwarg for git dag bundle with https private repos [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #46710:
URL: https://github.com/apache/airflow/pull/46710#discussion_r1953946751


##########
airflow/dag_processing/bundles/git.py:
##########
@@ -68,10 +68,10 @@ def get_ui_field_behaviour(cls) -> dict[str, Any]:
             },
         }
 
-    def __init__(self, git_conn_id="git_default", *args, **kwargs):
+    def __init__(self, git_conn_id="git_default", repo_url=None, *args, **kwargs):

Review Comment:
   ```suggestion
       def __init__(self, git_conn_id: str = "git_default", repo_url: str | None = None, *args, **kwargs) -> None:
   ```



##########
airflow/dag_processing/bundles/git.py:
##########
@@ -148,8 +148,8 @@ def __init__(
         self.git_conn_id = git_conn_id
         self.repo_url = repo_url
         try:
-            self.hook = GitHook(git_conn_id=self.git_conn_id)
-            self.repo_url = self.repo_url or self.hook.repo_url
+            self.hook = GitHook(git_conn_id=self.git_conn_id, repo_url=self.repo_url)
+            self.repo_url = self.hook.repo_url
         except AirflowException as e:

Review Comment:
   Not related to this PR, but should we make it a more concrete exception instead of the broad AirflowException 🤔



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix `repo_url` kwarg for git dag bundle with https private repos [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on PR #46710:
URL: https://github.com/apache/airflow/pull/46710#issuecomment-2655731427

   left some nits


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix `repo_url` kwarg for git dag bundle with https private repos [airflow]

Posted by "vatsrahul1001 (via GitHub)" <gi...@apache.org>.
vatsrahul1001 commented on PR #46710:
URL: https://github.com/apache/airflow/pull/46710#issuecomment-2655661844

   Thanks @jedcunningham for fixing this. I have also noticed this issue yesterday.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix `repo_url` kwarg for git dag bundle with https private repos [airflow]

Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on code in PR #46710:
URL: https://github.com/apache/airflow/pull/46710#discussion_r1954710264


##########
airflow/dag_processing/bundles/git.py:
##########
@@ -68,10 +68,10 @@ def get_ui_field_behaviour(cls) -> dict[str, Any]:
             },
         }
 
-    def __init__(self, git_conn_id="git_default", *args, **kwargs):
+    def __init__(self, git_conn_id: str = "git_default", repo_url: str | None = None, *args, **kwargs) -> None:

Review Comment:
   It also provides flexibility where the connection can hold a shared credential and the repo to use is set in the bundle itself.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix `repo_url` kwarg for git dag bundle with https private repos [airflow]

Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on code in PR #46710:
URL: https://github.com/apache/airflow/pull/46710#discussion_r1954706670


##########
airflow/dag_processing/bundles/git.py:
##########
@@ -68,10 +68,10 @@ def get_ui_field_behaviour(cls) -> dict[str, Any]:
             },
         }
 
-    def __init__(self, git_conn_id="git_default", *args, **kwargs):
+    def __init__(self, git_conn_id: str = "git_default", repo_url: str | None = None, *args, **kwargs) -> None:

Review Comment:
   We added it back intentionally: https://github.com/apache/airflow/issues/45952
   
   For cases where its either a public repo or if keys are already configured on your system, you can operate without a connection.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix `repo_url` kwarg for git dag bundle with https private repos [airflow]

Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham merged PR #46710:
URL: https://github.com/apache/airflow/pull/46710


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org