ChickenBenny opened a new pull request, #77631:
URL: https://github.com/apache/airflow/pull/77631

   * related: #51370
   
   ---
   
   With `AIRFLOW__LOGGING__LOGGING_LEVEL=DEBUG`, the `airflow-init` service of 
the docker-compose quick start does not create the admin user, so logging in 
with `airflow` / `airflow` fails. The log says `Skipping user creation as auth 
manager different from Fab is used`, even though `FabAuthManager` is configured.
   
   The entrypoint checks the auth manager with:
   
   ```bash
   if airflow config get-value core auth_manager | grep -q "FabAuthManager"; 
then
   ```
   
   At DEBUG level, Airflow logs to stdout as well, so the command prints about 
130 lines. The value is followed by one more log line, written when the DB 
connection pool is disposed at exit. `grep -q` exits at the match and closes 
the pipe, so that last write fails with `BrokenPipeError` and the command exits 
with 120. The entrypoint runs under `set -euo pipefail`, so the pipeline fails 
although `grep` matched, and the `else` branch skips the user.
   
   `grep` without `-q` reads the whole output, so the command can finish 
writing. Forcing `INFO` for this one command would also work, but only while 
nothing else writes to stdout after the value; reading the whole output keeps 
working whatever the command logs. The same check in `entrypoint_ci.sh`, which 
`breeze start-airflow` uses, runs under `pipefail` too and gets the same fix. 
`Dockerfile` and `Dockerfile.ci` are regenerated by the 
`update-inlined-dockerfile-scripts` hook.
   
   ### Validation
   
   Ran the check in Breeze with `set -euo pipefail` and `FabAuthManager`:
   
   | `logging_level` | Lines on stdout | `grep -q` (before) | `grep ... 
>/dev/null` (after) |
   |---|---|---|---|
   | `INFO` | 1 | user created | user created |
   | `DEBUG` | about 130 | **skipped**, `PIPESTATUS=120` | user created |
   
   - The changed lines in both entrypoints, run as they are in the files, 
create the user at DEBUG level.
   - With `SimpleAuthManager` at DEBUG level, no output line contains 
`FabAuthManager`, so the check still skips the user.
   - `prek run` on the changed files passed, including 
`update-inlined-dockerfile-scripts`, shellcheck and hadolint.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5.5)
   
   Generated-by: Claude Code (Opus 5.5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


-- 
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]

  • [PR] Fix admin user creation ... ChickenBenny (via GitHub) via commits

Reply via email to