You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Jie211 (via GitHub)" <gi...@apache.org> on 2026/09/10 06:34:06 UTC

[PR] Stop warning about SSH host key checking on GitHub App connections [airflow]

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

   ### Purpose
   
   Two fixes for the GitHub App authentication that #64422 added to the `git` provider.
   
   #### 1. It only works on github.com
   
   `_get_github_app_token()` calls `GithubIntegration(auth=auth)` with no `base_url`, so PyGithub uses
   its default, `https://api.github.com`. That URL only gives tokens for github.com repositories. GitHub
   Enterprise Server serves its REST API at `https://HOSTNAME/api/v3`, so the feature fails there.
   
   This PR adds a `github_api_url` connection extra and passes it as `base_url`. The hook does not guess
   the value, because the API host does not always follow the repository host. The `github` provider also
   takes this URL from the connection.
   
   github.com needs no new setting. The extra defaults to `https://api.github.com`, the value PyGithub
   used before. For another host the hook now raises when the connection is created, instead of sending
   the request to the wrong API.
   
   #### 2. A GitHub App connection shows an SSH warning
   
   `_uses_ssh_transport_options()` returns `True` when `key_file` or `private_key` has a value. Before
   #64422 only SSH keys used these extras. #64422 puts the GitHub App PEM key there too, but GitHub App
   authentication uses HTTPS only. So the hook warns about `known_hosts_file` and
   `strict_host_key_checking`, which do nothing over HTTPS. Every GitHub App test in #64422 had to wrap
   this warning in `pytest.warns(...)`.
   
   The method now returns `False` for a GitHub App connection, and those tests check that no warning
   appears.
   
   ---
   
   related: #64422
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, please
   change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
   -->
   
   - [X] Yes (please specify the tool below)
   
   <!--
   Generated-by: [Tool Name] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   -->
   
   ---
   
   * Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number.
   


-- 
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] Add GitHub Enterprise support to GitHub App authentication in the git provider [airflow]

Posted by "Jie211 (via GitHub)" <gi...@apache.org>.
Jie211 closed pull request #72865: Add GitHub Enterprise support to GitHub App authentication in the git provider
URL: https://github.com/apache/airflow/pull/72865


-- 
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] Add GitHub Enterprise support to GitHub App authentication in the git provider [airflow]

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


##########
providers/git/src/airflow/providers/git/hooks/git.py:
##########
@@ -88,6 +93,7 @@ def get_ui_field_behaviour(cls) -> dict[str, Any]:
                         "ssh_port": "",
                         "github_app_id": "",
                         "github_installation_id": "",
+                        "github_api_url": "",

Review Comment:
   Could you also add `github_api_url` to `providers/git/provider.yaml` and regenerate `get_provider_info.py`? 
   
   `ProvidersManager` loads the existing `ui-field-behaviour` from packaged provider metadata and therefore skips this hook method, so the new placeholder will not appear in the connection UI as written.



-- 
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] Add GitHub Enterprise support to GitHub App authentication in the git provider [airflow]

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

   @jeff3071 
   sorry, I made a mistake with the branch and had to open a new PR: https://github.com/apache/airflow/pull/73662


-- 
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