From 0f0139773a03af56e3b4620704b2ab6114aa0702 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 | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 439e104..9ad76be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -116,7 +116,7 @@ RUN set -xe; \ /home/wodby/.ssh; \ \ { \ - echo 'export PS1="\u@${WODBY_APP_NAME:-ruby}.${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 9f44df2..72f12a9 100755 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -6,9 +6,16 @@ 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 + ruby -v | grep -q "${RUBY_VERSION}" ssh sshd cat /home/wodby/.ssh/authorized_keys | grep -q admin@example.com curl -s nginx | grep -q "Rails version:" -curl -s localhost:8080 | grep -q "Rails version:" \ No newline at end of file +curl -s localhost:8080 | grep -q "Rails version:"