follow logs

pull/265/head
Frostebite 2021-05-23 22:15:16 +01:00
parent f058aabb4f
commit 41534d2ec6
3 changed files with 37 additions and 8 deletions

16
dist/index.js vendored
View File

@ -1043,11 +1043,23 @@ class Kubernetes {
});
}
static watchBuildJobUntilFinished() {
var _a, _b, _c, _d;
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}`);
const logs = yield this.kubeClient.readNamespacedPodLog(((_b = pod.metadata) === null || _b === void 0 ? void 0 : _b.name) || '', this.namespace, (_d = (_c = pod.status) === null || _c === void 0 ? void 0 : _c.containerStatuses) === null || _d === void 0 ? void 0 : _d[0].containerID, true);
core.info(JSON.stringify({
name: ((_b = pod.metadata) === null || _b === void 0 ? void 0 : _b.name) || '',
namespace: this.namespace,
container: (_d = (_c = pod.status) === null || _c === void 0 ? void 0 : _c.containerStatuses) === null || _d === void 0 ? void 0 : _d[0].containerID,
}, undefined, 4));
let logs;
try {
logs = yield this.kubeClient.readNamespacedPodLog(((_e = pod.metadata) === null || _e === void 0 ? void 0 : _e.name) || '', this.namespace, (_g = (_f = pod.status) === null || _f === void 0 ? void 0 : _f.containerStatuses) === null || _g === void 0 ? void 0 : _g[0].containerID, true);
}
catch (error) {
core.error(error);
throw error;
}
core.info('opening log stream');
yield new Promise((resolve, reject) => {
try {

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -333,12 +333,29 @@ class Kubernetes {
core.info(`Watching build job ${pod.metadata?.name}`);
const logs = await this.kubeClient.readNamespacedPodLog(
core.info(
JSON.stringify(
{
name: pod.metadata?.name || '',
namespace: this.namespace,
container: pod.status?.containerStatuses?.[0].containerID,
},
undefined,
4,
),
);
let logs;
try {
logs = await this.kubeClient.readNamespacedPodLog(
pod.metadata?.name || '',
this.namespace,
pod.status?.containerStatuses?.[0].containerID,
true,
);
} catch (error) {
core.error(error);
throw error;
}
core.info('opening log stream');