MILTON.GitOperations
This worker service is responsible for asynchronously cloning Git repositories and uploading their contents to object storage (S3). This isolates heavy I/O operations from the main API and ensures high throughput for repository analysis.
Overview
In the MILTON ecosystem, MILTON.GitOperations acts as a specialized backend worker. Its primary business logic intent is to synchronize external source code into the internal platform storage (S3) so that downstream services (like Python clustering and document generation) can operate purely on internal, reliable infrastructure.
The core flow is message-driven:
- The API publishes a
CloneRepositoriesCommandvia Wolverine. - The GitOperations worker receives the message.
- It performs basic Git
Cloneoperations usingLibGit2Sharpto a local fast-access volume ({baseReposPath}/{tenantId}/{projectId}/{repoName}). - It then immediately syncs the local clone into the
IRepoFileStore(S3). - Downstream consumers read source context from S3 (the claim-check store) rather than maintaining Git dependencies themselves.
Architecture Details
This module follows Clean Architecture principles, isolating the Wolverine integration and business logic (Application) from the Git and S3 operations (Infrastructure).
Cloning Sequence
sequenceDiagram participant API as MILTON.API participant MQ as RabbitMQ participant Worker as MILTON.GitOperations (CloneRepositoriesHandler) participant FS as Local File System (GitCloneService) participant Git as External Git Repo participant S3 as S3 Claim-Check Store (IRepoFileStore) API->>MQ: Publish CloneRepositoriesCommand Note over API,MQ: Uses [MessageIdentity("clone-repositories")] MQ->>Worker: Consume CloneRepositoriesCommand Worker->>FS: Clean existing local path Worker->>Git: LibGit2Sharp Clone (w/ OAuth2 token if present) Git-->>FS: Download files to local volume Worker->>S3: UploadRepositoryAsync (Applying File Exclusions) S3-->>Worker: Upload Complete Worker-->>Worker: Map Success/Failure into GitCloneResult Note over Worker: Aggregates results for all repos