feat(deploy): stream live build logs in build progress modal

Show real-time kaniko/init-container build output inside the build
progress modal during the building/deploying phases, alongside the
existing percentage. The build-logs endpoint now returns live pod logs
while a build is in progress (falling back to the persisted log once
finished), and the modal polls it every 2s with auto-scroll. Minimize
behaviour is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
keyhan
2026-06-16 01:50:14 +03:30
parent e53fc8e2ff
commit 6022739b80
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,