GitHub user mkzung added a comment to the discussion: DAG version id

Not with the git-sync sidecar: it only fills the DAGs folder, and the default 
`dags-folder` bundle has [`supports_versioning = 
False`](https://github.com/apache/airflow/blob/7fbcfeea2728160e60849ebebd51081b477e1a8e/airflow-core/src/airflow/dag_processing/bundles/local.py#L33-L43),
 so every version gets `bundle_version = null`. The id you see is just the 
`dag_version` row's UUID.

To get the commit, let Airflow pull the repo with `GitDagBundle` (from 
`apache-airflow-providers-git`, with a git connection). Chart 1.18.0 has no 
value for it, so set the config directly:

```yaml
config:
  dag_processor:
    dag_bundle_config_list: '[{"name": "dags", "classpath": 
"airflow.providers.git.bundles.git.GitDagBundle", "kwargs": {"git_conn_id": 
"my_git", "tracking_ref": "main", "subdir": "dags", "refresh_interval": 60}}]'
```

Then `GET /api/v2/dags/{dag_id}/dagVersions` returns the commit SHA as 
`bundle_version`, plus a `bundle_url`. Checked on Airflow 3.3.2. On git-sync, 
the best you can do is match `created_at` against the git log.


GitHub link: 
https://github.com/apache/airflow/discussions/62590#discussioncomment-19102427

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to