Skip to content

Fix Breeze ownership fix-up chowning all sources under rootless Docker - #73606

Merged
potiuk merged 1 commit into
apache:mainfrom
dabla:fix/breeze-rootless-fix-ownership
Sep 23, 2026
Merged

potiuk merged 1 commit into
apache:mainfrom
dabla:fix/breeze-rootless-fix-ownership

Conversation

@dabla

@dabla dabla commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Breeze already knows how to deal with rootless Docker (ADR 15): when the container's root maps back to the host user there is nothing to fix, so scripts/in_container/run_fix_ownership.py is meant to exit early when DOCKER_IS_ROOTLESS is set.

The value never matched. fix_ownership_using_docker() formats the Python bool straight into the -e argument, so the container received DOCKER_IS_ROOTLESS=True, while the script only skips on the lowercase string true. The VERBOSE variable right above it is lowercased; this one was not. The breeze shell entry path is unaffected because ShellParams._set_var lowercases booleans.

The consequence under rootless Docker (here: Docker Engine 29 rootless on WSL2) is the opposite of the intent. Inside the container every file owned by the host user looks root-owned, so the script chowns the whole mounted checkout to the mapped uid, which lands on a subordinate uid on the host (100999 for uid 1000). Git then refuses the repository as dubiously owned, prek can no longer read the files, and a uv cache hardlinked into the checkout's .venv changes owner as well. This happens after every breeze run and therefore after every prek hook that goes through Breeze, such as check-provider-yaml-valid.

Reproduction with the unmodified script in a scratch directory, with HOST_USER_ID=1000 and a plain python:3.12-slim image:

DOCKER_IS_ROOTLESS Owner afterwards
True 100999
true 1000 (skipped with the rootless message)

Changes:

  • Lowercase the flag in fix_ownership_using_docker(), matching VERBOSE.
  • Make the in-container script compare case-insensitively so another caller cannot reintroduce the mismatch.
  • Add a Breeze unit test asserting the rendered -e argument for both rootless states. It fails on the previous code.

Checks executed: the new test in dev/breeze/tests/test_docker_command_utils.py (2 passed, both fail without the fix), the reproduction above against the patched script (True, true and false now behave as intended), and prek run --files on the three changed files (all hooks passed, including mypy).


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Code (Fable 5.1) following the guidelines


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.

Breeze skips the ownership fix-up when Docker runs in rootless mode, because
container root already maps to the host user. The flag however reached the
in-container script as the Python literal "True" while the script only skips
on lowercase "true", so the skip never applied: every file that looked
root-owned inside the container (all of the host user's files) was chowned
to the mapped user id and ended up owned by a subordinate uid on the host,
leaving the checkout unusable after each `breeze run` or hook that uses it.
@dabla
dabla force-pushed the fix/breeze-rootless-fix-ownership branch from 9d54b70 to 3161ede Compare September 23, 2026 12:23
@Eason09053360

Copy link
Copy Markdown
Contributor

Thanks for the patch! LGTM.
I checked that the test catches the bug: after reverting only the Breeze-side .lower(), both new cases fail when I run the whole test_docker_command_utils.py.

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoa!

@potiuk
potiuk merged commit ababf5c into apache:main Sep 23, 2026
155 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-3-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
✅ v3-3-test PR Link

potiuk pushed a commit that referenced this pull request Sep 23, 2026
…otless Docker (#73606) (#73641)

Breeze skips the ownership fix-up when Docker runs in rootless mode, because
container root already maps to the host user. The flag however reached the
in-container script as the Python literal "True" while the script only skips
on lowercase "true", so the skip never applied: every file that looked
root-owned inside the container (all of the host user's files) was chowned
to the mapped user id and ended up owned by a subordinate uid on the host,
leaving the checkout unusable after each `breeze run` or hook that uses it.
(cherry picked from commit ababf5c)

Co-authored-by: David Blain <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants