feat(git-gate): include hostname in deploy key title
Closes #388 (part 1 of 3). Deploy key titles now carry the machine hostname so keys provisioned on different hosts don't collide with each other on the forge when a prior bottle was never torn down. Title format: bot-bottle:<hostname>:<slug>:<repo-name>
This commit is contained in:
@@ -6,6 +6,7 @@ Covers the pure `git_gate_render_gitconfig` renderer and the dynamic
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import socket
|
||||
import tempfile
|
||||
import types
|
||||
import unittest
|
||||
@@ -113,8 +114,9 @@ class TestProvisionDynamicKey(unittest.TestCase):
|
||||
self.assertEqual(b"PRIVATE-KEY-BYTES", key_file.read_bytes())
|
||||
id_file = Path(d) / "repo-deploy-key-id"
|
||||
self.assertEqual("kid123", id_file.read_text())
|
||||
# owner_repo had .git stripped; title carries slug + name
|
||||
self.assertEqual([("o/r", "bot-bottle:myslug:repo")], fake.created)
|
||||
# owner_repo had .git stripped; title carries hostname + slug + name
|
||||
hostname = socket.gethostname()
|
||||
self.assertEqual([("o/r", f"bot-bottle:{hostname}:myslug:repo")], fake.created)
|
||||
|
||||
def test_missing_token_raises(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as d, \
|
||||
|
||||
Reference in New Issue
Block a user