@@ -106,11 +106,29 @@ func (impl *CdWorkflowRunnerReadServiceImpl) GetWfrStatusForLatestRunners(pipeli
106
106
// calculating all the pipelines not present in the index table cdWorkflowLatest
107
107
pipelinesAbsentInCache := make (map [int ][]bean2.WorkflowType )
108
108
for _ , item := range pipelines {
109
- if stages , ok := cdWorfklowLatestMap [item .Id ]; ! ok || len (stages ) == 0 {
109
+
110
+ var isPreCDConfigured , isPostCDConfigured bool
111
+ if configuredStages , ok := pipelineStageMap [item .Id ]; ok {
112
+ for _ , stage := range configuredStages {
113
+ if stage == bean2 .CD_WORKFLOW_TYPE_PRE {
114
+ isPreCDConfigured = true
115
+ } else if stage == bean2 .CD_WORKFLOW_TYPE_POST {
116
+ isPostCDConfigured = true
117
+ }
118
+ }
119
+ }
120
+
121
+ if _ , ok := cdWorfklowLatestMap [item .Id ]; ! ok {
110
122
pipelinesAbsentInCache [item .Id ] = append (pipelinesAbsentInCache [item .Id ], bean2 .CD_WORKFLOW_TYPE_PRE , bean2 .CD_WORKFLOW_TYPE_POST , bean2 .CD_WORKFLOW_TYPE_DEPLOY )
123
+ if isPreCDConfigured {
124
+ pipelinesAbsentInCache [item .Id ] = append (pipelinesAbsentInCache [item .Id ], bean2 .CD_WORKFLOW_TYPE_PRE )
125
+ }
126
+ if isPostCDConfigured {
127
+ pipelinesAbsentInCache [item .Id ] = append (pipelinesAbsentInCache [item .Id ], bean2 .CD_WORKFLOW_TYPE_POST )
128
+ }
111
129
} else {
112
130
isPreCDStageAbsent , isPostCdStageAbsent , isDeployStageAbsent := true , true , true
113
- for _ , stage := range stages {
131
+ for _ , stage := range cdWorfklowLatestMap [ item . Id ] {
114
132
switch stage {
115
133
case bean2 .CD_WORKFLOW_TYPE_PRE :
116
134
isPreCDStageAbsent = false
@@ -123,21 +141,11 @@ func (impl *CdWorkflowRunnerReadServiceImpl) GetWfrStatusForLatestRunners(pipeli
123
141
if isDeployStageAbsent {
124
142
pipelinesAbsentInCache [item .Id ] = append (pipelinesAbsentInCache [item .Id ], bean2 .CD_WORKFLOW_TYPE_DEPLOY )
125
143
}
126
- if configuredStages , ok := pipelineStageMap [item .Id ]; ok {
127
- var isPreCDConfigured , isPostCDConfigured bool
128
- for _ , stage := range configuredStages {
129
- if stage == bean2 .CD_WORKFLOW_TYPE_PRE {
130
- isPreCDConfigured = true
131
- } else if stage == bean2 .CD_WORKFLOW_TYPE_POST {
132
- isPostCDConfigured = true
133
- }
134
- }
135
- if isPreCDConfigured && isPreCDStageAbsent {
136
- pipelinesAbsentInCache [item .Id ] = append (pipelinesAbsentInCache [item .Id ], bean2 .CD_WORKFLOW_TYPE_PRE )
137
- }
138
- if isPostCDConfigured && isPostCdStageAbsent {
139
- pipelinesAbsentInCache [item .Id ] = append (pipelinesAbsentInCache [item .Id ], bean2 .CD_WORKFLOW_TYPE_POST )
140
- }
144
+ if isPreCDConfigured && isPreCDStageAbsent {
145
+ pipelinesAbsentInCache [item .Id ] = append (pipelinesAbsentInCache [item .Id ], bean2 .CD_WORKFLOW_TYPE_PRE )
146
+ }
147
+ if isPostCDConfigured && isPostCdStageAbsent {
148
+ pipelinesAbsentInCache [item .Id ] = append (pipelinesAbsentInCache [item .Id ], bean2 .CD_WORKFLOW_TYPE_POST )
141
149
}
142
150
}
143
151
}
0 commit comments