aws/k8s smoke test
parent
45c4e7f297
commit
3b6b36fd5a
|
@ -3228,6 +3228,7 @@ const kubernetes_service_account_1 = __importDefault(__nccwpck_require__(47319))
|
||||||
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
||||||
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
||||||
const kubernetes_pods_1 = __importDefault(__nccwpck_require__(90740));
|
const kubernetes_pods_1 = __importDefault(__nccwpck_require__(90740));
|
||||||
|
const follow_log_stream_service_1 = __nccwpck_require__(64121);
|
||||||
class Kubernetes {
|
class Kubernetes {
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
constructor(buildParameters) {
|
constructor(buildParameters) {
|
||||||
|
@ -3349,13 +3350,15 @@ class Kubernetes {
|
||||||
output = yield kubernetes_task_runner_1.default.runTask(this.kubeConfig, this.kubeClient, this.jobName, this.podName, 'main', this.namespace);
|
output = yield kubernetes_task_runner_1.default.runTask(this.kubeConfig, this.kubeClient, this.jobName, this.podName, 'main', this.namespace);
|
||||||
const running = yield kubernetes_pods_1.default.IsPodRunning(this.podName, this.namespace, this.kubeClient);
|
const running = yield kubernetes_pods_1.default.IsPodRunning(this.podName, this.namespace, this.kubeClient);
|
||||||
if (!running) {
|
if (!running) {
|
||||||
|
const podStatus = yield kubernetes_pods_1.default.GetPodStatus(this.podName, this.namespace, this.kubeClient);
|
||||||
cloud_runner_logger_1.default.log(`Pod not found, assumed ended!`);
|
cloud_runner_logger_1.default.log(`Pod not found, assumed ended!`);
|
||||||
break;
|
if (follow_log_stream_service_1.FollowLogStreamService.DidReceiveEndOfTransmission && podStatus === `Succeeded`) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cloud_runner_logger_1.default.log('Pod still running, recovering stream...');
|
cloud_runner_logger_1.default.log('Pod still running, recovering stream...');
|
||||||
}
|
}
|
||||||
yield this.cleanupTaskResources();
|
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
let errorParsed;
|
let errorParsed;
|
||||||
|
@ -3383,6 +3386,7 @@ class Kubernetes {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
yield this.cleanupTaskResources();
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
@ -3681,6 +3685,14 @@ class KubernetesPods {
|
||||||
return running;
|
return running;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
static GetPodStatus(podName, namespace, kubeClient) {
|
||||||
|
var _a;
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const pods = (yield kubeClient.listNamespacedPod(namespace)).body.items.find((x) => { var _a; return podName === ((_a = x.metadata) === null || _a === void 0 ? void 0 : _a.name); });
|
||||||
|
const phase = ((_a = pods === null || pods === void 0 ? void 0 : pods.status) === null || _a === void 0 ? void 0 : _a.phase) || 'undefined status';
|
||||||
|
return phase;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exports["default"] = KubernetesPods;
|
exports["default"] = KubernetesPods;
|
||||||
|
|
||||||
|
@ -4100,7 +4112,7 @@ class KubernetesTaskRunner {
|
||||||
const status = yield kubeClient.readNamespacedPodStatus(podName, namespace);
|
const status = yield kubeClient.readNamespacedPodStatus(podName, namespace);
|
||||||
const phase = (_a = status === null || status === void 0 ? void 0 : status.body.status) === null || _a === void 0 ? void 0 : _a.phase;
|
const phase = (_a = status === null || status === void 0 ? void 0 : status.body.status) === null || _a === void 0 ? void 0 : _a.phase;
|
||||||
success = phase === 'Running';
|
success = phase === 'Running';
|
||||||
cloud_runner_logger_1.default.log(`Phase:${(_b = status.body.status) === null || _b === void 0 ? void 0 : _b.phase} Reason:${((_d = (_c = status.body.status) === null || _c === void 0 ? void 0 : _c.conditions) === null || _d === void 0 ? void 0 : _d[0].reason) || ''} Message:${((_f = (_e = status.body.status) === null || _e === void 0 ? void 0 : _e.conditions) === null || _f === void 0 ? void 0 : _f[0].message) || ''}`);
|
cloud_runner_logger_1.default.log(`Phase:${(_b = status.body.status) === null || _b === void 0 ? void 0 : _b.phase} \n Reason:${((_d = (_c = status.body.status) === null || _c === void 0 ? void 0 : _c.conditions) === null || _d === void 0 ? void 0 : _d[0].reason) || ''} \n Message:${((_f = (_e = status.body.status) === null || _e === void 0 ? void 0 : _e.conditions) === null || _f === void 0 ? void 0 : _f[0].message) || ''}`);
|
||||||
cloud_runner_logger_1.default.log(JSON.stringify((yield kubeClient.listNamespacedEvent(namespace)).body.items
|
cloud_runner_logger_1.default.log(JSON.stringify((yield kubeClient.listNamespacedEvent(namespace)).body.items
|
||||||
.map((x) => {
|
.map((x) => {
|
||||||
return {
|
return {
|
||||||
|
@ -5518,6 +5530,7 @@ class FollowLogStreamService {
|
||||||
static handleIteration(message, shouldReadLogs, shouldCleanup, output) {
|
static handleIteration(message, shouldReadLogs, shouldCleanup, output) {
|
||||||
if (message.includes(`---${cloud_runner_1.default.buildParameters.logId}`)) {
|
if (message.includes(`---${cloud_runner_1.default.buildParameters.logId}`)) {
|
||||||
cloud_runner_logger_1.default.log('End of log transmission received');
|
cloud_runner_logger_1.default.log('End of log transmission received');
|
||||||
|
FollowLogStreamService.DidReceiveEndOfTransmission = true;
|
||||||
shouldReadLogs = false;
|
shouldReadLogs = false;
|
||||||
}
|
}
|
||||||
else if (message.includes('Rebuilding Library because the asset database could not be found!')) {
|
else if (message.includes('Rebuilding Library because the asset database could not be found!')) {
|
||||||
|
@ -5568,6 +5581,7 @@ class FollowLogStreamService {
|
||||||
}
|
}
|
||||||
exports.FollowLogStreamService = FollowLogStreamService;
|
exports.FollowLogStreamService = FollowLogStreamService;
|
||||||
FollowLogStreamService.errors = ``;
|
FollowLogStreamService.errors = ``;
|
||||||
|
FollowLogStreamService.DidReceiveEndOfTransmission = false;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -15,6 +15,7 @@ import CloudRunner from '../../cloud-runner';
|
||||||
import { ProviderResource } from '../provider-resource';
|
import { ProviderResource } from '../provider-resource';
|
||||||
import { ProviderWorkflow } from '../provider-workflow';
|
import { ProviderWorkflow } from '../provider-workflow';
|
||||||
import KubernetesPods from './kubernetes-pods';
|
import KubernetesPods from './kubernetes-pods';
|
||||||
|
import { FollowLogStreamService } from '../../services/follow-log-stream-service';
|
||||||
|
|
||||||
class Kubernetes implements ProviderInterface {
|
class Kubernetes implements ProviderInterface {
|
||||||
public static Instance: Kubernetes;
|
public static Instance: Kubernetes;
|
||||||
|
@ -162,12 +163,14 @@ class Kubernetes implements ProviderInterface {
|
||||||
const running = await KubernetesPods.IsPodRunning(this.podName, this.namespace, this.kubeClient);
|
const running = await KubernetesPods.IsPodRunning(this.podName, this.namespace, this.kubeClient);
|
||||||
|
|
||||||
if (!running) {
|
if (!running) {
|
||||||
|
const podStatus = await KubernetesPods.GetPodStatus(this.podName, this.namespace, this.kubeClient);
|
||||||
CloudRunnerLogger.log(`Pod not found, assumed ended!`);
|
CloudRunnerLogger.log(`Pod not found, assumed ended!`);
|
||||||
break;
|
if (FollowLogStreamService.DidReceiveEndOfTransmission && podStatus === `Succeeded`) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
CloudRunnerLogger.log('Pod still running, recovering stream...');
|
CloudRunnerLogger.log('Pod still running, recovering stream...');
|
||||||
}
|
}
|
||||||
await this.cleanupTaskResources();
|
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
let errorParsed;
|
let errorParsed;
|
||||||
try {
|
try {
|
||||||
|
@ -196,6 +199,7 @@ class Kubernetes implements ProviderInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
await this.cleanupTaskResources();
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -12,6 +12,12 @@ class KubernetesPods {
|
||||||
|
|
||||||
return running;
|
return running;
|
||||||
}
|
}
|
||||||
|
public static async GetPodStatus(podName: string, namespace: string, kubeClient: CoreV1Api) {
|
||||||
|
const pods = (await kubeClient.listNamespacedPod(namespace)).body.items.find((x) => podName === x.metadata?.name);
|
||||||
|
const phase = pods?.status?.phase || 'undefined status';
|
||||||
|
|
||||||
|
return phase;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default KubernetesPods;
|
export default KubernetesPods;
|
||||||
|
|
|
@ -127,9 +127,9 @@ class KubernetesTaskRunner {
|
||||||
const phase = status?.body.status?.phase;
|
const phase = status?.body.status?.phase;
|
||||||
success = phase === 'Running';
|
success = phase === 'Running';
|
||||||
CloudRunnerLogger.log(
|
CloudRunnerLogger.log(
|
||||||
`Phase:${status.body.status?.phase} Reason:${status.body.status?.conditions?.[0].reason || ''} Message:${
|
`Phase:${status.body.status?.phase} \n Reason:${
|
||||||
status.body.status?.conditions?.[0].message || ''
|
status.body.status?.conditions?.[0].reason || ''
|
||||||
}`,
|
} \n Message:${status.body.status?.conditions?.[0].message || ''}`,
|
||||||
);
|
);
|
||||||
CloudRunnerLogger.log(
|
CloudRunnerLogger.log(
|
||||||
JSON.stringify(
|
JSON.stringify(
|
||||||
|
|
|
@ -6,9 +6,11 @@ import GitHub from '../../github';
|
||||||
|
|
||||||
export class FollowLogStreamService {
|
export class FollowLogStreamService {
|
||||||
static errors = ``;
|
static errors = ``;
|
||||||
|
public static DidReceiveEndOfTransmission = false;
|
||||||
public static handleIteration(message, shouldReadLogs, shouldCleanup, output) {
|
public static handleIteration(message, shouldReadLogs, shouldCleanup, output) {
|
||||||
if (message.includes(`---${CloudRunner.buildParameters.logId}`)) {
|
if (message.includes(`---${CloudRunner.buildParameters.logId}`)) {
|
||||||
CloudRunnerLogger.log('End of log transmission received');
|
CloudRunnerLogger.log('End of log transmission received');
|
||||||
|
FollowLogStreamService.DidReceiveEndOfTransmission = true;
|
||||||
shouldReadLogs = false;
|
shouldReadLogs = false;
|
||||||
} else if (message.includes('Rebuilding Library because the asset database could not be found!')) {
|
} else if (message.includes('Rebuilding Library because the asset database could not be found!')) {
|
||||||
GitHub.updateGitHubCheck(`Library was not found, importing new Library`, ``);
|
GitHub.updateGitHubCheck(`Library was not found, importing new Library`, ``);
|
||||||
|
|
Loading…
Reference in New Issue