Custom step file support
parent
f5faae57d3
commit
820a7e7900
|
|
@ -4430,16 +4430,21 @@ class CloudRunnerCustomSteps {
|
||||||
static GetCustomStepsFromFiles(hookLifecycle) {
|
static GetCustomStepsFromFiles(hookLifecycle) {
|
||||||
const results = [];
|
const results = [];
|
||||||
remote_client_logger_1.RemoteClientLogger.log(`GetCustomStepFiles: ${hookLifecycle}`);
|
remote_client_logger_1.RemoteClientLogger.log(`GetCustomStepFiles: ${hookLifecycle}`);
|
||||||
const gameCiCustomStepsPath = path_1.default.join(process.cwd(), `game-ci`, `steps`);
|
try {
|
||||||
const files = fs.readdirSync(gameCiCustomStepsPath);
|
const gameCiCustomStepsPath = path_1.default.join(process.cwd(), `game-ci`, `steps`);
|
||||||
for (const file of files) {
|
const files = fs.readdirSync(gameCiCustomStepsPath);
|
||||||
const fileContents = fs.readFileSync(path_1.default.join(gameCiCustomStepsPath, file), `utf8`);
|
for (const file of files) {
|
||||||
const fileContentsObject = yaml_1.default.parse(fileContents.toString());
|
const fileContents = fs.readFileSync(path_1.default.join(gameCiCustomStepsPath, file), `utf8`);
|
||||||
if (fileContentsObject.hook === hookLifecycle) {
|
const fileContentsObject = yaml_1.default.parse(fileContents.toString());
|
||||||
remote_client_logger_1.RemoteClientLogger.log(`Active Step File ${file} contents: ${fileContents}`);
|
if (fileContentsObject.hook === hookLifecycle) {
|
||||||
results.push(...CloudRunnerCustomSteps.ParseSteps(fileContents));
|
remote_client_logger_1.RemoteClientLogger.log(`Active Step File ${file} contents: ${fileContents}`);
|
||||||
|
results.push(...CloudRunnerCustomSteps.ParseSteps(fileContents));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (error) {
|
||||||
|
remote_client_logger_1.RemoteClientLogger.log(`Failed Getting: ${hookLifecycle} \n ${JSON.stringify(error, undefined, 4)}`);
|
||||||
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
static ParseSteps(steps) {
|
static ParseSteps(steps) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -13,15 +13,19 @@ export class CloudRunnerCustomSteps {
|
||||||
static GetCustomStepsFromFiles(hookLifecycle: string): CustomStep[] {
|
static GetCustomStepsFromFiles(hookLifecycle: string): CustomStep[] {
|
||||||
const results: CustomStep[] = [];
|
const results: CustomStep[] = [];
|
||||||
RemoteClientLogger.log(`GetCustomStepFiles: ${hookLifecycle}`);
|
RemoteClientLogger.log(`GetCustomStepFiles: ${hookLifecycle}`);
|
||||||
const gameCiCustomStepsPath = path.join(process.cwd(), `game-ci`, `steps`);
|
try {
|
||||||
const files = fs.readdirSync(gameCiCustomStepsPath);
|
const gameCiCustomStepsPath = path.join(process.cwd(), `game-ci`, `steps`);
|
||||||
for (const file of files) {
|
const files = fs.readdirSync(gameCiCustomStepsPath);
|
||||||
const fileContents = fs.readFileSync(path.join(gameCiCustomStepsPath, file), `utf8`);
|
for (const file of files) {
|
||||||
const fileContentsObject = YAML.parse(fileContents.toString());
|
const fileContents = fs.readFileSync(path.join(gameCiCustomStepsPath, file), `utf8`);
|
||||||
if (fileContentsObject.hook === hookLifecycle) {
|
const fileContentsObject = YAML.parse(fileContents.toString());
|
||||||
RemoteClientLogger.log(`Active Step File ${file} contents: ${fileContents}`);
|
if (fileContentsObject.hook === hookLifecycle) {
|
||||||
results.push(...CloudRunnerCustomSteps.ParseSteps(fileContents));
|
RemoteClientLogger.log(`Active Step File ${file} contents: ${fileContents}`);
|
||||||
|
results.push(...CloudRunnerCustomSteps.ParseSteps(fileContents));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
RemoteClientLogger.log(`Failed Getting: ${hookLifecycle} \n ${JSON.stringify(error, undefined, 4)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue