You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "nailo2c (via GitHub)" <gi...@apache.org> on 2025/07/04 23:54:26 UTC
[PR] fix: always create GitHook even when `repo_url` is provided [airflow]
nailo2c opened a new pull request, #52897:
URL: https://github.com/apache/airflow/pull/52897
Closes: #52332
# Why
A corner case in `GitDagBundle` causes pulling DAGs from a private GitHub repository to fail whenever `repo_url` is set in `dag_bundle_config_list`.
# How
Move the `try / except` block before the `repo_url` detection so that the GitHook is always created.
# What
I tested with a private repo and created an example DAG:
```python
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.bash import BashOperator
default_args = {
"owner": "airflow",
"depends_on_past": False,
"retries": 1,
"retry_delay": timedelta(minutes=5),
}
with DAG(
dag_id="hello_airflow",
default_args=default_args,
description="A simple hello-world DAG",
schedule="0 0 * * *",
start_date=datetime(2025, 7, 4),
catchup=False,
tags=["example"],
) as dag:
say_hello = BashOperator(
task_id="say_hello",
bash_command='echo "Hello Airflow!"',
)
```

Bundle configuration
```console
dag_bundle_config_list = [{"name": "dags-folder", "classpath": "airflow.providers.git.bundles.git.GitDagBundle", "kwargs": {"repo_url": "git@github.com:nailo2c/my_repo.git" , "tracking_ref": "main", "subdir": "dags"}}]
```
Git connection
```console
airflow connections add git_default \
--conn-json '{
"conn_type": "git",
"login": "git",
"host": "github.com",
"extra": {
"private_key": "*****",
"strict_host_key_checking": "no"
}
}'
```
It works well

--
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: always create GitHook even when `repo_url` is provided [airflow]
Posted by "nailo2c (via GitHub)" <gi...@apache.org>.
nailo2c commented on PR #52897:
URL: https://github.com/apache/airflow/pull/52897#issuecomment-3067311081
You're right, I should add a test for it, even though it's a small logic change. I'll be more mindful about this in future contributions. Thanks for the reminder! Let me add a test for it :)
--
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: always create GitHook even when `repo_url` is provided [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #52897:
URL: https://github.com/apache/airflow/pull/52897#issuecomment-3067289700
Can you please add tests for it ? It seems super-suspicious to see tests passing both before and after the change - which basically means that it's not tested.
--
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: always create GitHook even when `repo_url` is provided [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #52897:
URL: https://github.com/apache/airflow/pull/52897
--
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: always create GitHook even when `repo_url` is provided [airflow]
Posted by "nailo2c (via GitHub)" <gi...@apache.org>.
nailo2c commented on PR #52897:
URL: https://github.com/apache/airflow/pull/52897#issuecomment-3070379767
Done, this test fails on the main branch but passes with this PR. The test supplies a `repo_url` when constructing `GitDagBundle`. On main branch, the presence of `repo_url` prevents `GitHook` from being instantiated, reproducing the original bug.
--
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: always create GitHook even when `repo_url` is provided [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #52897:
URL: https://github.com/apache/airflow/pull/52897#issuecomment-3088639869
> You're right, I should add a test for it, even though it's a small logic change. I'll be more mindful about this in future contributions. Thanks for the reminder! Let me add a test for it :)
Thanks - yeah. No matter how small logic - we should test it :)
--
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