Skip to content

The git password/token for GitDagBundle when connecting to Gitlab currently needs to include the token name #50941

@GrumpyCat51

Description

@GrumpyCat51

Apache Airflow Provider(s)

git

Versions of Apache Airflow Providers

apache-airflow-providers-git==0.0.2

Apache Airflow version

3.0.1

Operating System

apache-airflow-providers-git==0.0.2

Deployment

Official Apache Airflow Helm Chart

Deployment details

Running on a local minikube instance

What happened

I setup the GitDagBundle for the dag processor to connect to my Gitlab repository as described in https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/dag-bundles.html with the git connection being defined as

  dag_processor:
    dag_bundle_config_list: '[{"name":"dag-bundle","classpath":"airflow.providers.git.bundles.git.GitDagBundle","kwargs":{"git_conn_id":"git-dags-conn","subdir":"","tracking_ref":"main"}}]'

---

airflow connections add 'git-dags-conn' \
    --conn-type git \
    --conn-login "$GITLAB_TOKEN_NAME" \
    --conn-password "$GITLAB_TOKEN_VALUE" \
    --conn-host 'https://gitlab.com/$GITLAB_USER/$GITLAB_REPO.git'

But when I do this, the dag proc errors out with an 128 error and text message indicating that the authentication failed.
After some trials, I turned out that I had to specify the connection as

airflow connections add 'git-dags-conn' \
    --conn-type git \
    --conn-login "$GITLAB_TOKEN_NAME" \
    --conn-password "$GITLAB_TOKEN_NAME:$GITLAB_TOKEN_VALUE" \
    --conn-host 'https://gitlab.com/$GITLAB_USER/$GITLAB_REPO.git'

and then the dag processor worked as expected.

What you think should happen instead

I should not have to specify the password as TOKEN_NAME:TOKEN_PWD, it should take the provided username

How to reproduce

Create a gitlab repo and a personal token, and insert the settings as decribed above.

Anything else

I did not test this against a Github repository, I can imagine that the behaviour is different there

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions