kobin23 opened a new issue, #77195:
URL: https://github.com/apache/airflow/issues/77195
### Category
Airflow Core — Docker image log-cleanup script.
### Versions and deployment
- Apache Airflow: 3.2.2.
- Official Apache Airflow Helm chart: 1.22.0.
- Kubernetes deployment with log-groomer sidecars enabled.
- The same empty-directory cleanup command is present on `main` at commit
`5a846fd1a8e29dc09ba3ef50c6fab1072a609451`.
### What happened?
After enabling the log-groomer sidecars, cleanup emits errors when the logs
volume root is empty:
```text
find: cannot delete '/opt/airflow/logs': Operation not permitted
find: cannot delete '/opt/airflow/logs': Device or resource busy
```
The final cleanup command in `scripts/docker/clean-logs.sh` is:
```bash
find "${DIRECTORY}"/logs -type d -empty -delete || true
```
`find` includes the starting directory in its deletion candidates. Once the
logs root is empty, the script attempts to remove the mount point itself. When
the logs root is an ordinary directory rather than a mount point, this command
can remove it successfully instead.
### How to reproduce
1. Deploy Airflow with the official Helm chart and enable a log-groomer
sidecar, for example `scheduler.logGroomerSidecar.enabled: true`.
2. Leave the mounted `/opt/airflow/logs` directory empty, or let cleanup
remove its last log files and empty subdirectories.
3. Observe the next directory-cleanup pass attempting to delete
`/opt/airflow/logs` itself.
### Expected behavior and proposed fix
Preserve the logs root while continuing to remove empty directories below it:
```bash
find "${DIRECTORY}"/logs -mindepth 1 -type d -empty -delete || true
```
This keeps existing log retention and cleanup of empty subdirectories. A
linked pull request will include the fix, the regenerated Dockerfile copy, and
a regression test covering both an initially empty root and empty nested
subdirectories.
### 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).
---
Drafted-by: Codex (GPT-6); reviewed by @kobin23 before posting
--
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]