The GitHub Actions job "Tests" on airflow.git/fix-variable-import-list-values 
has failed.
Run started by GitHub user liamkernan (triggered by potiuk).

Head commit for run:
1b5b000cff555b7f8dc100ab6b844961f0f7750d / Liam <[email protected]>
fix: allow list/dict values in variable import for JSON and YAML files

The `load_variables()` function incorrectly rejected JSON and YAML files
where a variable value was a list with multiple items (e.g.,
`[{"foo": "bar"}, {"bar": "foo"}]`). This happened because the
duplicate-key check (`isinstance(values, list) and len(values) != 1`)
was designed for `.env` files — where the parser wraps values in lists
when a key appears multiple times — but was also applied to JSON/YAML
files where list values are legitimate variable data.

This caused a round-trip failure: `airflow variables export` could
produce a JSON file that `airflow variables import` would then refuse
to load.

The fix limits the duplicate-key check to `.env` files only, and passes
JSON/YAML values through as-is. The `LocalFilesystemBackend` serializes
non-string values to JSON strings to maintain the `str` return type
contract.

Closes #61490

Co-authored-by: Cursor <[email protected]>

Report URL: https://github.com/apache/airflow/actions/runs/21761135372

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to