mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-07 20:35:33 -04:00
stream logs through standard input and new remote client cli command
This commit is contained in:
parent
fdde0dec58
commit
88fa5d247c
BIN
dist/index.js
generated
vendored
BIN
dist/index.js
generated
vendored
Binary file not shown.
BIN
dist/index.js.map
generated
vendored
BIN
dist/index.js.map
generated
vendored
Binary file not shown.
@ -42,6 +42,14 @@ class Kubernetes implements ProviderInterface {
|
|||||||
CloudRunnerLogger.log('Loaded default Kubernetes configuration for this environment');
|
CloudRunnerLogger.log('Loaded default Kubernetes configuration for this environment');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async PushLogUpdate(logs: string) {
|
||||||
|
const body: k8s.V1ConfigMap = new k8s.V1ConfigMap();
|
||||||
|
body.data = {};
|
||||||
|
body.data['logs'] = logs;
|
||||||
|
body.metadata = { name: `${this.jobName}-logs` };
|
||||||
|
await this.kubeClient.createNamespacedConfigMap(this.namespace, body);
|
||||||
|
}
|
||||||
|
|
||||||
async listResources(): Promise<ProviderResource[]> {
|
async listResources(): Promise<ProviderResource[]> {
|
||||||
const pods = await this.kubeClient.listNamespacedPod(this.namespace);
|
const pods = await this.kubeClient.listNamespacedPod(this.namespace);
|
||||||
const serviceAccounts = await this.kubeClient.listNamespacedServiceAccount(this.namespace);
|
const serviceAccounts = await this.kubeClient.listNamespacedServiceAccount(this.namespace);
|
||||||
|
@ -82,7 +82,7 @@ export class RemoteClient {
|
|||||||
|
|
||||||
await RemoteClient.runCustomHookFiles(`after-build`);
|
await RemoteClient.runCustomHookFiles(`after-build`);
|
||||||
|
|
||||||
RemoteClientLogger.printCollectedLogs();
|
await RemoteClientLogger.printCollectedLogs();
|
||||||
|
|
||||||
return new Promise((result) => result(``));
|
return new Promise((result) => result(``));
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ import CloudRunnerLogger from '../services/core/cloud-runner-logger';
|
|||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import CloudRunner from '../cloud-runner';
|
import CloudRunner from '../cloud-runner';
|
||||||
|
import CloudRunnerOptions from '../options/cloud-runner-options';
|
||||||
|
import Kubernetes from '../providers/k8s';
|
||||||
|
|
||||||
export class RemoteClientLogger {
|
export class RemoteClientLogger {
|
||||||
private static get LogFilePath() {
|
private static get LogFilePath() {
|
||||||
@ -32,8 +34,13 @@ export class RemoteClientLogger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static printCollectedLogs() {
|
public static async printCollectedLogs() {
|
||||||
|
if (CloudRunnerOptions.providerStrategy !== 'k8s') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
CloudRunnerLogger.log(`Collected Logs`);
|
CloudRunnerLogger.log(`Collected Logs`);
|
||||||
CloudRunnerLogger.log(fs.readFileSync(RemoteClientLogger.LogFilePath).toString());
|
const logs = fs.readFileSync(RemoteClientLogger.LogFilePath).toString();
|
||||||
|
CloudRunnerLogger.log(logs);
|
||||||
|
await Kubernetes.Instance.PushLogUpdate(logs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user