You've already forked helm-gitea
fix: broken pipe in change-password help probe (#1052)
### Description of the change This change fixes an intermittent failure in the init password-reset flow caused by the CLI feature probe used to detect `--must-change-password` support. The current probe uses: `gitea admin user change-password --help | grep -qF -- '--must-change-password'` Because `grep -q` exits immediately after the first match, it can close the pipe while gitea is still writing help output. In that case, gitea may return broken pipe. This is timing-dependent, so it only reproduces sometimes with the same binary. This PR replaces that check with a form that consumes the full output before exiting, avoiding premature pipe closure. ### Benefits - Prevents intermittent broken pipe failures during init - Makes password-reset capability detection deterministic ### Applicable issues - Fixes #1051 ### Additional information No test update was required for this change. The fix only adjusts the shell pipeline used in the rendered init script to avoid an intermittent broken pipe during the `--must-change-password` capability check. There are currently no existing Helm or bash unit tests covering this specific command path in the chart, and this change does not alter chart values, rendered resource structure, or template interfaces. ### Checklist - [x] Bash unittests are added (required when changing anything in `scripts` folder) Reviewed-on: https://gitea.com/gitea/helm-gitea/pulls/1052 Co-authored-by: alexandru-marianlita <alexandru-marian.lita@spirent.com> Co-committed-by: alexandru-marianlita <alexandru-marian.lita@spirent.com>
This commit is contained in:
committed by
Markus Pesch
parent
4036f02c19
commit
e8dff81392
@@ -123,7 +123,7 @@ stringData:
|
|||||||
# should add it to prevent requiring frequent admin password resets.
|
# should add it to prevent requiring frequent admin password resets.
|
||||||
local -a change_args
|
local -a change_args
|
||||||
change_args=(--username "${GITEA_ADMIN_USERNAME}" --password "${GITEA_ADMIN_PASSWORD}")
|
change_args=(--username "${GITEA_ADMIN_USERNAME}" --password "${GITEA_ADMIN_PASSWORD}")
|
||||||
if gitea admin user change-password --help | grep -qF -- '--must-change-password'; then
|
if gitea admin user change-password --help | grep -F -- '--must-change-password' >/dev/null; then
|
||||||
change_args+=(--must-change-password=false)
|
change_args+=(--must-change-password=false)
|
||||||
fi
|
fi
|
||||||
gitea admin user change-password "${change_args[@]}"
|
gitea admin user change-password "${change_args[@]}"
|
||||||
|
|||||||
Reference in New Issue
Block a user