catch setup resource errors
parent
ebfa50648e
commit
aa15eda155
|
|
@ -1303,10 +1303,15 @@ class Kubernetes {
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
defaultSecretsArray) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
this.pvcName = `unity-builder-pvc-${buildUid}`;
|
||||
this.cleanupCronJobName = `unity-builder-cronjob-${buildUid}`;
|
||||
yield kubernetes_storage_1.default.createPersistentVolumeClaim(buildParameters, this.pvcName, this.kubeClient, this.namespace);
|
||||
yield kubernetes_cleanup_cronjob_1.default.createCleanupCronJob(this.kubeClientBatchBeta, this.cleanupCronJobName, this.namespace);
|
||||
}
|
||||
catch (error) {
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
}
|
||||
runBuildTask(buildId, image, commands, mountdir, workingdir, environment, secrets) {
|
||||
|
|
@ -1406,6 +1411,7 @@ class KubernetesCleanupCronJob {
|
|||
});
|
||||
}
|
||||
static createCleanupCronJob(kubeClientBatch, name, namespace) {
|
||||
try {
|
||||
const batchJob = new client_node_1.V1beta1CronJob();
|
||||
batchJob.kind = 'CronJob';
|
||||
batchJob.metadata = {
|
||||
|
|
@ -1444,6 +1450,10 @@ class KubernetesCleanupCronJob {
|
|||
};
|
||||
kubeClientBatch.createNamespacedCronJob(namespace, batchJob);
|
||||
}
|
||||
catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.default = KubernetesCleanupCronJob;
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -46,14 +46,23 @@ class Kubernetes implements RemoteBuilderProviderInterface {
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
defaultSecretsArray: { ParameterKey: string; EnvironmentVariable: string; ParameterValue: string }[],
|
||||
) {
|
||||
try {
|
||||
this.pvcName = `unity-builder-pvc-${buildUid}`;
|
||||
this.cleanupCronJobName = `unity-builder-cronjob-${buildUid}`;
|
||||
await KubernetesStorage.createPersistentVolumeClaim(buildParameters, this.pvcName, this.kubeClient, this.namespace);
|
||||
await KubernetesStorage.createPersistentVolumeClaim(
|
||||
buildParameters,
|
||||
this.pvcName,
|
||||
this.kubeClient,
|
||||
this.namespace,
|
||||
);
|
||||
await KubernetesCleanupCronJob.createCleanupCronJob(
|
||||
this.kubeClientBatchBeta,
|
||||
this.cleanupCronJobName,
|
||||
this.namespace,
|
||||
);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async runBuildTask(
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ class KubernetesCleanupCronJob {
|
|||
await api.deleteNamespacedCronJob('name', namespace);
|
||||
}
|
||||
static createCleanupCronJob(kubeClientBatch: BatchV1beta1Api, name: string, namespace: string) {
|
||||
try {
|
||||
const batchJob = new V1beta1CronJob();
|
||||
batchJob.kind = 'CronJob';
|
||||
batchJob.metadata = {
|
||||
|
|
@ -43,6 +44,9 @@ class KubernetesCleanupCronJob {
|
|||
};
|
||||
|
||||
kubeClientBatch.createNamespacedCronJob(namespace, batchJob);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
export default KubernetesCleanupCronJob;
|
||||
|
|
|
|||
Loading…
Reference in New Issue