Custom step file support
parent
45a2ee60f0
commit
a807b8dff6
|
|
@ -4448,6 +4448,9 @@ class CloudRunnerCustomSteps {
|
|||
return results;
|
||||
}
|
||||
static ConvertYamlSecrets(object) {
|
||||
if (object.secrets === undefined) {
|
||||
return;
|
||||
}
|
||||
object.secrets = object.secrets.map((x) => {
|
||||
return {
|
||||
ParameterKey: x.name,
|
||||
|
|
@ -4460,28 +4463,21 @@ class CloudRunnerCustomSteps {
|
|||
if (steps === '') {
|
||||
return [];
|
||||
}
|
||||
let object;
|
||||
try {
|
||||
if (cloud_runner_1.default.buildParameters.cloudRunnerIntegrationTests) {
|
||||
cloud_runner_logger_1.default.log(`Parsing build steps: ${steps}`);
|
||||
}
|
||||
const isArray = steps[0] === `-`;
|
||||
object = isArray ? yaml_1.default.parse(steps) : [yaml_1.default.parse(steps)];
|
||||
if (isArray) {
|
||||
for (const step of object) {
|
||||
CloudRunnerCustomSteps.ConvertYamlSecrets(step);
|
||||
}
|
||||
}
|
||||
else {
|
||||
CloudRunnerCustomSteps.ConvertYamlSecrets(object);
|
||||
}
|
||||
if (object === undefined) {
|
||||
throw new Error(`Failed to parse ${steps}`);
|
||||
if (cloud_runner_1.default.buildParameters.cloudRunnerIntegrationTests) {
|
||||
cloud_runner_logger_1.default.log(`Parsing build steps: ${steps}`);
|
||||
}
|
||||
const isArray = steps[0] === `-`;
|
||||
const object = isArray ? yaml_1.default.parse(steps) : [yaml_1.default.parse(steps)];
|
||||
if (isArray) {
|
||||
for (const step of object) {
|
||||
CloudRunnerCustomSteps.ConvertYamlSecrets(step);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
cloud_runner_logger_1.default.log(`failed to parse a custom job "${steps} \n ${JSON.stringify(error, undefined, 4)}"`);
|
||||
throw error;
|
||||
else {
|
||||
CloudRunnerCustomSteps.ConvertYamlSecrets(object);
|
||||
}
|
||||
if (object === undefined) {
|
||||
throw new Error(`Failed to parse ${steps}`);
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -32,6 +32,9 @@ export class CloudRunnerCustomSteps {
|
|||
}
|
||||
|
||||
private static ConvertYamlSecrets(object) {
|
||||
if (object.secrets === undefined) {
|
||||
return;
|
||||
}
|
||||
object.secrets = object.secrets.map((x) => {
|
||||
return {
|
||||
ParameterKey: x.name,
|
||||
|
|
@ -45,26 +48,20 @@ export class CloudRunnerCustomSteps {
|
|||
if (steps === '') {
|
||||
return [];
|
||||
}
|
||||
let object: any;
|
||||
try {
|
||||
if (CloudRunner.buildParameters.cloudRunnerIntegrationTests) {
|
||||
CloudRunnerLogger.log(`Parsing build steps: ${steps}`);
|
||||
if (CloudRunner.buildParameters.cloudRunnerIntegrationTests) {
|
||||
CloudRunnerLogger.log(`Parsing build steps: ${steps}`);
|
||||
}
|
||||
const isArray = steps[0] === `-`;
|
||||
const object: CustomStep[] = isArray ? YAML.parse(steps) : [YAML.parse(steps)];
|
||||
if (isArray) {
|
||||
for (const step of object) {
|
||||
CloudRunnerCustomSteps.ConvertYamlSecrets(step);
|
||||
}
|
||||
const isArray = steps[0] === `-`;
|
||||
object = isArray ? YAML.parse(steps) : [YAML.parse(steps)];
|
||||
if (isArray) {
|
||||
for (const step of object) {
|
||||
CloudRunnerCustomSteps.ConvertYamlSecrets(step);
|
||||
}
|
||||
} else {
|
||||
CloudRunnerCustomSteps.ConvertYamlSecrets(object);
|
||||
}
|
||||
if (object === undefined) {
|
||||
throw new Error(`Failed to parse ${steps}`);
|
||||
}
|
||||
} catch (error) {
|
||||
CloudRunnerLogger.log(`failed to parse a custom job "${steps} \n ${JSON.stringify(error, undefined, 4)}"`);
|
||||
throw error;
|
||||
} else {
|
||||
CloudRunnerCustomSteps.ConvertYamlSecrets(object);
|
||||
}
|
||||
if (object === undefined) {
|
||||
throw new Error(`Failed to parse ${steps}`);
|
||||
}
|
||||
|
||||
return object;
|
||||
|
|
|
|||
Loading…
Reference in New Issue