follow logs

pull/265/head
Frostebite 2021-05-23 21:28:28 +01:00
parent fd9e9d058a
commit 0bc5cf2adb
3 changed files with 9 additions and 5 deletions

6
dist/index.js vendored
View File

@ -1006,7 +1006,7 @@ class Kubernetes {
};
job.spec.backoffLimit = 1;
const jobResults = yield this.kubeClientBatch.createNamespacedJob(this.namespace, job);
core.info(jobResults.body);
core.info(JSON.stringify(jobResults.body, undefined, 4));
core.info('Job created');
});
}
@ -1030,17 +1030,19 @@ class Kubernetes {
else {
ready = true;
podname = (_d = element.metadata) === null || _d === void 0 ? void 0 : _d.name;
core.info(JSON.stringify(element, undefined, 4));
}
}
}
}
core.info(`Watching build job ${podname}`);
const logs = yield this.kubeClient.readNamespacedPodLog(podname, this.namespace, undefined, true);
yield new Promise((resolve) => {
yield new Promise((resolve, reject) => {
logs.response.on('data', (chunk) => {
core.info(chunk);
});
logs.response.on('close', resolve);
logs.response.on('error', reject);
logs.response.on('end', resolve);
});
});

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -292,7 +292,7 @@ class Kubernetes {
};
job.spec.backoffLimit = 1;
const jobResults = await this.kubeClientBatch.createNamespacedJob(this.namespace, job);
core.info(jobResults.body);
core.info(JSON.stringify(jobResults.body, undefined, 4));
core.info('Job created');
}
@ -313,6 +313,7 @@ class Kubernetes {
} else {
ready = true;
podname = element.metadata?.name;
core.info(JSON.stringify(element, undefined, 4));
}
}
}
@ -321,11 +322,12 @@ class Kubernetes {
core.info(`Watching build job ${podname}`);
const logs = await this.kubeClient.readNamespacedPodLog(podname, this.namespace, undefined, true);
await new Promise((resolve) => {
await new Promise((resolve, reject) => {
logs.response.on('data', (chunk) => {
core.info(chunk);
});
logs.response.on('close', resolve);
logs.response.on('error', reject);
logs.response.on('end', resolve);
});
}