Skip to content

Repo URLs provided in the git bundle config prevent git hooks executing #52332

Open
@ianbuss

Description

@ianbuss

Apache Airflow version

3.0.2

If "Other Airflow 2 version" selected, which one?

No response

What happened?

If the repo_url is provided in the kwargs of the GitDagBundle config, a GitHook is never created due to this if condition:

.

This means authentication (key file or private key) and environment configuration does not happen on clone repo commands (see

env=self.hook.env if self.hook else None,
for example where hook is None).

A simple workaround is to not provide repo_url in the config and use host in the connection definition but the git bundle should cope with both scenarios.

What you think should happen instead?

The GitDagBundle should configure the GitHook even if the repo_url is provided in the bundle config.

How to reproduce

Create a private git repository, and configure the git bundle config list something like the following:

[{"name": "dags-folder", "classpath": "airflow.providers.git.bundles.git.GitDagBundle", "kwargs": {"repo_url": "git@github.com:myorg/my-repo.git"    , "tracking_ref": "main", "subdir": "dags"}}]

In addition configure a git connection; it could be like:

{"conn_type":"git","extra":{"private_key": "-----BEGIN OPENSSH PRIVATE KEY-----\nb3...REDACTED...lu\n-----END OPENSSH PRIVATE KEY-----\n", "strict_host_key_checking": "no"},"host":"git@github.com:myorg/my-repo.git"}

Operating System

Debian GNU/Linux

Versions of Apache Airflow Providers

apache_airflow_providers_git-0.0.2

Deployment

Astronomer

Deployment details

No response

Anything else?

Every time if repo_url is configured.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions