Catch errors and always cleanup
parent
bec61120bd
commit
148569023b
|
|
@ -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
|
}
|
||||||
yield Kubernetes.cleanup();
|
catch (error) {
|
||||||
|
core.error(error);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
yield Kubernetes.cleanup();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static runCloneJob() {
|
static runCloneJob() {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -230,12 +230,14 @@ 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);
|
||||||
await Kubernetes.cleanup();
|
} finally {
|
||||||
|
await Kubernetes.cleanup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static async runCloneJob() {
|
static async runCloneJob() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue