feat: 게임 정보에 빌드 커밋 표시
프로필 배포가 고정한 전체 커밋 SHA를 프론트 빌드와 Turbo 캐시 입력에 전달한다. 게임 정보 대화상자와 데스크톱·모바일 Chromium 검증을 함께 보강한다.
This commit is contained in:
@@ -538,9 +538,13 @@ const buildProfileFrontendOutDir = (workspaceRoot: string, profileName: string):
|
||||
export const buildProfileFrontendCommands = (
|
||||
workspaceRoot: string,
|
||||
profile: Pick<GatewayProfileRecord, 'profileName' | 'profile' | 'apiPort'>,
|
||||
buildCommitSha: string,
|
||||
env?: Record<string, string>,
|
||||
cacheAnchorRoot: string = workspaceRoot
|
||||
): BuildCommand[] => {
|
||||
if (!/^[0-9a-f]{40,64}$/iu.test(buildCommitSha.trim())) {
|
||||
throw new Error('Profile frontend build requires a full commit SHA.');
|
||||
}
|
||||
const profileFrontendBuildNodeOptions = env?.PROFILE_FRONTEND_BUILD_NODE_OPTIONS?.trim();
|
||||
const buildEnv = {
|
||||
...(env ?? {}),
|
||||
@@ -548,6 +552,7 @@ export const buildProfileFrontendCommands = (
|
||||
VITE_APP_BASE_PATH: `/${profile.profile}`,
|
||||
VITE_GAME_API_URL: `/${profile.profile}/api/trpc`,
|
||||
VITE_GAME_SSE_URL: `/${profile.profile}/api/events`,
|
||||
VITE_BUILD_COMMIT_SHA: buildCommitSha.trim().toLowerCase(),
|
||||
};
|
||||
return [
|
||||
buildTurboReleaseTaskCommand(
|
||||
@@ -1475,6 +1480,7 @@ export class GatewayOrchestrator implements GatewayOrchestratorHandle {
|
||||
...buildProfileFrontendCommands(
|
||||
workspace.root,
|
||||
profile,
|
||||
commitSha,
|
||||
this.processConfig.baseEnv,
|
||||
this.processConfig.workspaceRoot
|
||||
),
|
||||
@@ -2056,6 +2062,7 @@ export class GatewayOrchestrator implements GatewayOrchestratorHandle {
|
||||
? buildProfileFrontendCommands(
|
||||
workspace.root,
|
||||
profile,
|
||||
commitSha,
|
||||
this.processConfig.baseEnv,
|
||||
this.processConfig.workspaceRoot
|
||||
)
|
||||
|
||||
@@ -347,9 +347,11 @@ describe('buildWorkspaceCommands', () => {
|
||||
});
|
||||
|
||||
describe('buildProfileFrontendCommands', () => {
|
||||
const buildCommitSha = '0123456789abcdef0123456789abcdef01234567';
|
||||
|
||||
it('uses a profile frontend build-only Node heap without changing the shared runtime heap', () => {
|
||||
const workspaceRoot = '/srv/sammo/worktrees/0123456789abcdef';
|
||||
const commands = buildProfileFrontendCommands(workspaceRoot, buildProfile(), {
|
||||
const commands = buildProfileFrontendCommands(workspaceRoot, buildProfile(), buildCommitSha, {
|
||||
NODE_OPTIONS: '--max-old-space-size=1536',
|
||||
PROFILE_FRONTEND_BUILD_NODE_OPTIONS: '--max-old-space-size=2048',
|
||||
});
|
||||
@@ -361,6 +363,7 @@ describe('buildProfileFrontendCommands', () => {
|
||||
(command) => command.env?.PROFILE_FRONTEND_BUILD_NODE_OPTIONS === '--max-old-space-size=2048'
|
||||
)
|
||||
).toBe(true);
|
||||
expect(commands.every((command) => command.env?.VITE_BUILD_COMMIT_SHA === buildCommitSha)).toBe(true);
|
||||
expect(commands[0]?.args).toEqual([
|
||||
'exec',
|
||||
'turbo',
|
||||
@@ -377,10 +380,16 @@ describe('buildProfileFrontendCommands', () => {
|
||||
|
||||
it('keeps the shared Node heap when no frontend build override is configured', () => {
|
||||
const workspaceRoot = '/srv/sammo/worktrees/0123456789abcdef';
|
||||
const commands = buildProfileFrontendCommands(workspaceRoot, buildProfile(), {
|
||||
const commands = buildProfileFrontendCommands(workspaceRoot, buildProfile(), buildCommitSha, {
|
||||
NODE_OPTIONS: '--max-old-space-size=1536',
|
||||
});
|
||||
|
||||
expect(commands.every((command) => command.env?.NODE_OPTIONS === '--max-old-space-size=1536')).toBe(true);
|
||||
});
|
||||
|
||||
it('rejects a non-commit build version before creating cached frontend commands', () => {
|
||||
expect(() => buildProfileFrontendCommands('/srv/sammo/worktrees/main', buildProfile(), 'main')).toThrow(
|
||||
'Profile frontend build requires a full commit SHA.'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -194,6 +194,8 @@ describe('profile DEPLOY operation', () => {
|
||||
'tools/build-scripts/materialize-profile-frontend.mjs',
|
||||
'che:1010',
|
||||
]);
|
||||
expect(commandGroups[0]?.[2]?.env?.VITE_BUILD_COMMIT_SHA).toBe(SHA);
|
||||
expect(commandGroups[0]?.[3]?.env?.VITE_BUILD_COMMIT_SHA).toBe(SHA);
|
||||
expect(commandGroups[1]?.map((command) => command.args)).toEqual([
|
||||
['--filter', '@sammo-ts/infra', 'prisma:migrate:deploy:game'],
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user