DevOps Learner Traces 2-Hour Bash Bug to a Missing Dollar Sign
A developer building a self-hosted Git-push-to-deploy pipeline encountered a silent bug that caused every second redeployment to fail with a Docker container name conflict. The stop and remove commands appeared to run without errors, yet the old container persisted, because two lines in the Bash hook referenced the literal text APP_NAME instead of the variable's value $APP_NAME. Adding set -x to the script revealed the discrepancy by printing each command with variables already expanded, making the misconfiguration immediately visible. The root cause was inconsistent quoting — a common Bash pitfall where omitting the dollar sign causes the shell to treat the string as plain text rather than substituting the variable. Correcting those two lines to use "$APP_NAME" resolved the conflict entirely, highlighting how silent failures in automation scripts can be harder to diagnose than outright crashes.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in