perf: add timing logs and faster polling for build jobs
Added detailed timing logs for build pipeline stages (secret creation, job submission, job completion). Reduced polling interval from 5s to 3s.
This commit is contained in:
@@ -88,8 +88,9 @@ export class BuildService {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const tSecret = Date.now();
|
||||||
await coreApi.createNamespacedSecret(buildNamespace!, sourceSecret);
|
await coreApi.createNamespacedSecret(buildNamespace!, sourceSecret);
|
||||||
this.logger.log(`Created source secret: ${sourceConfigMapName} (${(zipBuffer.length / 1024).toFixed(1)} KB)`);
|
this.logger.log(`[timing] Source secret created in ${Date.now() - tSecret}ms (${(zipBuffer.length / 1024).toFixed(1)} KB)`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the Kaniko Job spec
|
// Build the Kaniko Job spec
|
||||||
@@ -247,8 +248,13 @@ export class BuildService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const t0 = Date.now();
|
||||||
await coreApi.createNamespacedConfigMap(buildNamespace!, dockerfileConfigMap);
|
await coreApi.createNamespacedConfigMap(buildNamespace!, dockerfileConfigMap);
|
||||||
|
this.logger.log(`[timing] ConfigMap created in ${Date.now() - t0}ms`);
|
||||||
|
|
||||||
|
const t1 = Date.now();
|
||||||
await batchApi.createNamespacedJob(buildNamespace!, buildJob);
|
await batchApi.createNamespacedJob(buildNamespace!, buildJob);
|
||||||
|
this.logger.log(`[timing] Job created in ${Date.now() - t1}ms`);
|
||||||
|
|
||||||
// Wait for build to complete
|
// Wait for build to complete
|
||||||
await this.waitForJobCompletion(batchApi, coreApi, buildPodName, buildNamespace!, 600);
|
await this.waitForJobCompletion(batchApi, coreApi, buildPodName, buildNamespace!, 600);
|
||||||
@@ -402,8 +408,8 @@ CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
|
|||||||
throw new Error(`Build job ${jobName} failed.\nLogs:\n${logs}`);
|
throw new Error(`Build job ${jobName} failed.\nLogs:\n${logs}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait 5 seconds before polling again
|
// Wait 3 seconds before polling again
|
||||||
await new Promise((resolve) => setTimeout(resolve, 5000));
|
await new Promise((resolve) => setTimeout(resolve, 3000));
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(`Build job ${jobName} timed out after ${timeoutSeconds}s`);
|
throw new Error(`Build job ${jobName} timed out after ${timeoutSeconds}s`);
|
||||||
|
|||||||
Reference in New Issue
Block a user