shahar1 opened a new pull request, #77378: URL: https://github.com/apache/airflow/pull/77378
<!-- HUMAN SUMMARY - AGENTS DO NOT MODIFY --> <!-- END OF HUMAN SUMMARY --> <details><summary>AI Summary</summary> An agent that works in a sandboxed session reaches Docker through the [Apache Magpie container gateway](https://github.com/apache/magpie/tree/main/tools/container-gateway). Our contributor instructions tell agents to run everything through `breeze`, but `breeze` could not start a container there: the gateway refuses, by design, several things that every `breeze` start asked for. Breeze now detects the gateway from `DOCKER_HOST` (a socket under `.apache-magpie-local/`) and leaves out what the gateway refuses. `BREEZE_RESTRICTED_DOCKER=true|false` overrides the detection. Nothing changes for a normal Docker daemon. | Refused by the gateway | What Breeze does in restricted mode | |---|---| | `cap_add: SYS_PTRACE` and the `/dev/urandom:/dev/random` bind | moved from `base.yml` to a new `host-access.yml`, which is left out | | the Docker socket bind | left out, so Docker cannot be used from inside the container | | the main `.git` directory of a worktree (outside the checkout) | left out, in the compose file and in the ownership fix, so `git` does not work inside the container in a worktree | | the shared `mypy` and `__pycache__` volumes (one name for all checkouts) | left out | | a writable bind of `.github` (it can hold agent hooks) | mounted read-only through a new `restricted-docker.yml` | One more defect showed up once containers started: `run_fix_ownership.py` called `chown` on every directory, and stopped with `OSError: [Errno 30] Read-only file system` on the directories that the gateway mounts read-only. It now changes only directories owned by root, as it already did for files. **Limitations** - Building the CI image still does not work through the gateway, which refuses BuildKit sessions. The image must be built from a terminal that reaches the daemon directly. - The detection needs a gateway that answers `404` to a refused inspect (apache/magpie#2078). With an older gateway `breeze` still tries to rebuild the image. **How it was checked** Through a gateway serving this worktree (Docker 29.9.3, WSL2): - `breeze run pytest providers/cncf/kubernetes/tests/unit`: 1583 passed, 19 skipped. - `breeze shell "echo SHELL_OK"` and `breeze shell --mount-sources all ...`: both start, and the ownership fix finishes without a traceback. - Before the change the same commands stopped at `container-gateway: cap-add: added capabilities are refused`. On the host: - `uv run --project dev/breeze pytest dev/breeze/tests`: 2922 passed, 3 failed. The 3 failures are in `test_publish_docs_to_s3.py` (`FileNotFoundError: .build/.suppress_colour`), a file this change does not touch. - `uv run --project scripts pytest scripts/tests`: 2136 passed, 2 skipped. - `prek run` for the `pre-commit` and `manual` stages: passed. Not run locally: the rest of what `breeze verify` lists for a change to CI tooling (UI, SDK, agent-framework and docs jobs), and a run against a normal Docker daemon. An adversarial review by another model reported two findings; both were checked against a live gateway and did not reproduce. </details> --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Code (Fable 5.2) Generated-by: Claude Code (Fable 5.2) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) --- * Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged. * For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed. * When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x). * For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number. -- 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]
