Logging improvement
parent
23e042fcbe
commit
6dbb6e8ccb
|
|
@ -1539,7 +1539,7 @@ class Kubernetes {
|
||||||
core.info('Job created');
|
core.info('Job created');
|
||||||
yield kubernetes_storage_1.default.watchUntilPVCNotPending(this.kubeClient, this.pvcName, this.namespace);
|
yield kubernetes_storage_1.default.watchUntilPVCNotPending(this.kubeClient, this.pvcName, this.namespace);
|
||||||
core.info('PVC Bound');
|
core.info('PVC Bound');
|
||||||
this.setPodNameAndContainerName(yield this.getPod());
|
this.setPodNameAndContainerName(yield this.findPod());
|
||||||
core.info('Watching pod until running');
|
core.info('Watching pod until running');
|
||||||
yield this.watchUntilPodRunning();
|
yield this.watchUntilPodRunning();
|
||||||
core.info('Pod running, streaming logs');
|
core.info('Pod running, streaming logs');
|
||||||
|
|
@ -1553,18 +1553,13 @@ class Kubernetes {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getPod() {
|
findPod() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (this.podName === '') {
|
const pod = (yield this.kubeClient.listNamespacedPod(this.namespace)).body.items.find((x) => { var _a, _b; return ((_b = (_a = x.metadata) === null || _a === void 0 ? void 0 : _a.labels) === null || _b === void 0 ? void 0 : _b['job-name']) === this.jobName; });
|
||||||
const pod = (yield this.kubeClient.listNamespacedPod(this.namespace)).body.items.find((x) => { var _a, _b; return ((_b = (_a = x.metadata) === null || _a === void 0 ? void 0 : _a.labels) === null || _b === void 0 ? void 0 : _b['job-name']) === this.jobName; });
|
if (pod === undefined) {
|
||||||
if (pod === undefined) {
|
throw new Error("pod with job-name label doesn't exist");
|
||||||
throw new Error("pod with job-name label doesn't exist");
|
|
||||||
}
|
|
||||||
return pod;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return (yield this.kubeClient.readNamespacedPod(this.podName, this.namespace)).body;
|
|
||||||
}
|
}
|
||||||
|
return pod;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
runCloneJob() {
|
runCloneJob() {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -320,7 +320,7 @@ class Kubernetes implements RemoteBuilderProviderInterface {
|
||||||
core.info('Job created');
|
core.info('Job created');
|
||||||
await KubernetesStorage.watchUntilPVCNotPending(this.kubeClient, this.pvcName, this.namespace);
|
await KubernetesStorage.watchUntilPVCNotPending(this.kubeClient, this.pvcName, this.namespace);
|
||||||
core.info('PVC Bound');
|
core.info('PVC Bound');
|
||||||
this.setPodNameAndContainerName(await this.getPod());
|
this.setPodNameAndContainerName(await this.findPod());
|
||||||
core.info('Watching pod until running');
|
core.info('Watching pod until running');
|
||||||
await this.watchUntilPodRunning();
|
await this.watchUntilPodRunning();
|
||||||
core.info('Pod running, streaming logs');
|
core.info('Pod running, streaming logs');
|
||||||
|
|
@ -333,18 +333,14 @@ class Kubernetes implements RemoteBuilderProviderInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getPod() {
|
async findPod() {
|
||||||
if (this.podName === '') {
|
const pod = (await this.kubeClient.listNamespacedPod(this.namespace)).body.items.find(
|
||||||
const pod = (await this.kubeClient.listNamespacedPod(this.namespace)).body.items.find(
|
(x) => x.metadata?.labels?.['job-name'] === this.jobName,
|
||||||
(x) => x.metadata?.labels?.['job-name'] === this.jobName,
|
);
|
||||||
);
|
if (pod === undefined) {
|
||||||
if (pod === undefined) {
|
throw new Error("pod with job-name label doesn't exist");
|
||||||
throw new Error("pod with job-name label doesn't exist");
|
|
||||||
}
|
|
||||||
return pod;
|
|
||||||
} else {
|
|
||||||
return (await this.kubeClient.readNamespacedPod(this.podName, this.namespace)).body;
|
|
||||||
}
|
}
|
||||||
|
return pod;
|
||||||
}
|
}
|
||||||
|
|
||||||
async runCloneJob() {
|
async runCloneJob() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue