mirror of
https://github.com/suitenumerique/docs.git
synced 2026-09-23 01:55:07 +02:00
🐛(helm) show the database error while jobs wait for it to be ready
The migrate and createsuperuser jobs polled `manage.py check` with its output sent to /dev/null, then printed "Database not ready" whatever the reason. Any failure the check reports, a missing setting or a bad credential for instance, looked like a database that had not started yet, and the job looped forever without a single clue in its logs. The check output is now captured and printed on each failed attempt, along with the attempt number, so the reason the job is still waiting is readable with kubectl logs. The retry behaviour is unchanged. Applied to both jobs in the chart values and in the dev and feature helmfile environments. The chart README table is regenerated accordingly. Signed-off-by: risk-alt <aldu6974@gmail.com>
This commit is contained in:
@@ -88,9 +88,12 @@ backend:
|
||||
- "/bin/sh"
|
||||
- "-c"
|
||||
- |
|
||||
while ! python manage.py check --database default > /dev/null 2>&1
|
||||
attempt=0
|
||||
until output=$(python manage.py check --database default 2>&1)
|
||||
do
|
||||
echo "Database not ready"
|
||||
attempt=$((attempt + 1))
|
||||
echo "Database check failed (attempt $attempt), retrying in 2s:"
|
||||
echo "$output"
|
||||
sleep 2
|
||||
done
|
||||
|
||||
@@ -113,9 +116,12 @@ backend:
|
||||
- "/bin/sh"
|
||||
- "-c"
|
||||
- |
|
||||
while ! python manage.py check --database default > /dev/null 2>&1
|
||||
attempt=0
|
||||
until output=$(python manage.py check --database default 2>&1)
|
||||
do
|
||||
echo "Database not ready"
|
||||
attempt=$((attempt + 1))
|
||||
echo "Database check failed (attempt $attempt), retrying in 2s:"
|
||||
echo "$output"
|
||||
sleep 2
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user