log stream from k8s http api
parent
cc45b2d8bf
commit
afb7c16348
|
|
@ -1035,7 +1035,7 @@ class Kubernetes {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static watchBuildJobUntilFinished() {
|
static watchBuildJobUntilFinished() {
|
||||||
var _a, _b, _c, _d, _e, _f;
|
var _a, _b, _c, _d, _e, _f, _g;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const pod = (yield Kubernetes.watchPodUntilReadyAndRead()) || {};
|
const pod = (yield Kubernetes.watchPodUntilReadyAndRead()) || {};
|
||||||
core.info(`Watching build job ${(_a = pod.metadata) === null || _a === void 0 ? void 0 : _a.name} ${JSON.stringify((_c = (_b = pod.status) === null || _b === void 0 ? void 0 : _b.containerStatuses) === null || _c === void 0 ? void 0 : _c[0].state, undefined, 4)}`);
|
core.info(`Watching build job ${(_a = pod.metadata) === null || _a === void 0 ? void 0 : _a.name} ${JSON.stringify((_c = (_b = pod.status) === null || _b === void 0 ? void 0 : _b.containerStatuses) === null || _c === void 0 ? void 0 : _c[0].state, undefined, 4)}`);
|
||||||
|
|
@ -1044,37 +1044,8 @@ class Kubernetes {
|
||||||
namespace: this.namespace,
|
namespace: this.namespace,
|
||||||
container: (_f = (_e = pod.status) === null || _e === void 0 ? void 0 : _e.containerStatuses) === null || _f === void 0 ? void 0 : _f[0].containerID,
|
container: (_f = (_e = pod.status) === null || _e === void 0 ? void 0 : _e.containerStatuses) === null || _f === void 0 ? void 0 : _f[0].containerID,
|
||||||
}, undefined, 4));
|
}, undefined, 4));
|
||||||
try {
|
const logs = yield this.kubeClient.readNamespacedPodLog(((_g = pod.metadata) === null || _g === void 0 ? void 0 : _g.name) || '', this.namespace);
|
||||||
yield new Promise((resolve, reject) => {
|
core.info(JSON.stringify(logs.body));
|
||||||
var _a;
|
|
||||||
this.kubeClient
|
|
||||||
.readNamespacedPodLog(((_a = pod.metadata) === null || _a === void 0 ? void 0 : _a.name) || '', this.namespace, undefined, true)
|
|
||||||
// eslint-disable-next-line github/no-then
|
|
||||||
.then((logs) => {
|
|
||||||
try {
|
|
||||||
logs.response.on('data', (chunk) => {
|
|
||||||
core.info(chunk.toString());
|
|
||||||
});
|
|
||||||
logs.response.on('close', resolve);
|
|
||||||
logs.response.on('error', reject);
|
|
||||||
logs.response.on('end', resolve);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
core.error(error);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
// eslint-disable-next-line github/no-then
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
core.info('opening log stream');
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
core.error(error);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static cleanup() {
|
static cleanup() {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -339,35 +339,8 @@ class Kubernetes {
|
||||||
4,
|
4,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
try {
|
const logs = await this.kubeClient.readNamespacedPodLog(pod.metadata?.name || '', this.namespace);
|
||||||
await new Promise((resolve, reject) => {
|
core.info(JSON.stringify(logs.body));
|
||||||
this.kubeClient
|
|
||||||
.readNamespacedPodLog(pod.metadata?.name || '', this.namespace, undefined, true)
|
|
||||||
// eslint-disable-next-line github/no-then
|
|
||||||
.then((logs) => {
|
|
||||||
try {
|
|
||||||
logs.response.on('data', (chunk) => {
|
|
||||||
core.info(chunk.toString());
|
|
||||||
});
|
|
||||||
logs.response.on('close', resolve);
|
|
||||||
logs.response.on('error', reject);
|
|
||||||
logs.response.on('end', resolve);
|
|
||||||
} catch (error) {
|
|
||||||
core.error(error);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
// eslint-disable-next-line github/no-then
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
core.info('opening log stream');
|
|
||||||
} catch (error) {
|
|
||||||
core.error(error);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static async cleanup() {
|
static async cleanup() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue