Merge branch 'feat/live-build-logs-modal'

This commit is contained in:
keyhan
2026-06-16 02:08:03 +03:30
5 changed files with 80 additions and 3 deletions
+18
View File
@@ -1727,6 +1727,24 @@ CMD ["sh", "-c", "DLL=$(find . -maxdepth 1 -name '*.dll' ! -name '*.deps.dll' !
throw new Error(`Build job ${jobName} timed out after ${timeoutSeconds}s\nLogs:\n${logs}`);
}
/**
* Live build logs for an in-progress build, read straight from the running
* build pod (init + kaniko containers). Returns null when there is no active
* build session for this deployment (e.g. build already finished/cleaned up),
* so callers can fall back to the persisted build log.
*/
async getLiveBuildLog(deploymentId: string): Promise<string | null> {
const session = this.activeBuilds.get(deploymentId);
if (!session?.coreApi || !session.namespace || !session.buildPodName) {
return null;
}
try {
return await this.getBuildLogs(session.coreApi, session.buildPodName, session.namespace);
} catch {
return null;
}
}
private async getBuildLogs(coreApi: k8s.CoreV1Api, jobName: string, namespace: string): Promise<string> {
try {
const pods = await coreApi.listNamespacedPod({
+12 -1
View File
@@ -507,8 +507,19 @@ export class DeploymentsService {
};
}
// While the build is in progress the persisted buildLog isn't written yet —
// stream the live build pod logs so the deploy modal can show them in real time.
let buildLog = latest.buildLog || null;
if (
latest.status === DeploymentStatus.BUILDING ||
latest.status === DeploymentStatus.DEPLOYING
) {
const live = await this.buildService.getLiveBuildLog(latest.id);
if (live) buildLog = live;
}
return {
buildLog: latest.buildLog || null,
buildLog,
status: latest.status,
version: latest.version,
createdAt: latest.createdAt,