2023-03-27 11:14:23 +00:00
|
|
|
import CloudRunner from '../../cloud-runner';
|
|
|
|
import { ImageTag } from '../../..';
|
|
|
|
import UnityVersioning from '../../../unity-versioning';
|
|
|
|
import CloudRunnerLogger from '../../services/core/cloud-runner-logger';
|
2022-11-07 20:41:00 +00:00
|
|
|
import { v4 as uuidv4 } from 'uuid';
|
2023-03-27 11:14:23 +00:00
|
|
|
import CloudRunnerOptions from '../../options/cloud-runner-options';
|
|
|
|
import setups from './../cloud-runner-suite.test';
|
|
|
|
import * as fs from 'node:fs';
|
2023-03-04 00:25:40 +00:00
|
|
|
import path from 'node:path';
|
2023-03-27 11:14:23 +00:00
|
|
|
import { CloudRunnerFolders } from '../../options/cloud-runner-folders';
|
|
|
|
import SharedWorkspaceLocking from '../../services/core/shared-workspace-locking';
|
|
|
|
import { CreateParameters } from '../create-test-parameter';
|
|
|
|
import { CloudRunnerSystem } from '../../services/core/cloud-runner-system';
|
2022-11-07 20:41:00 +00:00
|
|
|
|
|
|
|
describe('Cloud Runner Retain Workspace', () => {
|
|
|
|
it('Responds', () => {});
|
|
|
|
setups();
|
|
|
|
if (CloudRunnerOptions.cloudRunnerDebug) {
|
|
|
|
it('Run one build it should not already be retained, run subsequent build which should use retained workspace', async () => {
|
|
|
|
const overrides = {
|
|
|
|
versioning: 'None',
|
|
|
|
projectPath: 'test-project',
|
|
|
|
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
|
|
|
|
targetPlatform: 'StandaloneLinux64',
|
|
|
|
cacheKey: `test-case-${uuidv4()}`,
|
2023-03-27 11:14:23 +00:00
|
|
|
maxRetainedWorkspaces: 1,
|
2022-11-07 20:41:00 +00:00
|
|
|
};
|
|
|
|
const buildParameter = await CreateParameters(overrides);
|
|
|
|
expect(buildParameter.projectPath).toEqual(overrides.projectPath);
|
|
|
|
|
|
|
|
const baseImage = new ImageTag(buildParameter);
|
2024-01-11 20:19:13 +00:00
|
|
|
const resultsObject = await CloudRunner.run(buildParameter, baseImage.toString());
|
|
|
|
const results = resultsObject.BuildResults;
|
2022-11-07 20:41:00 +00:00
|
|
|
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);
|
|
|
|
|
2023-03-27 11:14:23 +00:00
|
|
|
if (CloudRunnerOptions.providerStrategy === `local-docker`) {
|
Cloud runner develop - better parameterization of s3 usage, improved async workflow and GC, github checks early integration (#479)
* custom steps may leave value undefined, will be pulled from env vars
* custom steps may leave value undefined, will be pulled from env vars
* custom steps may leave value undefined, will be pulled from env vars
* add 3 new premade steps, steam-deploy-client, steam-deploy-project, aws-s3-pull-build
* fix
* fix
* fix
* continue building async-workflow support
* test checks
* test checks
* test checks
* move github checks within build workflow
* async workflow test
* async workflow test
* async workflow test
* async workflow test
* async workflow test
* async workflow test
* async workflow test
* async workflow test for aws only
* async workflow test for aws only
* async workflow test for aws only
* async workflow test for aws only
* cleanup logging
* disable lz4 compression by default
* disable lz4 compression by default
* AWS BASE STACK for tests
* AWS BASE STACK for tests
* AWS BASE STACK for tests
* AWS BASE STACK for tests
* AWS BASE STACK for tests
* AWS BASE STACK for tests
* disable lz4 compression by default
* disable lz4 compression by default
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* workflow
* workflow
* workflow
* workflow
* workflow
* workflow
* workflow
* workflow
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
2023-01-20 17:40:57 +00:00
|
|
|
const cacheFolderExists = fs.existsSync(`cloud-runner-cache/cache/${overrides.cacheKey}`);
|
|
|
|
expect(cacheFolderExists).toBeTruthy();
|
2023-03-27 11:14:23 +00:00
|
|
|
await CloudRunnerSystem.Run(`tree -d ./cloud-runner-cache`);
|
Cloud runner develop - better parameterization of s3 usage, improved async workflow and GC, github checks early integration (#479)
* custom steps may leave value undefined, will be pulled from env vars
* custom steps may leave value undefined, will be pulled from env vars
* custom steps may leave value undefined, will be pulled from env vars
* add 3 new premade steps, steam-deploy-client, steam-deploy-project, aws-s3-pull-build
* fix
* fix
* fix
* continue building async-workflow support
* test checks
* test checks
* test checks
* move github checks within build workflow
* async workflow test
* async workflow test
* async workflow test
* async workflow test
* async workflow test
* async workflow test
* async workflow test
* async workflow test for aws only
* async workflow test for aws only
* async workflow test for aws only
* async workflow test for aws only
* cleanup logging
* disable lz4 compression by default
* disable lz4 compression by default
* AWS BASE STACK for tests
* AWS BASE STACK for tests
* AWS BASE STACK for tests
* AWS BASE STACK for tests
* AWS BASE STACK for tests
* AWS BASE STACK for tests
* disable lz4 compression by default
* disable lz4 compression by default
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* Update github check with aws log
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* kinesis and subscription filter for logs creation skipped when watchToEnd false
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* cleanup local pipeline, log aws formation
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* async pipeline
* workflow
* workflow
* workflow
* workflow
* workflow
* workflow
* workflow
* workflow
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
* parameterize s3
2023-01-20 17:40:57 +00:00
|
|
|
}
|
|
|
|
|
2022-11-07 20:41:00 +00:00
|
|
|
CloudRunnerLogger.log(`run 1 succeeded`);
|
2023-03-27 11:14:23 +00:00
|
|
|
|
|
|
|
// await CloudRunnerSystem.Run(`tree -d ./cloud-runner-cache/${}`);
|
2022-11-07 20:41:00 +00:00
|
|
|
const buildParameter2 = await CreateParameters(overrides);
|
|
|
|
|
|
|
|
buildParameter2.cacheKey = buildParameter.cacheKey;
|
|
|
|
const baseImage2 = new ImageTag(buildParameter2);
|
2024-01-11 18:08:10 +00:00
|
|
|
const results2Object = await CloudRunner.run(buildParameter2, baseImage2.toString());
|
|
|
|
const results2 = results2Object.BuildResults;
|
2022-11-07 20:41:00 +00:00
|
|
|
CloudRunnerLogger.log(`run 2 succeeded`);
|
|
|
|
|
|
|
|
const build2ContainsCacheKey = results2.includes(buildParameter.cacheKey);
|
|
|
|
const build2ContainsBuildGuid1FromRetainedWorkspace = results2.includes(buildParameter.buildGuid);
|
|
|
|
const build2ContainsRetainedWorkspacePhrase = results2.includes(`Retained Workspace:`);
|
|
|
|
const build2ContainsWorkspaceExistsAlreadyPhrase = results2.includes(`Retained Workspace Already Exists!`);
|
|
|
|
const build2ContainsBuildSucceeded = results2.includes(buildSucceededString);
|
2024-01-07 19:00:48 +00:00
|
|
|
const build2NotContainsNoLibraryMessage = !results2.split('Activation successful')[1].includes(libraryString);
|
2022-11-07 20:41:00 +00:00
|
|
|
const build2NotContainsZeroLibraryCacheFilesMessage = !results2.includes(
|
|
|
|
'There is 0 files/dir in the cache pulled contents for Library',
|
|
|
|
);
|
|
|
|
const build2NotContainsZeroLFSCacheFilesMessage = !results2.includes(
|
|
|
|
'There is 0 files/dir in the cache pulled contents for LFS',
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(build2ContainsCacheKey).toBeTruthy();
|
|
|
|
expect(build2ContainsRetainedWorkspacePhrase).toBeTruthy();
|
|
|
|
expect(build2ContainsWorkspaceExistsAlreadyPhrase).toBeTruthy();
|
|
|
|
expect(build2ContainsBuildGuid1FromRetainedWorkspace).toBeTruthy();
|
|
|
|
expect(build2ContainsBuildSucceeded).toBeTruthy();
|
|
|
|
expect(build2NotContainsZeroLibraryCacheFilesMessage).toBeTruthy();
|
|
|
|
expect(build2NotContainsZeroLFSCacheFilesMessage).toBeTruthy();
|
|
|
|
expect(build2NotContainsNoLibraryMessage).toBeTruthy();
|
|
|
|
}, 1_000_000_000);
|
|
|
|
afterAll(async () => {
|
|
|
|
await SharedWorkspaceLocking.CleanupWorkspace(CloudRunner.lockedWorkspace || ``, CloudRunner.buildParameters);
|
|
|
|
if (
|
|
|
|
fs.existsSync(`./cloud-runner-cache/${path.basename(CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute)}`)
|
|
|
|
) {
|
|
|
|
CloudRunnerLogger.log(
|
|
|
|
`Cleaning up ./cloud-runner-cache/${path.basename(CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute)}`,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|