follow logs

pull/265/head
Frostebite 2021-05-23 21:37:51 +01:00
parent 0bc5cf2adb
commit 645ce0ff06
3 changed files with 8 additions and 8 deletions

8
dist/index.js vendored
View File

@ -1011,9 +1011,9 @@ class Kubernetes {
}); });
} }
static watchBuildJobUntilFinished() { static watchBuildJobUntilFinished() {
var _a, _b, _c, _d; var _a, _b, _c, _d, _e, _f;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let podname; let podname, containerId;
let ready = false; let ready = false;
while (!ready) { while (!ready) {
yield new Promise((resolve) => setTimeout(resolve, pollInterval)); yield new Promise((resolve) => setTimeout(resolve, pollInterval));
@ -1030,13 +1030,13 @@ class Kubernetes {
else { else {
ready = true; ready = true;
podname = (_d = element.metadata) === null || _d === void 0 ? void 0 : _d.name; podname = (_d = element.metadata) === null || _d === void 0 ? void 0 : _d.name;
core.info(JSON.stringify(element, undefined, 4)); containerId = (_f = (_e = element.status) === null || _e === void 0 ? void 0 : _e.containerStatuses) === null || _f === void 0 ? void 0 : _f[0].containerID;
} }
} }
} }
} }
core.info(`Watching build job ${podname}`); core.info(`Watching build job ${podname}`);
const logs = yield this.kubeClient.readNamespacedPodLog(podname, this.namespace, undefined, true); const logs = yield this.kubeClient.readNamespacedPodLog(podname, this.namespace, containerId, true);
yield new Promise((resolve, reject) => { yield new Promise((resolve, reject) => {
logs.response.on('data', (chunk) => { logs.response.on('data', (chunk) => {
core.info(chunk); core.info(chunk);

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -297,7 +297,7 @@ class Kubernetes {
} }
static async watchBuildJobUntilFinished() { static async watchBuildJobUntilFinished() {
let podname; let podname, containerId;
let ready = false; let ready = false;
while (!ready) { while (!ready) {
await new Promise((resolve) => setTimeout(resolve, pollInterval)); await new Promise((resolve) => setTimeout(resolve, pollInterval));
@ -313,7 +313,7 @@ class Kubernetes {
} else { } else {
ready = true; ready = true;
podname = element.metadata?.name; podname = element.metadata?.name;
core.info(JSON.stringify(element, undefined, 4)); containerId = element.status?.containerStatuses?.[0].containerID;
} }
} }
} }
@ -321,7 +321,7 @@ class Kubernetes {
core.info(`Watching build job ${podname}`); core.info(`Watching build job ${podname}`);
const logs = await this.kubeClient.readNamespacedPodLog(podname, this.namespace, undefined, true); const logs = await this.kubeClient.readNamespacedPodLog(podname, this.namespace, containerId, true);
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
logs.response.on('data', (chunk) => { logs.response.on('data', (chunk) => {
core.info(chunk); core.info(chunk);