Skip to content

Commit

Permalink
no wait, just repeat logs
Browse files Browse the repository at this point in the history
  • Loading branch information
frostebite committed Aug 15, 2023
1 parent a31896b commit eba396b
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 14 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cloud-runner-ci-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ jobs:
- 'cloud-runner-end2end-locking'
- 'cloud-runner-end2end-caching'
- 'cloud-runner-end2end-retaining'
- 'cloud-runner-end2end-kubernetes'
- 'cloud-runner-environment'
- 'cloud-runner-github-checks'
steps:
Expand Down
14 changes: 8 additions & 6 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class KubernetesTaskRunner {
`Streaming logs from pod: ${podName} container: ${containerName} namespace: ${namespace} ${CloudRunner.buildParameters.kubeVolumeSize}/${CloudRunner.buildParameters.containerCpu}/${CloudRunner.buildParameters.containerMemory}\n${lastReceivedMessage}`,
);
if (KubernetesTaskRunner.lastReceivedTimestamp > 0) {
CloudRunnerLogger.log(`Last received timestamp was set, including --since-time parameter`);
const currentDate = new Date(KubernetesTaskRunner.lastReceivedTimestamp);
const dateTimeIsoString = currentDate.toISOString();
sinceTime = ` --since-time="${dateTimeIsoString}"`;
Expand Down
17 changes: 10 additions & 7 deletions src/model/cloud-runner/remote-client/remote-client-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ export class RemoteClientLogger {

hashedLogs = await await CloudRunnerSystem.Run(`md5sum ${RemoteClientLogger.LogFilePath}`);

CloudRunnerLogger.log(`LOGHASH: ${hashedLogs}`);
const logs = fs.readFileSync(RemoteClientLogger.LogFilePath).toString();
CloudRunnerLogger.log(logs);

// loop for 5 mins logging the logs every minute
for (let index = 0; index < 2; index++) {
CloudRunnerLogger.log(logs);
for (let index = 0; index < 3; index++) {
CloudRunnerLogger.log(`LOGHASH: ${hashedLogs}`);
const logs = fs.readFileSync(RemoteClientLogger.LogFilePath).toString();
CloudRunnerLogger.log(`LOGS: ${Buffer.from(logs).toString('base64')}`);
CloudRunnerLogger.log(
`Game CI's "Cloud Runner System" will cancel the log when it has successfully received the log data to verify all logs have been received.`,
);

// wait for 15 seconds to allow the log to be sent
await new Promise((resolve) => setTimeout(resolve, 15000));
}
}
}
51 changes: 51 additions & 0 deletions src/model/cloud-runner/tests/e2e/cloud-runner-kubernetes.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import CloudRunner from '../../cloud-runner';
import UnityVersioning from '../../../unity-versioning';
import { Cli } from '../../../cli/cli';
import CloudRunnerLogger from '../../services/core/cloud-runner-logger';
import { v4 as uuidv4 } from 'uuid';
import CloudRunnerOptions from '../../options/cloud-runner-options';
import setups from '../cloud-runner-suite.test';
import BuildParameters from '../../../build-parameters';
import ImageTag from '../../../image-tag';

async function CreateParameters(overrides: any) {
if (overrides) {
Cli.options = overrides;
}

return await BuildParameters.create();
}

describe('Cloud Runner Kubernetes', () => {
it('Responds', () => {});
setups();
if (CloudRunnerOptions.cloudRunnerDebug) {
it('Run one build it using K8s without error', async () => {
if (CloudRunnerOptions.providerStrategy !== `k8s`) {
return;
}
const overrides = {
versioning: 'None',
projectPath: 'test-project',
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
targetPlatform: 'StandaloneLinux64',
cacheKey: `test-case-${uuidv4()}`,
containerHookFiles: `debug-cache`,
};
const buildParameter = await CreateParameters(overrides);
expect(buildParameter.projectPath).toEqual(overrides.projectPath);

const baseImage = new ImageTag(buildParameter);
const results = await CloudRunner.run(buildParameter, baseImage.toString());
const libraryString = 'Rebuilding Library because the asset database could not be found!';
const cachePushFail = 'Did not push source folder to cache because it was empty Library';
const buildSucceededString = 'Build succeeded';

expect(results).toContain(libraryString);
expect(results).toContain(buildSucceededString);
expect(results).not.toContain(cachePushFail);

CloudRunnerLogger.log(`run 1 succeeded`);
}, 1_000_000_000);
}
});

0 comments on commit eba396b

Please sign in to comment.