fix(gtea): derive STACK_NAME from domain (dots→underscores) in UPGRADE_SECRET_PREP
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing

abra does NOT write STACK_NAME to the app's .env file — it derives it at runtime
by replacing dots with underscores (e.g. gite-e1cb78.ci.commoninternet.net →
gite-e1cb78_ci_commoninternet_net). Build #691 failed with 'STACK_NAME not found'
because the env file read was looking for a key that doesn't exist.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
autonomic-bot
2026-06-15 21:56:44 +00:00
parent 6dd79eac0c
commit ad53b5a620

View File

@ -71,18 +71,9 @@ def UPGRADE_SECRET_PREP(ctx):
import base64
import subprocess
env_path = _os.path.expanduser(f"~/.abra/servers/default/{ctx.domain}.env")
stack_name = None
try:
with open(env_path) as fh:
for line in fh:
if line.startswith("STACK_NAME="):
stack_name = line.split("=", 1)[1].strip().strip('"').strip("'")
except OSError:
pass
if not stack_name:
raise RuntimeError(f"UPGRADE_SECRET_PREP: STACK_NAME not found in {env_path}")
# abra derives STACK_NAME from the domain by replacing dots with underscores
# (e.g. gite-e1cb78.ci.commoninternet.net → gite-e1cb78_ci_commoninternet_net).
stack_name = ctx.domain.replace(".", "_")
docker_secret = f"{stack_name}_lfs_jwt_secret_v1"
value = base64.urlsafe_b64encode(_os.urandom(32)).rstrip(b"=").decode()