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