Skip to content

Commit c8b9345

Browse files
mark jobs as optional
1 parent cd4b126 commit c8b9345

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

redisinsight/api/src/modules/rdi/models/rdi-pipeline.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export enum RdiDeployStatus {
88
export class RdiPipeline {
99
// todo: defined high-level schema. not sure if we need it at all since we are not going to validate it or we are?
1010

11-
connection: unknown;
11+
config?: unknown;
1212

13-
jobs: RdiJob[];
13+
jobs?: unknown;
1414
}

redisinsight/api/src/modules/rdi/rdi-pipeline.analytics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class RdiPipelineAnalytics extends TelemetryBaseService {
2929
TelemetryEvents.RdiPipelineDeploymentSucceeded,
3030
{
3131
id,
32-
jobsNumber: Object.keys(pipeline.jobs).length,
32+
jobsNumber: pipeline.jobs ? Object.keys(pipeline.jobs).length : 0,
3333
source: 'server',
3434
},
3535
);

redisinsight/ui/src/utils/transformers/transformRdiPipeline.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ export const yamlToJson = (value: string, onError: (e: string) => void) => {
2121

2222
export const pipelineToYaml = (pipeline: IPipelineJSON) => ({
2323
config: yaml.dump(pipeline.config),
24-
jobs: Object.entries(pipeline.jobs)?.map(([key, value]) => ({
25-
name: key,
26-
value: yaml.dump(value)
27-
}))
24+
jobs: pipeline.jobs
25+
? Object.entries(pipeline?.jobs)?.map(([key, value]) => ({
26+
name: key,
27+
value: yaml.dump(value)
28+
}))
29+
: []
2830
})
2931

3032
export const pipelineToJson = ({ config, jobs }: IPipeline, onError: (errors: IYamlFormatError[]) => void) => {

0 commit comments

Comments
 (0)