Fix kubernetes cleanup to retry delete
							parent
							
								
									85068a482d
								
							
						
					
					
						commit
						ad0dfc7b72
					
				|  | @ -1996,6 +1996,9 @@ class Kubernetes { | |||
|     cleanupTaskResources() { | ||||
|         return __awaiter(this, void 0, void 0, function* () { | ||||
|             cloud_runner_logger_1.default.log('cleaning up'); | ||||
|             try { | ||||
|                 yield async_wait_until_1.default(() => __awaiter(this, void 0, void 0, function* () { | ||||
|                     var _b; | ||||
|                     try { | ||||
|                         yield this.kubeClientBatch.deleteNamespacedJob(this.jobName, this.namespace); | ||||
|                         yield this.kubeClient.deleteNamespacedSecret(this.secretName, this.namespace); | ||||
|  | @ -2006,8 +2009,9 @@ class Kubernetes { | |||
|                         cloud_runner_logger_1.default.log('Abandoning cleanup, build error:'); | ||||
|                         throw error; | ||||
|                     } | ||||
|             try { | ||||
|                 yield async_wait_until_1.default(() => __awaiter(this, void 0, void 0, function* () { return (yield this.kubeClientBatch.readNamespacedJob(this.jobName, this.namespace)).body === null; }), { | ||||
|                     const jobBody = (yield this.kubeClientBatch.readNamespacedJob(this.jobName, this.namespace)).body; | ||||
|                     return jobBody === null || ((_b = jobBody.status) === null || _b === void 0 ? void 0 : _b.active) === 0; | ||||
|                 }), { | ||||
|                     timeout: 500000, | ||||
|                     intervalBetweenAttempts: 15000, | ||||
|                 }); | ||||
|  |  | |||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -142,6 +142,9 @@ class Kubernetes implements CloudRunnerProviderInterface { | |||
| 
 | ||||
|   async cleanupTaskResources() { | ||||
|     CloudRunnerLogger.log('cleaning up'); | ||||
|     try { | ||||
|       await waitUntil( | ||||
|         async () => { | ||||
|           try { | ||||
|             await this.kubeClientBatch.deleteNamespacedJob(this.jobName, this.namespace); | ||||
|             await this.kubeClient.deleteNamespacedSecret(this.secretName, this.namespace); | ||||
|  | @ -151,9 +154,9 @@ class Kubernetes implements CloudRunnerProviderInterface { | |||
|             CloudRunnerLogger.log('Abandoning cleanup, build error:'); | ||||
|             throw error; | ||||
|           } | ||||
|     try { | ||||
|       await waitUntil( | ||||
|         async () => (await this.kubeClientBatch.readNamespacedJob(this.jobName, this.namespace)).body === null, | ||||
|           const jobBody = (await this.kubeClientBatch.readNamespacedJob(this.jobName, this.namespace)).body; | ||||
|           return jobBody === null || jobBody.status?.active === 0; | ||||
|         }, | ||||
|         { | ||||
|           timeout: 500000, | ||||
|           intervalBetweenAttempts: 15000, | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue