Skip to content

Commit b6156f0

Browse files
committed
dev testing changes
1 parent 20dc988 commit b6156f0

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

pkg/workflow/cd/read/CdWorkflowRunnerReadService.go

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,29 @@ func (impl *CdWorkflowRunnerReadServiceImpl) GetWfrStatusForLatestRunners(pipeli
106106
// calculating all the pipelines not present in the index table cdWorkflowLatest
107107
pipelinesAbsentInCache := make(map[int][]bean2.WorkflowType)
108108
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 {
110122
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+
}
111129
} else {
112130
isPreCDStageAbsent, isPostCdStageAbsent, isDeployStageAbsent := true, true, true
113-
for _, stage := range stages {
131+
for _, stage := range cdWorfklowLatestMap[item.Id] {
114132
switch stage {
115133
case bean2.CD_WORKFLOW_TYPE_PRE:
116134
isPreCDStageAbsent = false
@@ -123,21 +141,11 @@ func (impl *CdWorkflowRunnerReadServiceImpl) GetWfrStatusForLatestRunners(pipeli
123141
if isDeployStageAbsent {
124142
pipelinesAbsentInCache[item.Id] = append(pipelinesAbsentInCache[item.Id], bean2.CD_WORKFLOW_TYPE_DEPLOY)
125143
}
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)
141149
}
142150
}
143151
}

0 commit comments

Comments
 (0)