Apache Airflow / Advanced: historical processing, deployment and recovery evidence / Lesson 21
DAG bundles and run-version evidence
Review bundle versioning and deployment evidence for a DAG run spanning a code update.
On this page
Lesson goals
- Explain the purpose and limits of versioned DAG bundles.
- Verify code and dependency identity for a run across a deployment.
Identify the bundle boundary
A DAG bundle can include DAG files and associated resources from a configured source. Version-capable bundles can allow a run to use a specific bundle version across its tasks even when the source changes. Record the bundle name, implementation, version and deployment revision with the run. Bundle versioning does not automatically pin external packages, connections, secrets or source data.
Record the first task
The first synthetic record associates the extract task of run-17 with revision-a in a version-capable bundle. It is an evidence fixture, not an Airflow API response or a configured bundle. A real investigation should obtain the actual version and task evidence from the deployed system and retain the source revision securely. Confirm that the referenced files remain available to the task execution environment.
{"dag_run":"run-17","bundle":"parcel-jobs","bundle_version":"revision-a","task":"extract"}
The record names one run and bundle version without connecting to Airflow.
Compare a later task
The second fixture shows publish in the same run using revision-a, even if a later source revision exists. This is an expected version-consistent scenario, not proof of actual runtime behavior. Compare the real task and bundle records with the configured implementation. The Airflow 3.1 documentation notes that local and the described S3 bundles do not support bundle versioning, so their tasks use the latest code.
{"dag_run":"run-17","bundle":"parcel-jobs","bundle_version":"revision-a","task":"publish"}
Both fixture records name revision-a; a real deployment requires its own evidence.
Inspect dependencies beyond the bundle
A consistent file revision can still execute differently if a provider package, connection target or external data changes. Capture the worker image and dependency versions, selected connection identity and input interval without logging secrets. Check that the versioned bundle remains accessible for all relevant tasks and retries. Treat code version, runtime environment and business input as distinct parts of reproducibility.
Test a run across an update
In a disposable deployment with a version-capable bundle, begin a synthetic run, update the bundle source and observe the version used by a later task and retry. Compare this with the implementation’s documented behavior and independently inspect its package environment. Also test the selected nonversioned bundle behavior if it is used. Do not update a production bundle merely to demonstrate versioning.
Common errors and fixes
A local bundle is assumed to pin code for an entire run.
- Why it happens
- All bundle implementations were assumed to support versioning.
- How to fix it
- Inspect the actual bundle type and its documented behavior.
- Prevent it next time
- Test a run spanning a code update.
A pinned bundle is treated as a complete reproducible environment.
- Why it happens
- Packages, connections and input versions were omitted.
- How to fix it
- Record and compare those dependencies separately.
- Prevent it next time
- Version the full execution contract.
An old task cannot access its required bundle revision.
- Why it happens
- Availability and permissions were not tested.
- How to fix it
- Restore access using the approved deployment process.
- Prevent it next time
- Rehearse task retries across a bundle update.
2 practice exercises
1. Both fixtures show revision-a. What do they prove about a real deployment?
Show worked solution
Only the intended relationship in the synthetic example. A real conclusion requires the actual bundle implementation, run and task evidence, and confirmation that the referenced files were available.
2. Does a versioned bundle guarantee that a connection points to the same database throughout a run?
Show worked solution
No. Connections and their external targets are separate from the bundle files. Record the approved connection identity and verify the runtime target without exposing credentials.
Key takeaways
- Verify whether the selected bundle implementation supports versioning.
- Record runtime dependencies and inputs alongside bundle version evidence.