Skip to content

Commit

Permalink
#30 add url in build steps param
Browse files Browse the repository at this point in the history
  • Loading branch information
zeromsi committed Aug 21, 2022
1 parent 5c35c38 commit 01d6b62
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/v1/process_life_cycle_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (p processLifeCycleEventApi) Pull(context echo.Context) error {
count, _ := strconv.ParseInt(context.QueryParam("count"), 10, 64)
steptype := context.QueryParam("step_type")
if steptype != "" {
return common.GenerateSuccessResponse(context, p.processLifeCycleEventService.PullNonInitializedAndAutoTriggerEnabledEventsByStepType(count, steptype), nil, "")
return common.GenerateSuccessResponse(context, p.processLifeCycleEventService.PullQueuedAndAutoTriggerEnabledEventsByStepType(count, steptype), nil, "")
}
return common.GenerateSuccessResponse(context, p.processLifeCycleEventService.PullPausedAndAutoTriggerEnabledResourcesByAgentName(count, agentName), nil, "")
}
Expand Down
8 changes: 6 additions & 2 deletions core/v1/logic/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ func (p pipelineService) GetStatusCount(companyId string, fromDate, toDate time.
running++
} else if each == enums.PAUSED {
paused++
} else if each == enums.NON_INITIALIZED {
} else if each == enums.QUEUED {
nonInitialized++
}else if each == enums.NON_INITIALIZED {
nonInitialized++
}
}
Expand Down Expand Up @@ -56,10 +58,12 @@ func GetProcessStatusMapFromEvents(events []v1.ProcessLifeCycleEvent) map[string
} else if val != enums.FAILED {
if val == enums.PAUSED && each.Status == enums.ACTIVE {
processStatusMap[each.ProcessId] = enums.ACTIVE
} else if val == enums.COMPLETED && each.Status == enums.NON_INITIALIZED {
} else if val == enums.COMPLETED && (each.Status == enums.NON_INITIALIZED || each.Status == enums.QUEUED) {
processStatusMap[each.ProcessId] = enums.PAUSED
} else if (val == enums.NON_INITIALIZED || val == enums.COMPLETED) && (each.Status != enums.NON_INITIALIZED && each.Status != enums.COMPLETED) {
processStatusMap[each.ProcessId] = each.Status
}else if (val == enums.QUEUED || val == enums.COMPLETED) && (each.Status != enums.QUEUED && each.Status != enums.COMPLETED) {
processStatusMap[each.ProcessId] = each.Status
}
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion core/v1/logic/process_life_cycle_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (p processLifeCycleEventService) GetByProcessId(processId string) []v1.Proc
return p.repo.GetByProcessId(processId)
}

func (p processLifeCycleEventService) PullNonInitializedAndAutoTriggerEnabledEventsByStepType(count int64, stepType string) []v1.ProcessLifeCycleEvent {
func (p processLifeCycleEventService) PullQueuedAndAutoTriggerEnabledEventsByStepType(count int64, stepType string) []v1.ProcessLifeCycleEvent {
return p.repo.PullNonInitializedAndAutoTriggerEnabledEventsByStepType(count, stepType)
}

Expand Down
2 changes: 1 addition & 1 deletion core/v1/service/process_life_cycle_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
type ProcessLifeCycleEvent interface {
Store(events []v1.ProcessLifeCycleEvent)
GetByProcessIdAndStep(processId, step string) v1.ProcessLifeCycleEvent
PullNonInitializedAndAutoTriggerEnabledEventsByStepType(count int64, stepType string) []v1.ProcessLifeCycleEvent
PullQueuedAndAutoTriggerEnabledEventsByStepType(count int64, stepType string) []v1.ProcessLifeCycleEvent
PullPausedAndAutoTriggerEnabledResourcesByAgentName(count int64, agent string) []v1.DeployableResource
GetByProcessId(processId string) []v1.ProcessLifeCycleEvent
UpdateClaim(companyId, processId, step, status string) error
Expand Down
2 changes: 2 additions & 0 deletions enums/enums.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ const (
type PROCESS_STATUS string

const (
// QUEUED pipeline steps status queued
QUEUED=PROCESS_STATUS("queued")
// NON_INITIALIZED pipeline steps status non_initialized
NON_INITIALIZED = PROCESS_STATUS("non_initialized")
// ACTIVE pipeline steps status active
Expand Down
2 changes: 1 addition & 1 deletion repository/v1/mongo/process_life_cycle_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (p processLifeCycleRepository) PullNonInitializedAndAutoTriggerEnabledEvent
if stepType == string(enums.BUILD) {
query = bson.M{
"$and": []bson.M{
{"status": enums.NON_INITIALIZED},
{"status": enums.QUEUED},
{"trigger": enums.AUTO},
{"step_type": stepType},
},
Expand Down

0 comments on commit 01d6b62

Please sign in to comment.