fix logging
parent
e8a987ea7e
commit
caeeeb4573
|
|
@ -1053,7 +1053,8 @@ class Kubernetes {
|
|||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
let running = true;
|
||||
let logQueryTime;
|
||||
let logQueryTime = 0;
|
||||
let mostRecentLine = '';
|
||||
while (running) {
|
||||
yield new Promise((resolve) => setTimeout(resolve, pollInterval));
|
||||
core.info('Polling logs...');
|
||||
|
|
@ -1062,14 +1063,17 @@ class Kubernetes {
|
|||
if (arrayOfLines) {
|
||||
for (const element of arrayOfLines) {
|
||||
const [time, ...line] = element.split(' ');
|
||||
if (time !== logQueryTime) {
|
||||
core.info(line.join(' '));
|
||||
const lineString = line.join(' ');
|
||||
const lineDate = Date.parse(time);
|
||||
if (mostRecentLine !== lineString || lineDate !== logQueryTime) {
|
||||
core.info(lineString);
|
||||
logQueryTime = lineDate;
|
||||
mostRecentLine = lineString;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
logQueryTime = arrayOfLines[0].split(' ')[0];
|
||||
}
|
||||
const pod = yield this.kubeClient.readNamespacedPod(name, namespace);
|
||||
running = ((_b = pod.body.status) === null || _b === void 0 ? void 0 : _b.phase) === 'Running';
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -339,7 +339,8 @@ class Kubernetes {
|
|||
static async streamLogs(name: string, namespace: string) {
|
||||
try {
|
||||
let running = true;
|
||||
let logQueryTime;
|
||||
let logQueryTime: number = 0;
|
||||
let mostRecentLine: string = '';
|
||||
while (running) {
|
||||
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
||||
core.info('Polling logs...');
|
||||
|
|
@ -360,13 +361,16 @@ class Kubernetes {
|
|||
if (arrayOfLines) {
|
||||
for (const element of arrayOfLines) {
|
||||
const [time, ...line] = element.split(' ');
|
||||
if (time !== logQueryTime) {
|
||||
core.info(line.join(' '));
|
||||
const lineString: string = line.join(' ');
|
||||
const lineDate: number = Date.parse(time);
|
||||
if (mostRecentLine !== lineString || lineDate !== logQueryTime) {
|
||||
core.info(lineString);
|
||||
logQueryTime = lineDate;
|
||||
mostRecentLine = lineString;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
logQueryTime = arrayOfLines[0].split(' ')[0];
|
||||
}
|
||||
const pod = await this.kubeClient.readNamespacedPod(name, namespace);
|
||||
running = pod.body.status?.phase === 'Running';
|
||||
|
|
|
|||
Loading…
Reference in New Issue