Skip to content

Commit 10b8620

Browse files
panic fixes (#6657)
1 parent 69a5263 commit 10b8620

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

pkg/appWorkflow/AppWorkflowService.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,11 @@ func (impl AppWorkflowServiceImpl) FindAppWorkflowMappingForEnv(appIds []int) (m
437437
workflowMappings := make(map[int][]bean4.AppWorkflowMappingDto)
438438
workflows := make(map[int]*bean4.AppWorkflowDto)
439439
for _, w := range appWorkflowMappings {
440+
if _, ok := pipelineMap[w.ComponentId]; !ok {
441+
impl.Logger.Warnw("pipeline not found for componentId", "componentId", w.ComponentId, "appWorkflowId", w.AppWorkflowId)
442+
// If the pipeline is not found, we skip adding this mapping as one possible reason would be pipeline have been deleted
443+
continue
444+
}
440445
if _, ok := workflows[w.AppWorkflowId]; !ok {
441446
workflows[w.AppWorkflowId] = &bean4.AppWorkflowDto{
442447
Id: w.AppWorkflowId,

pkg/pipeline/DeploymentPipelineConfigService.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,6 +1821,11 @@ func (impl *CdPipelineConfigServiceImpl) GetCdPipelinesByEnvironment(request res
18211821
}
18221822

18231823
for _, dbPipeline := range authorizedPipelines {
1824+
if _, ok := pipelineWorkflowMapping[dbPipeline.Id]; !ok {
1825+
// can be due to concurrent deletion of pipeline, app workflow mapping
1826+
impl.logger.Warnw("pipeline workflow mapping not found for pipeline", "pipelineId", dbPipeline.Id)
1827+
continue
1828+
}
18241829
var customTag *bean.CustomTagData
18251830
var customTagStage repository5.PipelineStageType
18261831
customTagPreCD := customTagMapResponse.GetCustomTagForEntityKey(pipelineConfigBean.EntityTypePreCD, strconv.Itoa(dbPipeline.Id))

0 commit comments

Comments
 (0)