error handling for aws

pull/437/head
Frostebite 2022-10-22 03:49:36 +01:00
parent 2173383af8
commit e73975ab09
3 changed files with 35 additions and 24 deletions

16
dist/index.js vendored
View File

@ -3073,11 +3073,17 @@ class Kubernetes {
} }
createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets) { createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
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); try {
yield this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec); 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(`Build job created`); yield this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec);
yield new Promise((promise) => setTimeout(promise, 5000)); cloud_runner_logger_1.default.log(`Build job created`);
cloud_runner_logger_1.default.log('Job created'); yield new Promise((promise) => setTimeout(promise, 5000));
cloud_runner_logger_1.default.log('Job created');
}
catch (error) {
cloud_runner_logger_1.default.log(`Error occured creating job: ${error}`);
throw error;
}
}); });
} }
setPodNameAndContainerName(pod) { setPodNameAndContainerName(pod) {

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -162,24 +162,29 @@ class Kubernetes implements ProviderInterface {
environment: CloudRunnerEnvironmentVariable[], environment: CloudRunnerEnvironmentVariable[],
secrets: CloudRunnerSecret[], secrets: CloudRunnerSecret[],
) { ) {
const jobSpec = KubernetesJobSpecFactory.getJobSpec( try {
commands, const jobSpec = KubernetesJobSpecFactory.getJobSpec(
image, commands,
mountdir, image,
workingdir, mountdir,
environment, workingdir,
secrets, environment,
this.buildGuid, secrets,
this.buildParameters, this.buildGuid,
this.secretName, this.buildParameters,
this.pvcName, this.secretName,
this.jobName, this.pvcName,
k8s, this.jobName,
); k8s,
await this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec); );
CloudRunnerLogger.log(`Build job created`); await this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec);
await new Promise((promise) => setTimeout(promise, 5000)); CloudRunnerLogger.log(`Build job created`);
CloudRunnerLogger.log('Job created'); await new Promise((promise) => setTimeout(promise, 5000));
CloudRunnerLogger.log('Job created');
} catch (error) {
CloudRunnerLogger.log(`Error occured creating job: ${error}`);
throw error;
}
} }
setPodNameAndContainerName(pod: k8s.V1Pod) { setPodNameAndContainerName(pod: k8s.V1Pod) {