pipeline improvements
parent
6def7d36ae
commit
ffeb59ea3d
|
|
@ -4757,13 +4757,13 @@ class CloudRunnerCustomHooks {
|
||||||
const results = [];
|
const results = [];
|
||||||
remote_client_logger_1.RemoteClientLogger.log(`GetCustomHookFiles: ${hookLifecycle}`);
|
remote_client_logger_1.RemoteClientLogger.log(`GetCustomHookFiles: ${hookLifecycle}`);
|
||||||
try {
|
try {
|
||||||
const gameCiCustomStepsPath = path_1.default.join(process.cwd(), `game-ci`, `hooks`);
|
const gameCiCustomHooksPath = path_1.default.join(process.cwd(), `game-ci`, `hooks`);
|
||||||
const files = fs.readdirSync(gameCiCustomStepsPath);
|
const files = fs.readdirSync(gameCiCustomHooksPath);
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
if (!cloud_runner_options_1.default.customHookFiles.includes(file.replace(`.yaml`, ``))) {
|
if (!cloud_runner_options_1.default.customHookFiles.includes(file.replace(`.yaml`, ``))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const fileContents = fs.readFileSync(path_1.default.join(gameCiCustomStepsPath, file), `utf8`);
|
const fileContents = fs.readFileSync(path_1.default.join(gameCiCustomHooksPath, file), `utf8`);
|
||||||
const fileContentsObject = CloudRunnerCustomHooks.ParseHooks(fileContents)[0];
|
const fileContentsObject = CloudRunnerCustomHooks.ParseHooks(fileContents)[0];
|
||||||
if (fileContentsObject.hook.includes(hookLifecycle)) {
|
if (fileContentsObject.hook.includes(hookLifecycle)) {
|
||||||
results.push(fileContentsObject);
|
results.push(fileContentsObject);
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -46,13 +46,13 @@ export class CloudRunnerCustomHooks {
|
||||||
const results: Hook[] = [];
|
const results: Hook[] = [];
|
||||||
RemoteClientLogger.log(`GetCustomHookFiles: ${hookLifecycle}`);
|
RemoteClientLogger.log(`GetCustomHookFiles: ${hookLifecycle}`);
|
||||||
try {
|
try {
|
||||||
const gameCiCustomStepsPath = path.join(process.cwd(), `game-ci`, `hooks`);
|
const gameCiCustomHooksPath = path.join(process.cwd(), `game-ci`, `hooks`);
|
||||||
const files = fs.readdirSync(gameCiCustomStepsPath);
|
const files = fs.readdirSync(gameCiCustomHooksPath);
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
if (!CloudRunnerOptions.customHookFiles.includes(file.replace(`.yaml`, ``))) {
|
if (!CloudRunnerOptions.customHookFiles.includes(file.replace(`.yaml`, ``))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const fileContents = fs.readFileSync(path.join(gameCiCustomStepsPath, file), `utf8`);
|
const fileContents = fs.readFileSync(path.join(gameCiCustomHooksPath, file), `utf8`);
|
||||||
const fileContentsObject = CloudRunnerCustomHooks.ParseHooks(fileContents)[0];
|
const fileContentsObject = CloudRunnerCustomHooks.ParseHooks(fileContents)[0];
|
||||||
if (fileContentsObject.hook.includes(hookLifecycle)) {
|
if (fileContentsObject.hook.includes(hookLifecycle)) {
|
||||||
results.push(fileContentsObject);
|
results.push(fileContentsObject);
|
||||||
|
|
|
||||||
|
|
@ -49,12 +49,34 @@ commands: echo "test"`;
|
||||||
});
|
});
|
||||||
if (CloudRunnerOptions.cloudRunnerDebug && CloudRunnerOptions.cloudRunnerCluster !== `k8s`) {
|
if (CloudRunnerOptions.cloudRunnerDebug && CloudRunnerOptions.cloudRunnerCluster !== `k8s`) {
|
||||||
it('Should be 1 before and 1 after hook', async () => {
|
it('Should be 1 before and 1 after hook', async () => {
|
||||||
|
const overrides = {
|
||||||
|
versioning: 'None',
|
||||||
|
projectPath: 'test-project',
|
||||||
|
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
|
||||||
|
targetPlatform: 'StandaloneLinux64',
|
||||||
|
cacheKey: `test-case-${uuidv4()}`,
|
||||||
|
customStepFiles: `my-test-step-pre-build,my-test-step-post-build`,
|
||||||
|
customHookFiles: `my-test-hook-pre-build,my-test-hook-post-build`,
|
||||||
|
};
|
||||||
|
const buildParameter2 = await CreateParameters(overrides);
|
||||||
|
await CloudRunner.setup(buildParameter2);
|
||||||
const beforeHooks = CloudRunnerCustomHooks.GetCustomHooksFromFiles(`before`);
|
const beforeHooks = CloudRunnerCustomHooks.GetCustomHooksFromFiles(`before`);
|
||||||
const afterHooks = CloudRunnerCustomHooks.GetCustomHooksFromFiles(`after`);
|
const afterHooks = CloudRunnerCustomHooks.GetCustomHooksFromFiles(`after`);
|
||||||
expect(beforeHooks).toHaveLength(1);
|
expect(beforeHooks).toHaveLength(1);
|
||||||
expect(afterHooks).toHaveLength(1);
|
expect(afterHooks).toHaveLength(1);
|
||||||
});
|
});
|
||||||
it('Should be 1 before and 1 after step', async () => {
|
it('Should be 1 before and 1 after step', async () => {
|
||||||
|
const overrides = {
|
||||||
|
versioning: 'None',
|
||||||
|
projectPath: 'test-project',
|
||||||
|
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
|
||||||
|
targetPlatform: 'StandaloneLinux64',
|
||||||
|
cacheKey: `test-case-${uuidv4()}`,
|
||||||
|
customStepFiles: `my-test-step-pre-build,my-test-step-post-build`,
|
||||||
|
customHookFiles: `my-test-hook-pre-build,my-test-hook-post-build`,
|
||||||
|
};
|
||||||
|
const buildParameter2 = await CreateParameters(overrides);
|
||||||
|
await CloudRunner.setup(buildParameter2);
|
||||||
const beforeSteps = CloudRunnerCustomSteps.GetCustomStepsFromFiles(`before`);
|
const beforeSteps = CloudRunnerCustomSteps.GetCustomStepsFromFiles(`before`);
|
||||||
const afterSteps = CloudRunnerCustomSteps.GetCustomStepsFromFiles(`after`);
|
const afterSteps = CloudRunnerCustomSteps.GetCustomStepsFromFiles(`after`);
|
||||||
expect(beforeSteps).toHaveLength(1);
|
expect(beforeSteps).toHaveLength(1);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue