fix logging
parent
caeeeb4573
commit
ec58c24ea7
|
|
@ -1058,8 +1058,18 @@ class Kubernetes {
|
||||||
while (running) {
|
while (running) {
|
||||||
yield new Promise((resolve) => setTimeout(resolve, pollInterval));
|
yield new Promise((resolve) => setTimeout(resolve, pollInterval));
|
||||||
core.info('Polling logs...');
|
core.info('Polling logs...');
|
||||||
const logs = yield this.kubeClient.readNamespacedPodLog(name, namespace, undefined, undefined, undefined, undefined, undefined, undefined, logQueryTime, undefined, true);
|
let logs;
|
||||||
const arrayOfLines = (_a = logs.body.match(/[^\n\r]+/g)) === null || _a === void 0 ? void 0 : _a.reverse();
|
try {
|
||||||
|
logs = yield this.kubeClient.readNamespacedPodLog(name, namespace, undefined, undefined, undefined, undefined, undefined, undefined, logQueryTime, undefined, true);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
core.info(error);
|
||||||
|
if (error.message === 'HTTP request failed') {
|
||||||
|
core.info('!warning - K8S HTTP FAILED');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const arrayOfLines = (_a = logs === null || logs === void 0 ? void 0 : logs.body.match(/[^\n\r]+/g)) === null || _a === void 0 ? void 0 : _a.reverse();
|
||||||
if (arrayOfLines) {
|
if (arrayOfLines) {
|
||||||
for (const element of arrayOfLines) {
|
for (const element of arrayOfLines) {
|
||||||
const [time, ...line] = element.split(' ');
|
const [time, ...line] = element.split(' ');
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -344,7 +344,9 @@ class Kubernetes {
|
||||||
while (running) {
|
while (running) {
|
||||||
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
||||||
core.info('Polling logs...');
|
core.info('Polling logs...');
|
||||||
const logs = await this.kubeClient.readNamespacedPodLog(
|
let logs;
|
||||||
|
try {
|
||||||
|
logs = await this.kubeClient.readNamespacedPodLog(
|
||||||
name,
|
name,
|
||||||
namespace,
|
namespace,
|
||||||
undefined,
|
undefined,
|
||||||
|
|
@ -357,7 +359,14 @@ class Kubernetes {
|
||||||
undefined,
|
undefined,
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
const arrayOfLines = logs.body.match(/[^\n\r]+/g)?.reverse();
|
} catch (error) {
|
||||||
|
core.info(error);
|
||||||
|
if (error.message === 'HTTP request failed') {
|
||||||
|
core.info('!warning - K8S HTTP FAILED');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const arrayOfLines = logs?.body.match(/[^\n\r]+/g)?.reverse();
|
||||||
if (arrayOfLines) {
|
if (arrayOfLines) {
|
||||||
for (const element of arrayOfLines) {
|
for (const element of arrayOfLines) {
|
||||||
const [time, ...line] = element.split(' ');
|
const [time, ...line] = element.split(' ');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue