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