pull/496/head
Frostebite 2023-02-12 05:40:05 +00:00
parent 6c47dd912a
commit 67bf2d2afd
3 changed files with 13 additions and 13 deletions

12
dist/index.js generated vendored
View File

@ -4747,7 +4747,7 @@ class CloudRunnerCustomHooks {
throw error;
}
}
return output.filter((x) => x.step !== undefined && x.hook !== undefined && x.hook.length > 0);
return output.filter((x) => x.hook !== undefined && x.hook.length > 0);
}
static GetCustomHooksFromFiles(hookLifecycle) {
const results = [];
@ -4785,15 +4785,15 @@ class CloudRunnerCustomHooks {
};
});
}
static ParseHooks(steps) {
if (steps === '') {
static ParseHooks(hooks) {
if (hooks === '') {
return [];
}
// if (CloudRunner.buildParameters?.cloudRunnerIntegrationTests) {
// CloudRunnerLogger.log(`Parsing build hooks: ${steps}`);
// }
const isArray = steps.replace(/\s/g, ``)[0] === `-`;
const object = isArray ? yaml_1.default.parse(steps) : [yaml_1.default.parse(steps)];
const isArray = hooks.replace(/\s/g, ``)[0] === `-`;
const object = isArray ? yaml_1.default.parse(hooks) : [yaml_1.default.parse(hooks)];
for (const hook of object) {
CloudRunnerCustomHooks.ConvertYamlSecrets(hook);
if (hook.secrets === undefined) {
@ -4801,7 +4801,7 @@ class CloudRunnerCustomHooks {
}
}
if (object === undefined) {
throw new Error(`Failed to parse ${steps}`);
throw new Error(`Failed to parse ${hooks}`);
}
return object;
}

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,7 @@ export class CloudRunnerCustomHooks {
}
}
return output.filter((x) => x.step !== undefined && x.hook !== undefined && x.hook.length > 0);
return output.filter((x) => x.hook !== undefined && x.hook.length > 0);
}
static GetCustomHooksFromFiles(hookLifecycle: string): Hook[] {
@ -77,8 +77,8 @@ export class CloudRunnerCustomHooks {
});
}
public static ParseHooks(steps: string): Hook[] {
if (steps === '') {
public static ParseHooks(hooks: string): Hook[] {
if (hooks === '') {
return [];
}
@ -87,8 +87,8 @@ export class CloudRunnerCustomHooks {
// CloudRunnerLogger.log(`Parsing build hooks: ${steps}`);
// }
const isArray = steps.replace(/\s/g, ``)[0] === `-`;
const object: Hook[] = isArray ? YAML.parse(steps) : [YAML.parse(steps)];
const isArray = hooks.replace(/\s/g, ``)[0] === `-`;
const object: Hook[] = isArray ? YAML.parse(hooks) : [YAML.parse(hooks)];
for (const hook of object) {
CloudRunnerCustomHooks.ConvertYamlSecrets(hook);
if (hook.secrets === undefined) {
@ -96,7 +96,7 @@ export class CloudRunnerCustomHooks {
}
}
if (object === undefined) {
throw new Error(`Failed to parse ${steps}`);
throw new Error(`Failed to parse ${hooks}`);
}
return object;