feat(git-gate): include hostname in deploy key title #393
Reference in New Issue
Block a user
Delete Branch "deploy-key-hostname-in-title"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #388 (part 1 of 3).
Summary
bot-bottle:<hostname>:<slug>:<repo-name>(wasbot-bottle:<slug>:<repo-name>).socketis stdlib.No actionable findings. Reviewed the provisioning and revocation paths; deploy-key cleanup remains ID-based and is unaffected by the title change. Validation: all 1,723 unit tests passed, including 26 focused deploy-key tests.
@@ -47,3 +48,3 @@if owner_repo.endswith(".git"):owner_repo = owner_repo[:-4]title = f"bot-bottle:{slug}:{entry.Name}"title = f"bot-bottle:{socket.gethostname()}:{slug}:{entry.Name}"bigger change, but if there's still a
slugutil method that's used to generate these slugs, I think we should add hostname to that instead. Ideally we want a consistent slug reused throughout the app.@@ -47,3 +48,3 @@if owner_repo.endswith(".git"):owner_repo = owner_repo[:-4]title = f"bot-bottle:{slug}:{entry.Name}"title = f"bot-bottle:{socket.gethostname()}:{slug}:{entry.Name}"Yes — mint_slug in bot_bottle/backend/resolve_common.py is that utility. Its output flows into Docker compose project names, container instance names (bot-bottle-{slug}), network names, and state-dir paths in addition to this deploy-key title.
Adding socket.gethostname() inside mint_slug would make ALL of those identifiers host-qualified — a consistent approach but a broader blast radius than just the key title. Two things to verify before doing that:
Happy to make the change in mint_slug if that is the intended scope. If you prefer to keep the blast radius narrow, an alternative is a thin host_slug(slug) helper in resolve_common.py that only the deploy-key path calls — still centralises how we qualify slugs with hostname without touching Docker names or state dirs.
Which direction do you want?
Second objection doesn't matter (nothing published yet), but first objection is valid. Think a
host_slugmethod is useful. Explicitly state it assumes a slug returned frommint_slug. Also, theentry.Nameis a bit of a smell... that's the random characters needed for uniqueness, correct? If so, maybe should change the method toglobalize_slug, and have it prepend the hostname/append the random slug. Respond to this before doing anything.@@ -47,3 +48,3 @@if owner_repo.endswith(".git"):owner_repo = owner_repo[:-4]title = f"bot-bottle:{slug}:{entry.Name}"title = f"bot-bottle:{socket.gethostname()}:{slug}:{entry.Name}"Clarifying entry.Name: it is the user-defined key from git-gate.repos. in the manifest (e.g. "upstream" or "myrepo"), not random characters. The 5-char random suffix that prevents collisions lives inside the slug itself (from bottle_identity()). entry.Name is needed in the title because a single bottle can gate multiple repos — it disambiguates which deploy key belongs to which entry.
Given that, globalize_slug makes sense as:
And the title would become:
This keeps entry.Name as a suffix (for per-repo disambiguation within a bottle) and centralises the hostname-qualification logic in globalize_slug. Does that match your intent?
@didericis-claude cool, sounds good. Go for it.
@@ -47,3 +48,3 @@if owner_repo.endswith(".git"):owner_repo = owner_repo[:-4]title = f"bot-bottle:{slug}:{entry.Name}"title = f"bot-bottle:{globalize_slug(slug)}:{entry.Name}"Done —
c44a010. globalize_slug lives in bottle_state.py next to bottle_identity (resolve_common.py caused a circular import: git_gate_provision → resolve_common → git_gate → git_gate_provision). The title format is now bot-bottle:{host}-{slug}:{entry.Name}, using - as the separator between host and slug within the globalized portion, with : still separating the three top-level fields.Adds globalize_slug(slug) to bottle_state alongside bottle_identity. git_gate_provision now calls globalize_slug(slug) instead of inlining socket.gethostname(), so the hostname-qualification logic has a single, named home. Assumes slug is a mint_slug output. Title format changes from bot-bottle:{host}:{slug}:{name} to bot-bottle:{host}-{slug}:{name} to match the globalize_slug contract.c44a010464tobbb8913382