Catch errors and always cleanup

pull/265/head
Frostebite 2021-05-28 20:38:12 +01:00
parent bec61120bd
commit 148569023b
3 changed files with 19 additions and 12 deletions

9
dist/index.js vendored
View File

@ -943,11 +943,16 @@ class Kubernetes {
job.spec.backoffLimit = 1; job.spec.backoffLimit = 1;
yield this.kubeClientBatch.createNamespacedJob(this.namespace, job); yield this.kubeClientBatch.createNamespacedJob(this.namespace, job);
core.info('Job created'); core.info('Job created');
// watch try {
yield Kubernetes.watchPersistentVolumeClaimUntilReady(); yield Kubernetes.watchPersistentVolumeClaimUntilReady();
yield Kubernetes.watchBuildJobUntilFinished(); yield Kubernetes.watchBuildJobUntilFinished();
// cleanup }
catch (error) {
core.error(error);
}
finally {
yield Kubernetes.cleanup(); yield Kubernetes.cleanup();
}
}); });
} }
static runCloneJob() { static runCloneJob() {

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -230,13 +230,15 @@ class Kubernetes {
await this.kubeClientBatch.createNamespacedJob(this.namespace, job); await this.kubeClientBatch.createNamespacedJob(this.namespace, job);
core.info('Job created'); core.info('Job created');
// watch try {
await Kubernetes.watchPersistentVolumeClaimUntilReady(); await Kubernetes.watchPersistentVolumeClaimUntilReady();
await Kubernetes.watchBuildJobUntilFinished(); await Kubernetes.watchBuildJobUntilFinished();
} catch (error) {
// cleanup core.error(error);
} finally {
await Kubernetes.cleanup(); await Kubernetes.cleanup();
} }
}
static async runCloneJob() { static async runCloneJob() {
await Kubernetes.runJob( await Kubernetes.runJob(