Skip to content

Commit 5c07fc7

Browse files
committed
status_type to status_for
1 parent 6cfcda5 commit 5c07fc7

File tree

5 files changed

+26
-25
lines changed

5 files changed

+26
-25
lines changed

pkg/pipeline/workflowStatus/WorkflowStageStatusService.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func (impl *WorkFlowStageStatusServiceImpl) updatePodStages(currentWorkflowStage
111111
}
112112
//update pod stage status by using convertPodStatusToDevtronStatus
113113
for _, stage := range currentWorkflowStages {
114-
if stage.StatusType == bean2.WORKFLOW_STAGE_STATUS_TYPE_POD {
114+
if stage.StatusFor == bean2.WORKFLOW_STAGE_STATUS_TYPE_POD {
115115
// add pod name in stage metadata if not empty
116116
if len(podName) > 0 {
117117
marshalledMetadata, _ := json.Marshal(map[string]string{"podName": podName})
@@ -190,7 +190,7 @@ func (impl *WorkFlowStageStatusServiceImpl) updateWorkflowStagesToDevtronStatus(
190190

191191
//if pod is running, update preparation and execution stages
192192
for _, stage := range currentWorkflowStages {
193-
if stage.StatusType == bean2.WORKFLOW_STAGE_STATUS_TYPE_WORKFLOW {
193+
if stage.StatusFor == bean2.WORKFLOW_STAGE_STATUS_TYPE_WORKFLOW {
194194
//mark preparation stage as completed
195195
if stage.StageName == bean2.WORKFLOW_PREPARATION {
196196
if stage.Status == bean2.WORKFLOW_STAGE_STATUS_RUNNING {
@@ -219,7 +219,7 @@ func (impl *WorkFlowStageStatusServiceImpl) updateWorkflowStagesToDevtronStatus(
219219

220220
//if pod is succeeded, update execution stage
221221
for _, stage := range currentWorkflowStages {
222-
if stage.StatusType == bean2.WORKFLOW_STAGE_STATUS_TYPE_WORKFLOW {
222+
if stage.StatusFor == bean2.WORKFLOW_STAGE_STATUS_TYPE_WORKFLOW {
223223
//mark execution stage as completed
224224
if stage.StageName == bean2.WORKFLOW_EXECUTION {
225225
if stage.Status == bean2.WORKFLOW_STAGE_STATUS_RUNNING {
@@ -234,7 +234,7 @@ func (impl *WorkFlowStageStatusServiceImpl) updateWorkflowStagesToDevtronStatus(
234234

235235
//if pod is failed, update execution stage
236236
for _, stage := range currentWorkflowStages {
237-
if stage.StatusType == bean2.WORKFLOW_STAGE_STATUS_TYPE_WORKFLOW {
237+
if stage.StatusFor == bean2.WORKFLOW_STAGE_STATUS_TYPE_WORKFLOW {
238238
//mark execution stage as completed
239239
if stage.StageName == bean2.WORKFLOW_EXECUTION {
240240
if stage.Status == bean2.WORKFLOW_STAGE_STATUS_RUNNING {
@@ -269,7 +269,7 @@ func (impl *WorkFlowStageStatusServiceImpl) updateWorkflowStagesToDevtronStatus(
269269
impl.logger.Errorw("unknown pod status", "podStatus", podStatus)
270270
//mark workflow stage status as unknown
271271
for _, stage := range currentWorkflowStages {
272-
if stage.StatusType == bean2.WORKFLOW_STAGE_STATUS_TYPE_WORKFLOW {
272+
if stage.StatusFor == bean2.WORKFLOW_STAGE_STATUS_TYPE_WORKFLOW {
273273
//mark execution stage as completed
274274
if stage.StageName == bean2.WORKFLOW_EXECUTION {
275275
if stage.Status == bean2.WORKFLOW_STAGE_STATUS_RUNNING {
@@ -361,7 +361,7 @@ func (impl *WorkFlowStageStatusServiceImpl) ConvertDBWorkflowStageToMap(workflow
361361
}
362362
for _, wfStage := range workflowStages {
363363
if wfStage.WorkflowId == wfId {
364-
wfMap[wfStage.StatusType.ToString()] = append(wfMap[wfStage.StatusType.ToString()], adapter.ConvertDBWorkflowStageToDto(wfStage))
364+
wfMap[wfStage.StatusFor.ToString()] = append(wfMap[wfStage.StatusFor.ToString()], adapter.ConvertDBWorkflowStageToDto(wfStage))
365365
foundInDb = true
366366
}
367367
}

pkg/pipeline/workflowStatus/adapter/adapter.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func GetDefaultWorkflowPreparationStage(workflowId int, workflowType string) *re
7878
return &repository.WorkflowExecutionStage{
7979
StageName: bean.WORKFLOW_PREPARATION,
8080
Status: bean.WORKFLOW_STAGE_STATUS_RUNNING,
81-
StatusType: bean.WORKFLOW_STAGE_STATUS_TYPE_WORKFLOW,
81+
StatusFor: bean.WORKFLOW_STAGE_STATUS_TYPE_WORKFLOW,
8282
StartTime: time.Now().Format(bean3.LayoutRFC3339),
8383
WorkflowId: workflowId,
8484
WorkflowType: workflowType,
@@ -95,7 +95,7 @@ func GetDefaultWorkflowExecutionStage(workflowId int, workflowType string) *repo
9595
return &repository.WorkflowExecutionStage{
9696
StageName: bean.WORKFLOW_EXECUTION,
9797
Status: bean.WORKFLOW_STAGE_STATUS_NOT_STARTED,
98-
StatusType: bean.WORKFLOW_STAGE_STATUS_TYPE_WORKFLOW,
98+
StatusFor: bean.WORKFLOW_STAGE_STATUS_TYPE_WORKFLOW,
9999
StartTime: "",
100100
WorkflowId: workflowId,
101101
WorkflowType: workflowType,
@@ -112,7 +112,7 @@ func GetDefaultPodExecutionStage(workflowId int, workflowType string) *repositor
112112
return &repository.WorkflowExecutionStage{
113113
StageName: bean.POD_EXECUTION,
114114
Status: bean.WORKFLOW_STAGE_STATUS_NOT_STARTED,
115-
StatusType: bean.WORKFLOW_STAGE_STATUS_TYPE_POD,
115+
StatusFor: bean.WORKFLOW_STAGE_STATUS_TYPE_POD,
116116
StartTime: "",
117117
WorkflowId: workflowId,
118118
WorkflowType: workflowType,

pkg/pipeline/workflowStatus/bean/bean.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ func (n WorkflowStageName) ToString() string {
1212
return string(n)
1313
}
1414

15-
type WorkflowStageStatusType string
15+
type WorkflowStageStatusFor string
1616

1717
const (
18-
WORKFLOW_STAGE_STATUS_TYPE_WORKFLOW WorkflowStageStatusType = "workflow"
19-
WORKFLOW_STAGE_STATUS_TYPE_POD WorkflowStageStatusType = "pod"
18+
WORKFLOW_STAGE_STATUS_TYPE_WORKFLOW WorkflowStageStatusFor = "workflow"
19+
WORKFLOW_STAGE_STATUS_TYPE_POD WorkflowStageStatusFor = "pod"
2020
)
2121

22-
func (n WorkflowStageStatusType) ToString() string {
22+
func (n WorkflowStageStatusFor) ToString() string {
2323
return string(n)
2424
}
2525

pkg/pipeline/workflowStatus/repository/WorkflowStageRepository.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ type WorkflowStageRepositoryImpl struct {
2323
}
2424

2525
type WorkflowExecutionStage struct {
26-
tableName struct{} `sql:"workflow_execution_stage" pg:",discard_unknown_columns"`
27-
Id int `sql:"id,pk"`
28-
StageName bean.WorkflowStageName `sql:"stage_name,notnull"` // same as app name
29-
Status bean.WorkflowStageStatus `sql:"status"`
30-
StatusType bean.WorkflowStageStatusType `sql:"status_type"`
31-
Message string `sql:"message"`
32-
Metadata string `sql:"metadata"`
33-
WorkflowId int `sql:"workflow_id,notnull"`
34-
WorkflowType string `sql:"workflow_type,notnull"`
35-
StartTime string `sql:"start_time"`
36-
EndTime string `sql:"end_time"`
26+
tableName struct{} `sql:"workflow_execution_stage" pg:",discard_unknown_columns"`
27+
Id int `sql:"id,pk"`
28+
StageName bean.WorkflowStageName `sql:"stage_name,notnull"` // same as app name
29+
Status bean.WorkflowStageStatus `sql:"status"`
30+
StatusFor bean.WorkflowStageStatusFor `sql:"status_type"`
31+
Message string `sql:"message"`
32+
Metadata string `sql:"metadata"`
33+
WorkflowId int `sql:"workflow_id,notnull"`
34+
WorkflowType string `sql:"workflow_type,notnull"`
35+
StartTime string `sql:"start_time"`
36+
EndTime string `sql:"end_time"`
3737

3838
sql.AuditLog
3939
}

scripts/sql/31902800_build_worker_status.up.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ CREATE SEQUENCE IF NOT EXISTS id_seq_workflow_execution_stage;
33
CREATE TABLE IF NOT EXISTS public.workflow_execution_stage (
44
id int4 NOT NULL DEFAULT nextval('id_seq_workflow_execution_stage'::regclass),
55
stage_name varchar(50) NULL,
6+
step_name varchar(50) NULL,
67
status varchar(50) NULL,
7-
status_type varchar(50) NULL,
8+
status_for varchar(50) NULL,
89
message text NULL,
910
metadata text NULL,
1011
workflow_id int4 NOT NULL,

0 commit comments

Comments
 (0)