End of log stream message

pull/273/head
Frostebite 2021-06-06 19:54:07 +01:00
parent 896e754512
commit 4d622063ea
3 changed files with 17 additions and 28 deletions

22
dist/index.js vendored
View File

@ -1042,22 +1042,16 @@ class Kubernetes {
});
}
static streamLogs(name, namespace, container) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
try {
let running = true;
while (running) {
const pod = yield this.kubeClient.readNamespacedPod(name, namespace);
running = ((_a = pod.body.status) === null || _a === void 0 ? void 0 : _a.phase) === 'Running';
yield new Promise((resolve) => setTimeout(resolve, pollInterval));
core.info('Polling logs...');
const stream = new stream_1.Writable();
stream._write = (chunk, encoding, next) => {
core.info(chunk.toString());
next();
};
yield new Promise((resolve) => new client_node_1.Log(this.kubeConfig).log(namespace, name, container, stream, resolve));
}
core.info('Polling logs...');
const stream = new stream_1.Writable();
stream._write = (chunk, encoding, next) => {
core.info(chunk.toString());
next();
};
yield new Promise((resolve) => new client_node_1.Log(this.kubeConfig).log(namespace, name, container, stream, resolve));
core.info('end of log stream');
}
catch (error) {
core.error(JSON.stringify(error, undefined, 4));

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -334,19 +334,14 @@ class Kubernetes {
static async streamLogs(name: string, namespace: string, container: string) {
try {
let running = true;
while (running) {
const pod = await this.kubeClient.readNamespacedPod(name, namespace);
running = pod.body.status?.phase === 'Running';
await new Promise((resolve) => setTimeout(resolve, pollInterval));
core.info('Polling logs...');
const stream = new Writable();
stream._write = (chunk, encoding, next) => {
core.info(chunk.toString());
next();
};
await new Promise((resolve) => new Log(this.kubeConfig).log(namespace, name, container, stream, resolve));
}
core.info('Polling logs...');
const stream = new Writable();
stream._write = (chunk, encoding, next) => {
core.info(chunk.toString());
next();
};
await new Promise((resolve) => new Log(this.kubeConfig).log(namespace, name, container, stream, resolve));
core.info('end of log stream');
} catch (error) {
core.error(JSON.stringify(error, undefined, 4));
throw error;