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

15
dist/index.js vendored
View File

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

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

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