aws/k8s smoke test
parent
2f91bba5c6
commit
2d67dc48fe
|
@ -3346,17 +3346,28 @@ class Kubernetes {
|
|||
}
|
||||
cloud_runner_logger_1.default.log('Pod running, streaming logs');
|
||||
const running = yield kubernetes_pods_1.default.IsPodRunning(this.podName, this.namespace, this.kubeClient);
|
||||
output += yield kubernetes_task_runner_1.default.runTask(this.kubeConfig, this.kubeClient, this.jobName, this.podName, 'main', this.namespace, running);
|
||||
output += yield kubernetes_task_runner_1.default.runTask(this.kubeConfig, this.kubeClient, this.jobName, this.podName, kubernetes_job_spec_factory_1.default.MainContainerName, this.namespace, running);
|
||||
status = yield kubernetes_pods_1.default.GetPodStatus(this.podName, this.namespace, this.kubeClient);
|
||||
if (!running) {
|
||||
if (!follow_log_stream_service_1.FollowLogStreamService.DidReceiveEndOfTransmission && status === `Succeeded`) {
|
||||
output += yield kubernetes_task_runner_1.default.runTask(this.kubeConfig, this.kubeClient, this.jobName, this.podName, 'main', this.namespace, true);
|
||||
output += yield kubernetes_task_runner_1.default.runTask(this.kubeConfig, this.kubeClient, this.jobName, this.podName, ``, this.namespace, true);
|
||||
cloud_runner_logger_1.default.log(JSON.stringify((yield this.kubeClient.listNamespacedEvent(this.namespace)).body.items
|
||||
.map((x) => {
|
||||
return {
|
||||
message: x.message || ``,
|
||||
name: x.metadata.name || ``,
|
||||
reason: x.reason || ``,
|
||||
};
|
||||
})
|
||||
.filter((x) => x.name.includes(this.podName)), undefined, 4));
|
||||
break;
|
||||
}
|
||||
if (follow_log_stream_service_1.FollowLogStreamService.DidReceiveEndOfTransmission) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
status = yield kubernetes_pods_1.default.GetPodStatus(this.podName, this.namespace, this.kubeClient);
|
||||
cloud_runner_logger_1.default.log(`Pod status ${status}, retrying log stream...`);
|
||||
}
|
||||
catch (error) {
|
||||
|
@ -3596,7 +3607,7 @@ class KubernetesJobSpecFactory {
|
|||
],
|
||||
containers: [
|
||||
{
|
||||
name: 'main',
|
||||
name: KubernetesJobSpecFactory.MainContainerName,
|
||||
image,
|
||||
command: ['/bin/sh'],
|
||||
args: ['-c', cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.ApplyHooksToCommands(command, cloud_runner_1.default.buildParameters)],
|
||||
|
@ -3654,6 +3665,7 @@ class KubernetesJobSpecFactory {
|
|||
return job;
|
||||
}
|
||||
}
|
||||
KubernetesJobSpecFactory.MainContainerName = 'main';
|
||||
exports["default"] = KubernetesJobSpecFactory;
|
||||
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -156,7 +156,7 @@ class Kubernetes implements ProviderInterface {
|
|||
this.kubeClient,
|
||||
this.jobName,
|
||||
this.podName,
|
||||
'main',
|
||||
KubernetesJobSpecFactory.MainContainerName,
|
||||
this.namespace,
|
||||
running,
|
||||
);
|
||||
|
@ -173,6 +173,30 @@ class Kubernetes implements ProviderInterface {
|
|||
this.namespace,
|
||||
true,
|
||||
);
|
||||
output += await KubernetesTaskRunner.runTask(
|
||||
this.kubeConfig,
|
||||
this.kubeClient,
|
||||
this.jobName,
|
||||
this.podName,
|
||||
``,
|
||||
this.namespace,
|
||||
true,
|
||||
);
|
||||
CloudRunnerLogger.log(
|
||||
JSON.stringify(
|
||||
(await this.kubeClient.listNamespacedEvent(this.namespace)).body.items
|
||||
.map((x) => {
|
||||
return {
|
||||
message: x.message || ``,
|
||||
name: x.metadata.name || ``,
|
||||
reason: x.reason || ``,
|
||||
};
|
||||
})
|
||||
.filter((x) => x.name.includes(this.podName)),
|
||||
undefined,
|
||||
4,
|
||||
),
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -180,6 +204,7 @@ class Kubernetes implements ProviderInterface {
|
|||
break;
|
||||
}
|
||||
}
|
||||
status = await KubernetesPods.GetPodStatus(this.podName, this.namespace, this.kubeClient);
|
||||
CloudRunnerLogger.log(`Pod status ${status}, retrying log stream...`);
|
||||
} catch (error: any) {
|
||||
let errorParsed;
|
||||
|
|
|
@ -6,6 +6,7 @@ import CloudRunnerSecret from '../../services/cloud-runner-secret';
|
|||
import CloudRunner from '../../cloud-runner';
|
||||
|
||||
class KubernetesJobSpecFactory {
|
||||
public static readonly MainContainerName = 'main';
|
||||
static getJobSpec(
|
||||
command: string,
|
||||
image: string,
|
||||
|
@ -101,7 +102,7 @@ class KubernetesJobSpecFactory {
|
|||
],
|
||||
containers: [
|
||||
{
|
||||
name: 'main',
|
||||
name: KubernetesJobSpecFactory.MainContainerName,
|
||||
image,
|
||||
command: ['/bin/sh'],
|
||||
args: ['-c', CloudRunnerCustomHooks.ApplyHooksToCommands(command, CloudRunner.buildParameters)],
|
||||
|
|
Loading…
Reference in New Issue