气流如何使用 git sync 从 git 分支中的 dag 文件夹中提取 dag

Ser*_* Xu 7 git airflow kubernetes-helm

我的公司用于git-sync将压缩的 dag 同步到气流。我们使用气流掌舵图来部署气流。我想知道我是否可以让气流只在特定文件夹(例如dags-devgit 分支)中提取压缩的 dag ,而不是所有的压缩 dag?

这里有一些参考可能有用。

气流舵图值文件。 https://github.com/helm/charts/blob/master/stable/airflow/values.yaml

我们的 dags 代码如下所示:

dags:
      doNotPickle: true
      git:
        url: <git url>
        ref: master
        gitSync:
          enabled: true
          image:
            repository: <some repo>
            tag: 1.0.7
          refreshTime: 60
      initContainer:
        enabled: true
        image:
          repository: <some repo>
          tag: 1.0.7

Run Code Online (Sandbox Code Playgroud)

Airflow git 同步配置如下所示:

AIRFLOW__KUBERNETES__DAGS_VOLUME_SUBPATH: repo # must match AIRFLOW__KUBERNETES__GIT_SUBPATH
AIRFLOW__KUBERNETES__GIT_REPO: <git repo>
AIRFLOW__KUBERNETES__GIT_BRANCH: master
AIRFLOW__KUBERNETES__GIT_DAGS_FOLDER_MOUNT_POINT: /opt/airflow/dags
AIRFLOW__KUBERNETES__GIT_USER: <some user>
AIRFLOW__KUBERNETES__GIT_PASSWORD: <some password>
AIRFLOW__KUBERNETES__GIT_SYNC_CONTAINER_REPOSITORY: gitlab.beno.ai:4567/eng/external-images/k8s.gcr.io/git-sync
AIRFLOW__KUBERNETES__GIT_SYNC_CONTAINER_TAG: v3.1.1
Run Code Online (Sandbox Code Playgroud)

Lad*_*igo 0

.airflowignore您可以使用file定义要忽略的文件夹/文件列表

https://airflow.apache.org/docs/apache-airflow/stable/concepts.html#airflowignore