File tree 1 file changed +19
-2
lines changed
packages/ui/src/views/pipeline-edit/components/graph-implementation/utils
1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,23 @@ export const yamlString2Nodes = (
29
29
return yaml2Nodes ( yamlJson , options )
30
30
}
31
31
32
+ export const processGithubJobsToStages = ( yamlJson : Record < string , any > ) => {
33
+ if ( yamlJson . jobs ) {
34
+ yamlJson . pipeline = yamlJson . pipeline || { }
35
+ yamlJson . pipeline . stages = yamlJson . pipeline . stages || [ ]
36
+
37
+ Object . entries ( yamlJson . jobs ) . forEach ( ( [ key , value ] ) => {
38
+ if ( typeof value === 'object' && value !== null ) {
39
+ yamlJson . pipeline . stages . push ( { ...value , id : key , name : key } )
40
+ }
41
+ } )
42
+
43
+ delete yamlJson . jobs
44
+ return yamlJson
45
+ }
46
+ return yamlJson
47
+ }
48
+
32
49
export const yaml2Nodes = (
33
50
yamlObject : Record < string , any > ,
34
51
options : {
@@ -37,8 +54,8 @@ export const yaml2Nodes = (
37
54
} = { }
38
55
) : AnyContainerNodeType [ ] => {
39
56
const nodes : AnyContainerNodeType [ ] = [ ]
40
-
41
- const stages = yamlObject ?. pipeline ?. stages ?? [ ]
57
+ const processedYamlObject = processGithubJobsToStages ( yamlObject )
58
+ const stages = processedYamlObject ?. pipeline ?. stages ?? [ ]
42
59
43
60
if ( stages ) {
44
61
const stagesNodes = processStages ( stages , 'pipeline.stages' , options )
You can’t perform that action at this time.
0 commit comments