ephraimbuddy commented on code in PR #44976:
URL: https://github.com/apache/airflow/pull/44976#discussion_r1898375228


##########
airflow/dag_processing/bundles/git.py:
##########
@@ -120,9 +154,16 @@ def _has_version(repo: Repo, version: str) -> bool:
         except BadName:
             return False
 
+    def _refresh(self):
+        self.bare_repo.remotes.origin.fetch("+refs/heads/*:refs/heads/*")
+        self.repo.remotes.origin.pull()
+
     def refresh(self) -> None:
         if self.version:
             raise AirflowException("Refreshing a specific version is not 
supported")
 
-        self.bare_repo.remotes.origin.fetch("+refs/heads/*:refs/heads/*")
-        self.repo.remotes.origin.pull()
+        if self.ssh_hook:
+            with self.ssh_hook.get_conn():

Review Comment:
   > Doesn't this create a session to the (a?) remote ssh host 
[here](https://github.com/apache/airflow/blob/351ac28c7c4dde3a611e4260bbb0f01c7618f261/providers/src/airflow/providers/ssh/hooks/ssh.py#L339-L340)?
 Not sure we want that. Not even sure where this would connect, since the 
remote host likely wouldn't match the repo_url.
   
   I have reworked this to use a separate connection derived from SSHHook. This 
still has to connect to the host machine(not github.com, for example) but the 
host where the Airflow is running. When connected to the host, it will now use 
the provided ssh key to authenticate to github and clone the repository. This 
connection is closed after cloning the repo because of the use of the context 
manager when establishing the 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to