mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-16 13:06:53 -07:00
feat(orchestrator): enterprise feature support — CLI provider, submodule profiles, caching, LFS, hooks
Add generic enterprise-grade features to the orchestrator, enabling Unity projects with complex CI/CD pipelines to adopt game-ci/unity-builder with built-in support for: - CLI provider protocol: JSON-over-stdin/stdout bridge enabling providers in any language (Go, Python, Rust, shell) via the `providerExecutable` input - Submodule profiles: YAML-based selective submodule initialization with glob patterns and variant overlays (`submoduleProfilePath`, `submoduleVariantPath`) - Local build caching: Filesystem-based Library and LFS caching for local builds without external cache actions (`localCacheEnabled`, `localCacheRoot`) - Custom LFS transfer agents: Register external transfer agents like elastic-git-storage (`lfsTransferAgent`, `lfsTransferAgentArgs`, `lfsStoragePaths`) - Git hooks support: Detect and install lefthook/husky with configurable skip lists (`gitHooksEnabled`, `gitHooksSkipList`) Also removes all `orchestrator-develop` branch references, replacing with `main`. 13 new action inputs, 13 new files, 14 new CLI provider tests, 17 submodule tests, plus cache/LFS/hooks unit tests. All 452 tests pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { OrchestratorSystem } from '../core/orchestrator-system';
|
||||
import OrchestratorLogger from '../core/orchestrator-logger';
|
||||
|
||||
export class LfsAgentService {
|
||||
/**
|
||||
* Configure a custom LFS transfer agent in a git repository.
|
||||
* Sets up the git config entries and environment variables needed for the agent.
|
||||
*/
|
||||
static async configure(
|
||||
agentPath: string,
|
||||
agentArgs: string,
|
||||
storagePaths: string[],
|
||||
repoPath: string,
|
||||
): Promise<void> {
|
||||
// Validate the agent executable exists
|
||||
if (!fs.existsSync(agentPath)) {
|
||||
OrchestratorLogger.logWarning(
|
||||
`[LfsAgent] Agent executable not found at ${agentPath}, continuing without custom LFS agent`,
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Derive agent name from executable filename (without extension)
|
||||
const agentName = path.basename(agentPath, path.extname(agentPath));
|
||||
|
||||
OrchestratorLogger.log(`[LfsAgent] Configuring custom LFS transfer agent: ${agentName}`);
|
||||
OrchestratorLogger.log(`[LfsAgent] Path: ${agentPath}`);
|
||||
OrchestratorLogger.log(`[LfsAgent] Args: ${agentArgs}`);
|
||||
|
||||
// Set git config entries for the custom transfer agent
|
||||
await OrchestratorSystem.Run(`git -C "${repoPath}" config lfs.customtransfer.${agentName}.path "${agentPath}"`);
|
||||
await OrchestratorSystem.Run(`git -C "${repoPath}" config lfs.customtransfer.${agentName}.args "${agentArgs}"`);
|
||||
await OrchestratorSystem.Run(`git -C "${repoPath}" config lfs.standalonetransferagent ${agentName}`);
|
||||
|
||||
// Set storage paths environment variable if provided
|
||||
if (storagePaths.length > 0) {
|
||||
const storagePathsValue = storagePaths.join(';');
|
||||
process.env.LFS_STORAGE_PATHS = storagePathsValue;
|
||||
OrchestratorLogger.log(`[LfsAgent] Storage paths: ${storagePathsValue}`);
|
||||
}
|
||||
|
||||
OrchestratorLogger.log(`[LfsAgent] Custom LFS transfer agent configured successfully`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate that the LFS transfer agent executable exists.
|
||||
*/
|
||||
static async validate(agentPath: string): Promise<boolean> {
|
||||
const exists = fs.existsSync(agentPath);
|
||||
if (!exists) {
|
||||
OrchestratorLogger.logWarning(`[LfsAgent] Agent executable not found: ${agentPath}`);
|
||||
}
|
||||
|
||||
return exists;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user