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

8
dist/index.js vendored
View File

@ -1042,14 +1042,8 @@ class Kubernetes {
}); });
} }
static streamLogs(name, namespace, container) { static streamLogs(name, namespace, container) {
var _a;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { 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...'); core.info('Polling logs...');
const stream = new stream_1.Writable(); const stream = new stream_1.Writable();
stream._write = (chunk, encoding, next) => { stream._write = (chunk, encoding, next) => {
@ -1057,7 +1051,7 @@ class Kubernetes {
next(); next();
}; };
yield new Promise((resolve) => new client_node_1.Log(this.kubeConfig).log(namespace, name, container, stream, resolve)); 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) { catch (error) {
core.error(JSON.stringify(error, undefined, 4)); 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,11 +334,6 @@ class Kubernetes {
static async streamLogs(name: string, namespace: string, container: string) { static async streamLogs(name: string, namespace: string, container: string) {
try { 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...'); core.info('Polling logs...');
const stream = new Writable(); const stream = new Writable();
stream._write = (chunk, encoding, next) => { stream._write = (chunk, encoding, next) => {
@ -346,7 +341,7 @@ class Kubernetes {
next(); next();
}; };
await new Promise((resolve) => new Log(this.kubeConfig).log(namespace, name, container, stream, resolve)); await new Promise((resolve) => new Log(this.kubeConfig).log(namespace, name, container, stream, resolve));
} core.info('end of log stream');
} catch (error) { } catch (error) {
core.error(JSON.stringify(error, undefined, 4)); core.error(JSON.stringify(error, undefined, 4));
throw error; throw error;