From 934b43507c3d5a5ab7a8eb46d355511213d761d8 Mon Sep 17 00:00:00 2001 From: Chingis S Date: Fri, 4 Sep 2026 10:49:48 +0300 Subject: [PATCH] Fix shell prompt hostname Use the container runtime hostname in the shell prompt so Kubernetes hostname overrides are visible instead of reconstructing a stale app and environment label. Add a regression assertion for the generated prompt. --- Dockerfile | 2 +- tests/tests.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a512090..6a902c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -113,7 +113,7 @@ RUN set -xe; \ mv /tmp/alpine/bin/* /usr/local/bin; \ \ { \ - echo 'export PS1="\u@${WODBY_APP_NAME:-python}.${WODBY_ENVIRONMENT_NAME:-container}:\w $ "'; \ + echo 'export PS1="\u@$(hostname):\w $ "'; \ echo "export PATH=${PATH}"; \ } | tee /home/wodby/.shrc; \ \ diff --git a/tests/tests.sh b/tests/tests.sh index 2e07600..38ad994 100755 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -6,6 +6,13 @@ if [[ -n "${DEBUG}" ]]; then set -x fi +source /home/wodby/.shrc +expected_prompt='\u@'"$(hostname)"':\w $ ' +if [[ "${PS1}" != "${expected_prompt}" ]]; then + echo "Unexpected shell prompt: ${PS1}" + exit 1 +fi + if [[ "${PYTHON_VERSION}" == 2* ]]; then python -V 2>&1 | grep -q "${PYTHON_VERSION}" django_msg="It worked!"