Custom step file support

pull/437/head
Frostebite 2022-10-08 02:50:58 +01:00
parent a807b8dff6
commit 5cc23daf7c
4 changed files with 13 additions and 4 deletions

3
dist/index.js vendored
View File

@ -4460,10 +4460,11 @@ class CloudRunnerCustomSteps {
});
}
static ParseSteps(steps) {
var _a;
if (steps === '') {
return [];
}
if (cloud_runner_1.default.buildParameters.cloudRunnerIntegrationTests) {
if ((_a = cloud_runner_1.default.buildParameters) === null || _a === void 0 ? void 0 : _a.cloudRunnerIntegrationTests) {
cloud_runner_logger_1.default.log(`Parsing build steps: ${steps}`);
}
const isArray = steps[0] === `-`;

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -48,7 +48,7 @@ export class CloudRunnerCustomSteps {
if (steps === '') {
return [];
}
if (CloudRunner.buildParameters.cloudRunnerIntegrationTests) {
if (CloudRunner.buildParameters?.cloudRunnerIntegrationTests) {
CloudRunnerLogger.log(`Parsing build steps: ${steps}`);
}
const isArray = steps[0] === `-`;

View File

@ -20,7 +20,15 @@ describe('Cloud Runner Custom Hooks', () => {
it('Responds', () => {});
setups();
it('Check for pre and post custom hooks run contents', async () => {
CloudRunnerLogger.log(JSON.stringify(CloudRunnerCustomSteps.GetCustomStepsFromFiles(`before`), undefined, 4));
const yamlString = `hook: before
commands: echo "test"`;
const stringObject = CloudRunnerCustomSteps.ParseSteps(yamlString);
const getCustomStepsFromFiles = CloudRunnerCustomSteps.GetCustomStepsFromFiles(`before`);
CloudRunnerLogger.log(yamlString);
CloudRunnerLogger.log(JSON.stringify(stringObject, undefined, 4));
CloudRunnerLogger.log(JSON.stringify(getCustomStepsFromFiles, undefined, 4));
expect(stringObject.length).toBe(1);
expect(stringObject[0].hook).toBe(`before`);
});
if (CloudRunnerOptions.cloudRunnerTests && CloudRunnerOptions.cloudRunnerCluster !== `k8s`) {
it('Check for pre and post custom hooks run contents', async () => {