Custom step file support

pull/437/head
Frostebite 2022-10-08 01:07:53 +01:00
parent f5faae57d3
commit 820a7e7900
3 changed files with 26 additions and 17 deletions

21
dist/index.js vendored
View File

@ -4430,16 +4430,21 @@ class CloudRunnerCustomSteps {
static GetCustomStepsFromFiles(hookLifecycle) {
const results = [];
remote_client_logger_1.RemoteClientLogger.log(`GetCustomStepFiles: ${hookLifecycle}`);
const gameCiCustomStepsPath = path_1.default.join(process.cwd(), `game-ci`, `steps`);
const files = fs.readdirSync(gameCiCustomStepsPath);
for (const file of files) {
const fileContents = fs.readFileSync(path_1.default.join(gameCiCustomStepsPath, file), `utf8`);
const fileContentsObject = yaml_1.default.parse(fileContents.toString());
if (fileContentsObject.hook === hookLifecycle) {
remote_client_logger_1.RemoteClientLogger.log(`Active Step File ${file} contents: ${fileContents}`);
results.push(...CloudRunnerCustomSteps.ParseSteps(fileContents));
try {
const gameCiCustomStepsPath = path_1.default.join(process.cwd(), `game-ci`, `steps`);
const files = fs.readdirSync(gameCiCustomStepsPath);
for (const file of files) {
const fileContents = fs.readFileSync(path_1.default.join(gameCiCustomStepsPath, file), `utf8`);
const fileContentsObject = yaml_1.default.parse(fileContents.toString());
if (fileContentsObject.hook === hookLifecycle) {
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;
}
static ParseSteps(steps) {

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -13,15 +13,19 @@ export class CloudRunnerCustomSteps {
static GetCustomStepsFromFiles(hookLifecycle: string): CustomStep[] {
const results: CustomStep[] = [];
RemoteClientLogger.log(`GetCustomStepFiles: ${hookLifecycle}`);
const gameCiCustomStepsPath = path.join(process.cwd(), `game-ci`, `steps`);
const files = fs.readdirSync(gameCiCustomStepsPath);
for (const file of files) {
const fileContents = fs.readFileSync(path.join(gameCiCustomStepsPath, file), `utf8`);
const fileContentsObject = YAML.parse(fileContents.toString());
if (fileContentsObject.hook === hookLifecycle) {
RemoteClientLogger.log(`Active Step File ${file} contents: ${fileContents}`);
results.push(...CloudRunnerCustomSteps.ParseSteps(fileContents));
try {
const gameCiCustomStepsPath = path.join(process.cwd(), `game-ci`, `steps`);
const files = fs.readdirSync(gameCiCustomStepsPath);
for (const file of files) {
const fileContents = fs.readFileSync(path.join(gameCiCustomStepsPath, file), `utf8`);
const fileContentsObject = YAML.parse(fileContents.toString());
if (fileContentsObject.hook === hookLifecycle) {
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;