fix: k8s stability

pull/437/head
Frostebite 2022-11-02 00:20:03 +00:00
parent ceedd5808a
commit 2dae588749
3 changed files with 3 additions and 9 deletions

5
dist/index.js vendored
View File

@ -3057,8 +3057,6 @@ class Kubernetes {
this.secretName = `build-credentials-${this.buildGuid}`;
this.jobName = `unity-builder-job-${this.buildGuid}`;
this.containerName = `main`;
const namespaceListTest = yield this.kubeClient.listNamespace();
cloud_runner_logger_1.default.log(`Init test ${namespaceListTest.body.items.length}`);
yield kubernetes_secret_1.default.createSecret(secrets, this.secretName, this.namespace, this.kubeClient);
yield this.createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets);
this.setPodNameAndContainerName(yield Kubernetes.findPodFromJob(this.kubeClient, this.jobName, this.namespace));
@ -3102,9 +3100,7 @@ class Kubernetes {
return __awaiter(this, void 0, void 0, function* () {
for (let index = 0; index < 3; index++) {
try {
cloud_runner_logger_1.default.log(`Job spec creating`);
const jobSpec = kubernetes_job_spec_factory_1.default.getJobSpec(commands, image, mountdir, workingdir, environment, secrets, this.buildGuid, this.buildParameters, this.secretName, this.pvcName, this.jobName, k8s);
cloud_runner_logger_1.default.log(`Job spec created`);
yield new Promise((promise) => setTimeout(promise, 15000));
yield this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec);
cloud_runner_logger_1.default.log(`Build job created`);
@ -3114,6 +3110,7 @@ class Kubernetes {
}
catch (error) {
cloud_runner_logger_1.default.log(`Error occured creating job: ${error}`);
throw error;
}
}
});

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -131,8 +131,6 @@ class Kubernetes implements ProviderInterface {
this.secretName = `build-credentials-${this.buildGuid}`;
this.jobName = `unity-builder-job-${this.buildGuid}`;
this.containerName = `main`;
const namespaceListTest = await this.kubeClient.listNamespace();
CloudRunnerLogger.log(`Init test ${namespaceListTest.body.items.length}`);
await KubernetesSecret.createSecret(secrets, this.secretName, this.namespace, this.kubeClient);
await this.createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets);
this.setPodNameAndContainerName(await Kubernetes.findPodFromJob(this.kubeClient, this.jobName, this.namespace));
@ -189,7 +187,6 @@ class Kubernetes implements ProviderInterface {
) {
for (let index = 0; index < 3; index++) {
try {
CloudRunnerLogger.log(`Job spec creating`);
const jobSpec = KubernetesJobSpecFactory.getJobSpec(
commands,
image,
@ -204,7 +201,6 @@ class Kubernetes implements ProviderInterface {
this.jobName,
k8s,
);
CloudRunnerLogger.log(`Job spec created`);
await new Promise((promise) => setTimeout(promise, 15000));
await this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec);
CloudRunnerLogger.log(`Build job created`);
@ -214,6 +210,7 @@ class Kubernetes implements ProviderInterface {
return;
} catch (error) {
CloudRunnerLogger.log(`Error occured creating job: ${error}`);
throw error;
}
}
}