pull/310/head
Frostebite 2021-12-30 21:00:38 +00:00
parent 312faf5820
commit 4b3df4c3cf
4 changed files with 45 additions and 15 deletions

22
dist/index.js vendored
View File

@ -1781,9 +1781,24 @@ class Kubernetes {
cloud_runner_logger_1.default.log('Job created');
this.setPodNameAndContainerName(yield Kubernetes.findPodFromJob(this.kubeClient, this.jobName, this.namespace));
cloud_runner_logger_1.default.log('Watching pod until running');
yield kubernetes_task_runner_1.default.watchUntilPodRunning(this.kubeClient, this.podName, this.namespace);
cloud_runner_logger_1.default.log('Pod running, streaming logs');
const output = yield kubernetes_task_runner_1.default.runTask(this.kubeConfig, this.kubeClient, this.jobName, this.podName, 'main', this.namespace, cloud_runner_logger_1.default.log);
let output = '';
// eslint-disable-next-line no-constant-condition
while (true) {
try {
yield kubernetes_task_runner_1.default.watchUntilPodRunning(this.kubeClient, this.podName, this.namespace);
cloud_runner_logger_1.default.log('Pod running, streaming logs');
output = yield kubernetes_task_runner_1.default.runTask(this.kubeConfig, this.kubeClient, this.jobName, this.podName, 'main', this.namespace, cloud_runner_logger_1.default.log);
break;
}
catch (error) {
if (error.message.includes(`HTTP`)) {
continue;
}
else {
throw error;
}
}
}
yield this.cleanupTaskResources();
return output;
}
@ -2539,6 +2554,7 @@ class TaskParameterSerializer {
array = array.filter((x) => x.value !== undefined && x.name !== '0' && x.value !== '');
array = array.map((x) => {
x.name = __1.Input.ToEnvVarFormat(x.name);
x.value = `${x.value}`;
return x;
});
return array;

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -101,17 +101,30 @@ class Kubernetes implements CloudRunnerProviderInterface {
CloudRunnerLogger.log('Job created');
this.setPodNameAndContainerName(await Kubernetes.findPodFromJob(this.kubeClient, this.jobName, this.namespace));
CloudRunnerLogger.log('Watching pod until running');
await KubernetesTaskRunner.watchUntilPodRunning(this.kubeClient, this.podName, this.namespace);
CloudRunnerLogger.log('Pod running, streaming logs');
const output = await KubernetesTaskRunner.runTask(
this.kubeConfig,
this.kubeClient,
this.jobName,
this.podName,
'main',
this.namespace,
CloudRunnerLogger.log,
);
let output = '';
// eslint-disable-next-line no-constant-condition
while (true) {
try {
await KubernetesTaskRunner.watchUntilPodRunning(this.kubeClient, this.podName, this.namespace);
CloudRunnerLogger.log('Pod running, streaming logs');
output = await KubernetesTaskRunner.runTask(
this.kubeConfig,
this.kubeClient,
this.jobName,
this.podName,
'main',
this.namespace,
CloudRunnerLogger.log,
);
break;
} catch (error: any) {
if (error.message.includes(`HTTP`)) {
continue;
} else {
throw error;
}
}
}
await this.cleanupTaskResources();
return output;
} catch (error) {

View File

@ -25,6 +25,7 @@ export class TaskParameterSerializer {
array = array.filter((x) => x.value !== undefined && x.name !== '0' && x.value !== '');
array = array.map((x) => {
x.name = Input.ToEnvVarFormat(x.name);
x.value = `${x.value}`;
return x;
});
return array;