@@ -35,8 +35,16 @@ const getDefaultDeploymentStatusTimeline = (
35
35
isCollapsed : true ,
36
36
}
37
37
38
+ const deploymentStatus = WFR_STATUS_DTO_TO_DEPLOYMENT_STATUS_MAP [ data ?. wfrStatus ] || DEPLOYMENT_STATUS . INPROGRESS
39
+ // Incase of git commit failed or argocd sync failed, DEPLOYMENT_STATUS.FAILED won't come from BE
40
+ const deploymentErrorMessage =
41
+ deploymentStatus === DEPLOYMENT_STATUS . FAILED
42
+ ? data ?. timelines ?. find ( ( timeline ) => timeline . status === TIMELINE_STATUS . DEPLOYMENT_FAILED )
43
+ ?. statusDetail || ''
44
+ : ''
45
+
38
46
return {
39
- deploymentStatus : WFR_STATUS_DTO_TO_DEPLOYMENT_STATUS_MAP [ data ?. wfrStatus ] || DEPLOYMENT_STATUS . INPROGRESS ,
47
+ deploymentStatus,
40
48
deploymentTriggerTime : data ?. deploymentStartedOn || '' ,
41
49
deploymentEndTime : data ?. deploymentFinishedOn || '' ,
42
50
triggeredBy : data ?. triggeredBy || '' ,
@@ -65,6 +73,12 @@ const getDefaultDeploymentStatusTimeline = (
65
73
displayText : 'Propagate manifest to Kubernetes resources' ,
66
74
} ,
67
75
} ,
76
+ errorBarConfig : deploymentErrorMessage
77
+ ? {
78
+ deploymentErrorMessage,
79
+ nextTimelineToProcess : TIMELINE_STATUS . GIT_COMMIT ,
80
+ }
81
+ : null ,
68
82
}
69
83
}
70
84
@@ -85,9 +99,7 @@ const getPredicate =
85
99
return timelineItem . status . includes ( TIMELINE_STATUS . KUBECTL_APPLY )
86
100
87
101
case TIMELINE_STATUS . APP_HEALTH :
88
- return [ TIMELINE_STATUS . HEALTHY , TIMELINE_STATUS . DEGRADED , TIMELINE_STATUS . DEPLOYMENT_FAILED ] . includes (
89
- timelineItem . status ,
90
- )
102
+ return [ TIMELINE_STATUS . HEALTHY , TIMELINE_STATUS . DEGRADED ] . includes ( timelineItem . status )
91
103
92
104
default :
93
105
return false
@@ -247,6 +259,7 @@ export const processDeploymentStatusDetailsData = (
247
259
}
248
260
249
261
const isProgressing = PROGRESSING_DEPLOYMENT_STATUS . includes ( deploymentStatus )
262
+ const hasDeploymentFailed = deploymentStatus === DEPLOYMENT_STATUS . FAILED
250
263
// This key will be used since argocd sync is manual or auto based on flag on BE.
251
264
// And in old data as well this timeline won't be present so in KUBECTL_APPLY timeline we will set the icon to success
252
265
const isArgoCDSyncAvailable = data . timelines . some ( ( timeline ) =>
@@ -255,7 +268,6 @@ export const processDeploymentStatusDetailsData = (
255
268
256
269
PHYSICAL_ENV_DEPLOYMENT_TIMELINE_ORDER . forEach ( ( timelineStatusType , index ) => {
257
270
const element = findRight ( data . timelines , getPredicate ( timelineStatusType ) )
258
-
259
271
const timelineData = deploymentData . deploymentStatusBreakdown [ timelineStatusType ]
260
272
261
273
if ( ! element ) {
@@ -265,6 +277,7 @@ export const processDeploymentStatusDetailsData = (
265
277
timelineData . displaySubText = 'Waiting'
266
278
}
267
279
280
+ // We don't even need to clean this in final loop since deployment status won't be in progress if next timeline is progressing
268
281
if ( isProgressing && timelineStatusType === TIMELINE_STATUS . KUBECTL_APPLY ) {
269
282
timelineData . subSteps = [
270
283
{ icon : '' , message : 'Waiting to be started by Argo CD' } ,
@@ -273,9 +286,13 @@ export const processDeploymentStatusDetailsData = (
273
286
timelineData . isCollapsed = false
274
287
}
275
288
276
- if ( deploymentStatus === DEPLOYMENT_STATUS . FAILED ) {
277
- timelineData . displaySubText = ''
278
- timelineData . icon = 'unreachable'
289
+ if ( hasDeploymentFailed ) {
290
+ const hasCurrentTimelineFailed =
291
+ timelineStatusType === TIMELINE_STATUS . APP_HEALTH &&
292
+ deploymentData . deploymentStatusBreakdown . KUBECTL_APPLY . icon === 'success'
293
+
294
+ timelineData . displaySubText = hasCurrentTimelineFailed ? 'Failed' : ''
295
+ timelineData . icon = hasCurrentTimelineFailed ? 'failed' : 'unreachable'
279
296
}
280
297
281
298
if (
@@ -291,7 +308,6 @@ export const processDeploymentStatusDetailsData = (
291
308
statusFetchCount : data ?. statusFetchCount ,
292
309
} )
293
310
}
294
-
295
311
return
296
312
}
297
313
@@ -327,18 +343,8 @@ export const processDeploymentStatusDetailsData = (
327
343
328
344
case TIMELINE_STATUS . APP_HEALTH :
329
345
timelineData . time = element . statusTime
330
- if ( element . status === TIMELINE_STATUS . DEPLOYMENT_FAILED ) {
331
- // TODO: Check why its icon is not failed in earlier implementation
332
- timelineData . icon = 'failed'
333
- timelineData . displaySubText = 'Failed'
334
- timelineData . timelineStatus = element . statusDetail
335
- break
336
- }
337
-
338
- if ( element . status === TIMELINE_STATUS . HEALTHY || element . status === TIMELINE_STATUS . DEGRADED ) {
339
- timelineData . icon = 'success'
340
- timelineData . displaySubText = element . status === TIMELINE_STATUS . HEALTHY ? '' : 'Degraded'
341
- }
346
+ timelineData . icon = 'success'
347
+ timelineData . displaySubText = element . status === TIMELINE_STATUS . HEALTHY ? '' : 'Degraded'
342
348
break
343
349
344
350
default :
@@ -350,6 +356,10 @@ export const processDeploymentStatusDetailsData = (
350
356
const nextTimelineStatus = PHYSICAL_ENV_DEPLOYMENT_TIMELINE_ORDER [ index + 1 ]
351
357
const nextTimeline = deploymentData . deploymentStatusBreakdown [ nextTimelineStatus ]
352
358
359
+ if ( deploymentData . errorBarConfig ) {
360
+ deploymentData . errorBarConfig . nextTimelineToProcess = nextTimelineStatus
361
+ }
362
+
353
363
nextTimeline . icon = 'inprogress'
354
364
nextTimeline . displaySubText = 'In progress'
355
365
}
0 commit comments