log stream from k8s http api
parent
cc45b2d8bf
commit
afb7c16348
|
|
@ -1035,7 +1035,7 @@ class Kubernetes {
|
|||
});
|
||||
}
|
||||
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* () {
|
||||
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)}`);
|
||||
|
|
@ -1044,37 +1044,8 @@ class Kubernetes {
|
|||
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,
|
||||
}, undefined, 4));
|
||||
try {
|
||||
yield new Promise((resolve, reject) => {
|
||||
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;
|
||||
}
|
||||
const logs = yield this.kubeClient.readNamespacedPodLog(((_g = pod.metadata) === null || _g === void 0 ? void 0 : _g.name) || '', this.namespace);
|
||||
core.info(JSON.stringify(logs.body));
|
||||
});
|
||||
}
|
||||
static cleanup() {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -339,35 +339,8 @@ class Kubernetes {
|
|||
4,
|
||||
),
|
||||
);
|
||||
try {
|
||||
await new Promise((resolve, reject) => {
|
||||
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;
|
||||
}
|
||||
const logs = await this.kubeClient.readNamespacedPodLog(pod.metadata?.name || '', this.namespace);
|
||||
core.info(JSON.stringify(logs.body));
|
||||
}
|
||||
|
||||
static async cleanup() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue