🐛(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:
risk-alt
2026-08-11 22:49:37 +02:00
parent 44c51ff7bf
commit 87e59e78fa
5 changed files with 106 additions and 87 deletions
+10 -4
View File
@@ -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
@@ -82,9 +82,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
@@ -105,9 +108,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