Skip to content

Commit 3efb36b

Browse files
committed
chore: update version to 1.13.0-beta-2 in package.json and package-lock.json; add error handling in deployment status processing
1 parent 3d00862 commit 3efb36b

File tree

6 files changed

+57
-29
lines changed

6 files changed

+57
-29
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.13.0-beta-1",
3+
"version": "1.13.0-beta-2",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/AppStatusModal/AppStatusBody.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ export const AppStatusBody = ({
184184
deploymentStatusDetailsBreakdownData={deploymentStatusDetailsBreakdownData}
185185
isVirtualEnvironment={appDetails.isVirtualEnvironment}
186186
appDetails={appDetails}
187+
rootClassName="pb-20"
187188
/>
188189
)}
189190
</div>

src/Shared/Components/CICDHistory/DeploymentStatusBreakdown.tsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { Fragment } from 'react'
18+
1719
import { TIMELINE_STATUS } from '@Shared/types'
1820

21+
import { InfoBlock } from '../InfoBlock'
1922
import { DeploymentStatusDetailRow } from './DeploymentStatusDetailRow'
2023
import { DeploymentStatusDetailBreakdownType, DeploymentStatusDetailRowType } from './types'
2124

@@ -59,11 +62,21 @@ const DeploymentStatusDetailBreakdown = ({
5962
TIMELINE_STATUS.KUBECTL_APPLY,
6063
] as DeploymentStatusDetailRowType['type'][]
6164
).map((timelineStatus) => (
62-
<DeploymentStatusDetailRow
63-
key={timelineStatus}
64-
type={timelineStatus}
65-
{...deploymentStatusDetailRowProps}
66-
/>
65+
<Fragment key={timelineStatus}>
66+
{deploymentStatusDetailsBreakdownData.errorBarConfig?.nextTimelineToProcess ===
67+
timelineStatus && (
68+
<>
69+
<InfoBlock
70+
variant="error"
71+
description={
72+
deploymentStatusDetailsBreakdownData.errorBarConfig.deploymentErrorMessage
73+
}
74+
/>
75+
<div className="vertical-connector" />
76+
</>
77+
)}
78+
<DeploymentStatusDetailRow type={timelineStatus} {...deploymentStatusDetailRowProps} />
79+
</Fragment>
6780
))}
6881

6982
<DeploymentStatusDetailRow

src/Shared/Components/DeploymentStatusBreakdown/utils.tsx

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,16 @@ const getDefaultDeploymentStatusTimeline = (
3535
isCollapsed: true,
3636
}
3737

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+
3846
return {
39-
deploymentStatus: WFR_STATUS_DTO_TO_DEPLOYMENT_STATUS_MAP[data?.wfrStatus] || DEPLOYMENT_STATUS.INPROGRESS,
47+
deploymentStatus,
4048
deploymentTriggerTime: data?.deploymentStartedOn || '',
4149
deploymentEndTime: data?.deploymentFinishedOn || '',
4250
triggeredBy: data?.triggeredBy || '',
@@ -65,6 +73,12 @@ const getDefaultDeploymentStatusTimeline = (
6573
displayText: 'Propagate manifest to Kubernetes resources',
6674
},
6775
},
76+
errorBarConfig: deploymentErrorMessage
77+
? {
78+
deploymentErrorMessage,
79+
nextTimelineToProcess: TIMELINE_STATUS.GIT_COMMIT,
80+
}
81+
: null,
6882
}
6983
}
7084

@@ -85,9 +99,7 @@ const getPredicate =
8599
return timelineItem.status.includes(TIMELINE_STATUS.KUBECTL_APPLY)
86100

87101
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)
91103

92104
default:
93105
return false
@@ -247,6 +259,7 @@ export const processDeploymentStatusDetailsData = (
247259
}
248260

249261
const isProgressing = PROGRESSING_DEPLOYMENT_STATUS.includes(deploymentStatus)
262+
const hasDeploymentFailed = deploymentStatus === DEPLOYMENT_STATUS.FAILED
250263
// This key will be used since argocd sync is manual or auto based on flag on BE.
251264
// And in old data as well this timeline won't be present so in KUBECTL_APPLY timeline we will set the icon to success
252265
const isArgoCDSyncAvailable = data.timelines.some((timeline) =>
@@ -255,7 +268,6 @@ export const processDeploymentStatusDetailsData = (
255268

256269
PHYSICAL_ENV_DEPLOYMENT_TIMELINE_ORDER.forEach((timelineStatusType, index) => {
257270
const element = findRight(data.timelines, getPredicate(timelineStatusType))
258-
259271
const timelineData = deploymentData.deploymentStatusBreakdown[timelineStatusType]
260272

261273
if (!element) {
@@ -265,6 +277,7 @@ export const processDeploymentStatusDetailsData = (
265277
timelineData.displaySubText = 'Waiting'
266278
}
267279

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
268281
if (isProgressing && timelineStatusType === TIMELINE_STATUS.KUBECTL_APPLY) {
269282
timelineData.subSteps = [
270283
{ icon: '', message: 'Waiting to be started by Argo CD' },
@@ -273,9 +286,13 @@ export const processDeploymentStatusDetailsData = (
273286
timelineData.isCollapsed = false
274287
}
275288

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'
279296
}
280297

281298
if (
@@ -291,7 +308,6 @@ export const processDeploymentStatusDetailsData = (
291308
statusFetchCount: data?.statusFetchCount,
292309
})
293310
}
294-
295311
return
296312
}
297313

@@ -327,18 +343,8 @@ export const processDeploymentStatusDetailsData = (
327343

328344
case TIMELINE_STATUS.APP_HEALTH:
329345
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'
342348
break
343349

344350
default:
@@ -350,6 +356,10 @@ export const processDeploymentStatusDetailsData = (
350356
const nextTimelineStatus = PHYSICAL_ENV_DEPLOYMENT_TIMELINE_ORDER[index + 1]
351357
const nextTimeline = deploymentData.deploymentStatusBreakdown[nextTimelineStatus]
352358

359+
if (deploymentData.errorBarConfig) {
360+
deploymentData.errorBarConfig.nextTimelineToProcess = nextTimelineStatus
361+
}
362+
353363
nextTimeline.icon = 'inprogress'
354364
nextTimeline.displaySubText = 'In progress'
355365
}

src/Shared/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,6 +1274,10 @@ export interface DeploymentStatusDetailsBreakdownDataType {
12741274
deploymentEndTime: string
12751275
triggeredBy: string
12761276
deploymentStatusBreakdown: Partial<Record<DeploymentStatusTimelineType, DeploymentStatusBreakdownItemType>>
1277+
errorBarConfig?: {
1278+
deploymentErrorMessage: string
1279+
nextTimelineToProcess: DeploymentStatusTimelineType
1280+
} | null
12771281
}
12781282

12791283
export interface IntelligenceConfig {

0 commit comments

Comments
 (0)