nathadfield opened a new issue, #60880: URL: https://github.com/apache/airflow/issues/60880
### Description
Add two new parameters to `TriggerDagRunOperator` to support DAG bundle
versioning:
1. `dag_bundle_version (str | None)`: Specify an explicit bundle version to
use when triggering the target DAG
2. `use_latest_bundle_version (bool)`: Automatically use the latest bundle
version from DagModel
These parameters are mutually exclusive. The dag_bundle_version parameter is
template-enabled for dynamic version selection.
Example usage:
### Trigger with specific bundle version
```python
TriggerDagRunOperator(
task_id='trigger_v1',
trigger_dag_id='data_processing',
dag_bundle_version='2024.01.15',
)
```
### Trigger with latest bundle version
```python
TriggerDagRunOperator(
task_id='trigger_latest',
trigger_dag_id='data_processing',
use_latest_bundle_version=True,
)
```
### Dynamic version using templates
```python
TriggerDagRunOperator(
task_id='trigger_dynamic',
trigger_dag_id='data_processing',
dag_bundle_version='{{ params.release_version }}',
)
```
### Use case/motivation
DAG bundles in Airflow 3.0 enable versioning of DAG code and dependencies.
Currently, users can specify bundle versions when:
- Manually triggering DAGs via the UI (using "run on latest version")
- Rerunning failed DAG runs with a specific version
However, there's no way to programmatically specify bundle versions when
triggering DAGs via TriggerDagRunOperator. This creates a gap in the bundle
versioning workflow.
Use cases:
1. Orchestration DAGs: A controller DAG needs to trigger multiple downstream
DAGs with a specific release version to ensure consistency across a deployment
2. CI/CD pipelines: Trigger DAGs with the bundle version that matches the
current deployment tag
3. Rollback scenarios: Trigger a DAG with a previous bundle version to
reprocess data using older logic
4. Testing: Trigger the same DAG with different bundle versions to compare
behavior or validate changes
Without this feature, users must either:
- Accept whatever bundle version is currently set on the DagModel (no
control)
- Manually trigger via UI/CLI (breaks automation)
- Modify the DagModel's bundle_version before triggering (racy, affects all
triggers)
This feature brings programmatic bundle version control to operator-based
DAG triggering, matching the functionality already available in the UI.
### Related issues
_No response_
### Are you willing to submit a PR?
- [x] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
