mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-07 20:35:33 -04:00
fix
This commit is contained in:
parent
e038adc834
commit
44e887fae0
@ -42,7 +42,6 @@ jobs:
|
||||
- 'cloud-runner-end2end-locking'
|
||||
- 'cloud-runner-end2end-caching'
|
||||
- 'cloud-runner-end2end-retaining'
|
||||
- 'cloud-runner-remote-client'
|
||||
- 'cloud-runner-caching'
|
||||
- 'cloud-runner-environment'
|
||||
- 'cloud-runner-image'
|
||||
|
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.
BIN
dist/licenses.txt
generated
vendored
BIN
dist/licenses.txt
generated
vendored
Binary file not shown.
@ -5,7 +5,6 @@ import { CloudRunnerSystem } from '../../services/core/cloud-runner-system';
|
||||
import CloudRunner from '../../cloud-runner';
|
||||
import KubernetesPods from './kubernetes-pods';
|
||||
import { FollowLogStreamService } from '../../services/core/follow-log-stream-service';
|
||||
import { RemoteClientLogger } from '../../remote-client/remote-client-logger';
|
||||
|
||||
class KubernetesTaskRunner {
|
||||
static readonly maxRetry: number = 3;
|
||||
@ -39,27 +38,6 @@ class KubernetesTaskRunner {
|
||||
|
||||
// split output chunk and handle per line
|
||||
for (const chunk of outputChunk.split(`\n`)) {
|
||||
// check if log start included in logs if so log a message
|
||||
if (chunk.includes(`Collected Logs`)) {
|
||||
CloudRunnerLogger.log(`Log Start found in logs`);
|
||||
}
|
||||
if (chunk.includes(`LOGHASH:`)) {
|
||||
RemoteClientLogger.HandleLogHash(chunk);
|
||||
CloudRunnerLogger.log(`Loghash found`);
|
||||
}
|
||||
if (chunk.includes(`LOGS:`)) {
|
||||
CloudRunnerLogger.log(`LOGS: found`);
|
||||
|
||||
// remove "LOGS: " and decode base64 remaining
|
||||
const unpacked = Buffer.from(chunk.split(`LOGS: `)[1], 'base64').toString('ascii');
|
||||
const result = RemoteClientLogger.HandleLogFull(unpacked);
|
||||
CloudRunnerLogger.log(`Logs found HandleLogChunkLineResult:${result}`);
|
||||
if (result) {
|
||||
FollowLogStreamService.DidReceiveEndOfTransmission = true;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
({ shouldReadLogs, shouldCleanup, output } = FollowLogStreamService.handleIteration(
|
||||
chunk,
|
||||
shouldReadLogs,
|
||||
|
@ -3,7 +3,6 @@ import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import CloudRunner from '../cloud-runner';
|
||||
import CloudRunnerOptions from '../options/cloud-runner-options';
|
||||
import * as md5 from 'ts-md5';
|
||||
|
||||
export class RemoteClientLogger {
|
||||
private static get LogFilePath() {
|
||||
@ -71,44 +70,13 @@ export class RemoteClientLogger {
|
||||
// }
|
||||
}
|
||||
public static HandleLog(message: string): boolean {
|
||||
if (message.includes('LOGHASH: ')) {
|
||||
RemoteClientLogger.HandleLogHash(message);
|
||||
} else {
|
||||
if (RemoteClientLogger.value !== '') {
|
||||
RemoteClientLogger.value += `\n`;
|
||||
}
|
||||
|
||||
RemoteClientLogger.value += message;
|
||||
const hashedValue = md5.Md5.hashStr(RemoteClientLogger.value);
|
||||
if (RemoteClientLogger.md5 === hashedValue) {
|
||||
CloudRunnerLogger.log(`LOG COMPLETE`);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public static HandleLogHash(message: string) {
|
||||
if (message.includes('LOGHASH: ')) {
|
||||
RemoteClientLogger.md5 = message.split(`LOGHASH: `)[1];
|
||||
CloudRunnerLogger.log(`LOGHASH: ${RemoteClientLogger.md5}`);
|
||||
} else {
|
||||
throw new Error(`LOGHASH: not found`);
|
||||
}
|
||||
}
|
||||
public static HandleLogFull(message: string): boolean {
|
||||
const hashedValue = md5.Md5.hashStr(message);
|
||||
if (RemoteClientLogger.md5 === hashedValue) {
|
||||
CloudRunnerLogger.log(`LOG COMPLETE`);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
CloudRunnerLogger.log(`LOG INCOMPLETE ${RemoteClientLogger.md5} ${hashedValue}`);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
static value: string = '';
|
||||
static md5: any;
|
||||
}
|
||||
|
@ -1,25 +0,0 @@
|
||||
import { RemoteClientLogger } from '../../remote-client/remote-client-logger';
|
||||
import setups from '../cloud-runner-suite.test';
|
||||
const md5 = require('md5');
|
||||
|
||||
describe('Cloud Runner Remote Client', () => {
|
||||
it('Responds', () => {});
|
||||
setups();
|
||||
it('Loghash digestion input matches output', async () => {
|
||||
const testLogStream = 'Test \n Log \n Stream';
|
||||
|
||||
const splitLogStream = testLogStream.split('\n');
|
||||
RemoteClientLogger.HandleLog(`LOGHASH: ${md5(testLogStream)}`);
|
||||
let completed = false;
|
||||
for (const element of splitLogStream) {
|
||||
completed = RemoteClientLogger.HandleLog(element);
|
||||
}
|
||||
expect(completed).toBeTruthy();
|
||||
}, 1_000_000_000);
|
||||
// eslint-disable-next-line unicorn/consistent-function-scoping, no-unused-vars
|
||||
function CreateLogWatcher(callback: (finalMessage: string) => void) {
|
||||
return (message: string) => {
|
||||
callback(message);
|
||||
};
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user