Fix kubernetes cleanup to retry delete

pull/310/head
Frostebite 2022-01-30 16:00:03 +00:00
parent ad0dfc7b72
commit 3f4d4bf331
3 changed files with 7 additions and 3 deletions

4
dist/index.js vendored
View File

@ -1943,6 +1943,7 @@ class Kubernetes {
});
}
runTask(buildGuid, image, commands, mountdir, workingdir, environment, secrets) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
try {
// setup
@ -1954,7 +1955,8 @@ class Kubernetes {
const jobSpec = kubernetes_job_spec_factory_1.default.getJobSpec(commands, image, mountdir, workingdir, environment, secrets, this.buildGuid, this.buildParameters, this.secretName, this.pvcName, this.jobName, k8s);
//run
cloud_runner_logger_1.default.log('Creating build job');
yield this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec);
this.jobName =
((_a = (yield this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec)).body.metadata) === null || _a === void 0 ? void 0 : _a.name) || this.jobName;
yield new Promise((promise) => setTimeout(promise, 5000));
cloud_runner_logger_1.default.log('Job created');
this.setPodNameAndContainerName(yield Kubernetes.findPodFromJob(this.kubeClient, this.jobName, this.namespace));

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -96,7 +96,9 @@ class Kubernetes implements CloudRunnerProviderInterface {
//run
CloudRunnerLogger.log('Creating build job');
await this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec);
this.jobName =
(await this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec)).body.metadata?.name || this.jobName;
await new Promise((promise) => setTimeout(promise, 5000));
CloudRunnerLogger.log('Job created');
this.setPodNameAndContainerName(await Kubernetes.findPodFromJob(this.kubeClient, this.jobName, this.namespace));