-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathconstants.ts
More file actions
83 lines (70 loc) · 3.3 KB
/
constants.ts
File metadata and controls
83 lines (70 loc) · 3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import { DEPLOYMENT_STATUS } from '@Shared/constants'
import { DeploymentPhaseType, DeploymentStatusTimelineType, TIMELINE_STATUS } from '@Shared/types'
import { WorkflowRunnerStatusDTO } from './types'
export const DEPLOYMENT_STATUS_TEXT_MAP: Readonly<
Record<(typeof DEPLOYMENT_STATUS)[keyof typeof DEPLOYMENT_STATUS], string>
> = {
[DEPLOYMENT_STATUS.SUCCEEDED]: 'Succeeded',
[DEPLOYMENT_STATUS.HEALTHY]: 'Healthy',
[DEPLOYMENT_STATUS.FAILED]: 'Failed',
[DEPLOYMENT_STATUS.TIMED_OUT]: 'Timed out',
[DEPLOYMENT_STATUS.UNABLE_TO_FETCH]: 'Unable to fetch status',
[DEPLOYMENT_STATUS.INPROGRESS]: 'In progress',
[DEPLOYMENT_STATUS.PROGRESSING]: 'Progressing',
[DEPLOYMENT_STATUS.STARTING]: 'Progressing',
[DEPLOYMENT_STATUS.INITIATING]: 'Progressing',
[DEPLOYMENT_STATUS.SUPERSEDED]: 'Superseded',
[DEPLOYMENT_STATUS.QUEUED]: 'Queued',
[DEPLOYMENT_STATUS.UNKNOWN]: 'Unknown',
[DEPLOYMENT_STATUS.CHECKING]: 'Checking Status',
}
// Might be more but as per BE its only these for now
export const WFR_STATUS_DTO_TO_DEPLOYMENT_STATUS_MAP: Readonly<
Record<WorkflowRunnerStatusDTO, (typeof DEPLOYMENT_STATUS)[keyof typeof DEPLOYMENT_STATUS]>
> = {
[WorkflowRunnerStatusDTO.ABORTED]: DEPLOYMENT_STATUS.FAILED,
[WorkflowRunnerStatusDTO.FAILED]: DEPLOYMENT_STATUS.FAILED,
[WorkflowRunnerStatusDTO.TIMED_OUT]: DEPLOYMENT_STATUS.TIMED_OUT,
[WorkflowRunnerStatusDTO.UNABLE_TO_FETCH]: DEPLOYMENT_STATUS.UNABLE_TO_FETCH,
// Degraded means successful deployment
[WorkflowRunnerStatusDTO.DEGRADED]: DEPLOYMENT_STATUS.SUCCEEDED,
[WorkflowRunnerStatusDTO.HEALTHY]: DEPLOYMENT_STATUS.SUCCEEDED,
[WorkflowRunnerStatusDTO.SUCCEEDED]: DEPLOYMENT_STATUS.SUCCEEDED,
[WorkflowRunnerStatusDTO.INITIATING]: DEPLOYMENT_STATUS.INITIATING,
[WorkflowRunnerStatusDTO.STARTING]: DEPLOYMENT_STATUS.STARTING,
[WorkflowRunnerStatusDTO.PROGRESSING]: DEPLOYMENT_STATUS.INPROGRESS,
[WorkflowRunnerStatusDTO.SUSPENDED]: DEPLOYMENT_STATUS.INPROGRESS,
[WorkflowRunnerStatusDTO.QUEUED]: DEPLOYMENT_STATUS.QUEUED,
[WorkflowRunnerStatusDTO.UNKNOWN]: DEPLOYMENT_STATUS.UNABLE_TO_FETCH,
[WorkflowRunnerStatusDTO.MISSING]: DEPLOYMENT_STATUS.UNABLE_TO_FETCH,
}
export const PROGRESSING_DEPLOYMENT_STATUS: Readonly<(typeof DEPLOYMENT_STATUS)[keyof typeof DEPLOYMENT_STATUS][]> = [
DEPLOYMENT_STATUS.INPROGRESS,
DEPLOYMENT_STATUS.PROGRESSING,
DEPLOYMENT_STATUS.STARTING,
DEPLOYMENT_STATUS.INITIATING,
DEPLOYMENT_STATUS.CHECKING,
]
export const SUCCESSFUL_DEPLOYMENT_STATUS: typeof PROGRESSING_DEPLOYMENT_STATUS = [
DEPLOYMENT_STATUS.SUCCEEDED,
DEPLOYMENT_STATUS.HEALTHY,
]
export const FAILED_DEPLOYMENT_STATUS: typeof PROGRESSING_DEPLOYMENT_STATUS = [
DEPLOYMENT_STATUS.FAILED,
DEPLOYMENT_STATUS.TIMED_OUT,
DEPLOYMENT_STATUS.UNABLE_TO_FETCH,
]
export const PHYSICAL_ENV_DEPLOYMENT_TIMELINE_ORDER: Readonly<DeploymentStatusTimelineType[]> = [
TIMELINE_STATUS.DEPLOYMENT_INITIATED,
TIMELINE_STATUS.GIT_COMMIT,
TIMELINE_STATUS.ARGOCD_SYNC,
TIMELINE_STATUS.KUBECTL_APPLY,
TIMELINE_STATUS.APP_HEALTH,
]
export const DEPLOYMENT_PHASES: Readonly<DeploymentPhaseType[]> = [
DeploymentPhaseType.PRE_SYNC,
DeploymentPhaseType.SYNC,
DeploymentPhaseType.POST_SYNC,
DeploymentPhaseType.SKIP,
DeploymentPhaseType.SYNC_FAIL,
]