feat: simplify git mounts to use direct URLs instead of repo references

- Change git mount schema from repo_id to remote_url
- Remove database lookups for git mount resolution
- Clone directly from URL at instance startup
- Simplify frontend UI to text input for Git URL
- Fix route ordering in git_repositories.py to prevent 422 errors
- Update all tests to use remote_url field

Breaking change: Git mounts now use remote_url instead of repo_id
This commit is contained in:
Alex Blank
2026-05-27 11:53:25 +02:00
parent baabd1fa62
commit 89ca9f10c7
10 changed files with 176 additions and 321 deletions
@@ -102,18 +102,18 @@ class TestMergeFunctions:
"""Test basic git mount merging."""
result = _merge_git_mounts(
[],
[{"repo_id": "repo1", "source_path": ".", "target_path": "/app"}],
[{"remote_url": "https://github.com/user/repo1.git", "source_path": ".", "target_path": "/app"}],
"source",
)
assert len(result) == 1
assert result[0]["repo_id"] == "repo1"
assert result[0]["remote_url"] == "https://github.com/user/repo1.git"
assert result[0]["target_path"] == "/app"
def test_merge_git_mounts_override_same_repo_target(self) -> None:
"""Test that git mounts with same repo+target override."""
result = _merge_git_mounts(
[{"repo_id": "repo1", "source_path": ".", "target_path": "/app", "branch": "main"}],
[{"repo_id": "repo1", "source_path": "src", "target_path": "/app", "branch": "dev"}],
[{"remote_url": "https://github.com/user/repo1.git", "source_path": ".", "target_path": "/app", "branch": "main"}],
[{"remote_url": "https://github.com/user/repo1.git", "source_path": "src", "target_path": "/app", "branch": "dev"}],
"source",
)
assert len(result) == 1
@@ -123,8 +123,8 @@ class TestMergeFunctions:
def test_merge_git_mounts_different_targets(self) -> None:
"""Test that git mounts with different targets are preserved."""
result = _merge_git_mounts(
[{"repo_id": "repo1", "source_path": ".", "target_path": "/app"}],
[{"repo_id": "repo2", "source_path": ".", "target_path": "/config"}],
[{"remote_url": "https://github.com/user/repo1.git", "source_path": ".", "target_path": "/app"}],
[{"remote_url": "https://github.com/user/repo2.git", "source_path": ".", "target_path": "/config"}],
"source",
)
assert len(result) == 2
@@ -296,7 +296,7 @@ class TestResolveProfile:
env_vars={},
files={},
git_mounts=[
{"repo_id": "repo1", "source_path": ".", "target_path": "/app"},
{"remote_url": "https://github.com/user/repo1.git", "source_path": ".", "target_path": "/app"},
],
)
db_session.add(profile)
@@ -304,7 +304,7 @@ class TestResolveProfile:
result = await resolve_profile(db_session, profile.id)
assert len(result.git_mounts) == 1
assert result.git_mounts[0]["repo_id"] == "repo1"
assert result.git_mounts[0]["remote_url"] == "https://github.com/user/repo1.git"
assert result.git_mounts[0]["target_path"] == "/app"
@pytest.mark.asyncio
@@ -320,7 +320,7 @@ class TestResolveProfile:
env_vars={},
files={},
git_mounts=[
{"repo_id": "repo1", "source_path": ".", "target_path": "/app"},
{"remote_url": "https://github.com/user/repo1.git", "source_path": ".", "target_path": "/app"},
],
)
db_session.add(base)
@@ -333,7 +333,7 @@ class TestResolveProfile:
env_vars={},
files={},
git_mounts=[
{"repo_id": "repo2", "source_path": "config", "target_path": "/config"},
{"remote_url": "https://github.com/user/repo2.git", "source_path": "config", "target_path": "/config"},
],
)
db_session.add(child)