Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Run jobs using system executor #4161

Merged
merged 59 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
7418f2b
check for active ci_pipeline_material
Ashish-devtron Oct 11, 2023
78b844f
t checkout ci-pipeMerge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Oct 11, 2023
2b0ca95
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Oct 12, 2023
f7ce0ff
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Oct 12, 2023
7a9a8a9
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Oct 13, 2023
3b0ac36
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Oct 17, 2023
804ee25
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Oct 17, 2023
31cd8ff
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Oct 18, 2023
1ad0605
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Oct 23, 2023
30368ce
add name in workflowContainer
Ashish-devtron Oct 23, 2023
6018be6
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Oct 25, 2023
81166be
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Oct 25, 2023
601e597
Merge branch 'main' into job-using-system-exec
Ashish-devtron Oct 25, 2023
ebbefeb
executor type for workflow
Ashish-devtron Oct 25, 2023
78fff93
executor type for workflow
Ashish-devtron Oct 25, 2023
c07e60a
get rest config in CiHandler
Ashish-devtron Oct 25, 2023
3e6693a
add termination grace period in CI also
Ashish-devtron Oct 25, 2023
cc66b1f
get workflow
Ashish-devtron Oct 25, 2023
f76e2bd
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Oct 25, 2023
19e9c9f
Merge branch 'main' into job-using-system-exec
Ashish-devtron Oct 26, 2023
dc77d3c
code review changes
Ashish-devtron Oct 26, 2023
49fd0b1
getWorkflowStatus
Ashish-devtron Oct 26, 2023
ab11dfc
common flow for AWF and nil executor type
Ashish-devtron Oct 26, 2023
9311fd3
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Oct 27, 2023
33eafab
Main merge
Ashish-devtron Oct 27, 2023
bac2c19
add migration script
Ashish-devtron Oct 27, 2023
1a22746
add podStatus and message for system abort
Ashish-devtron Oct 27, 2023
e55ecd9
add podStatus and message for system abort
Ashish-devtron Oct 27, 2023
6fe4eaf
remove duplicate codes
Ashish-devtron Oct 29, 2023
2142c46
set podStatus and message manually
Ashish-devtron Oct 30, 2023
70eb486
logging updating workflow
Ashish-devtron Oct 30, 2023
e46d53e
logging error
Ashish-devtron Oct 30, 2023
6ad74d4
revert logging
Ashish-devtron Oct 30, 2023
a87beb9
remove comments
Ashish-devtron Oct 30, 2023
1f7378b
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Oct 30, 2023
f8c8da6
Merge branch 'main' into job-using-system-exec
Ashish-devtron Oct 30, 2023
c3cc711
create constant for messages
Ashish-devtron Oct 30, 2023
54212f7
err handling
Ashish-devtron Oct 30, 2023
338e956
remove todo
Ashish-devtron Oct 30, 2023
b35bbab
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Oct 30, 2023
38158cb
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Oct 31, 2023
fa2e0db
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Oct 31, 2023
f04551c
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Nov 1, 2023
38aceb4
Main merge
Ashish-devtron Nov 1, 2023
727da5d
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Nov 1, 2023
68d923d
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Nov 1, 2023
a910cd0
Check for external in job node selector
Ashish-devtron Nov 1, 2023
edf6738
Merge branch 'main' into job-using-system-exec
Ashish-devtron Nov 1, 2023
8af751a
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Nov 2, 2023
c1bda19
check for conditions len
Ashish-devtron Nov 2, 2023
8c055cf
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Nov 2, 2023
8824445
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Nov 2, 2023
2dd53b7
envService nil pointer fix
prakash100198 Nov 2, 2023
ae61774
workflow executor check
Ashish-devtron Nov 3, 2023
8ff5da2
Merge branch 'main' into job-using-system-exec
Ashish-devtron Nov 3, 2023
87a3fd9
Merge branch 'main' of github.com:devtron-labs/devtron
Ashish-devtron Nov 3, 2023
feb3bbf
Merge branch 'main' into job-using-system-exec
Ashish-devtron Nov 3, 2023
65324c7
Main merge
Ashish-devtron Nov 3, 2023
d0a3078
rename script number
Ashish-devtron Nov 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 48 additions & 46 deletions internal/sql/repository/pipelineConfig/CiWorkflowRepository.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,28 @@ type CiWorkflowRepositoryImpl struct {
}

type CiWorkflow struct {
tableName struct{} `sql:"ci_workflow" pg:",discard_unknown_columns"`
Id int `sql:"id,pk"`
Name string `sql:"name"`
Status string `sql:"status"`
PodStatus string `sql:"pod_status"`
Message string `sql:"message"`
StartedOn time.Time `sql:"started_on"`
FinishedOn time.Time `sql:"finished_on"`
CiPipelineId int `sql:"ci_pipeline_id"`
Namespace string `sql:"namespace"`
BlobStorageEnabled bool `sql:"blob_storage_enabled,notnull"`
LogLocation string `sql:"log_file_path"`
GitTriggers map[int]GitCommit `sql:"git_triggers"`
TriggeredBy int32 `sql:"triggered_by"`
CiArtifactLocation string `sql:"ci_artifact_location"`
PodName string `sql:"pod_name"`
CiBuildType string `sql:"ci_build_type"`
EnvironmentId int `sql:"environment_id"`
ImagePathReservationId int `sql:"image_path_reservation_id"`
ReferenceCiWorkflowId int `sql:"ref_ci_workflow_id"`
ParentCiWorkFlowId int `sql:"parent_ci_workflow_id"`
tableName struct{} `sql:"ci_workflow" pg:",discard_unknown_columns"`
Id int `sql:"id,pk"`
Name string `sql:"name"`
Status string `sql:"status"`
PodStatus string `sql:"pod_status"`
Message string `sql:"message"`
StartedOn time.Time `sql:"started_on"`
FinishedOn time.Time `sql:"finished_on"`
CiPipelineId int `sql:"ci_pipeline_id"`
Namespace string `sql:"namespace"`
BlobStorageEnabled bool `sql:"blob_storage_enabled,notnull"`
LogLocation string `sql:"log_file_path"`
GitTriggers map[int]GitCommit `sql:"git_triggers"`
TriggeredBy int32 `sql:"triggered_by"`
CiArtifactLocation string `sql:"ci_artifact_location"`
PodName string `sql:"pod_name"`
CiBuildType string `sql:"ci_build_type"`
EnvironmentId int `sql:"environment_id"`
ReferenceCiWorkflowId int `sql:"ref_ci_workflow_id"`
ParentCiWorkFlowId int `sql:"parent_ci_workflow_id"`
ExecutorType WorkflowExecutorType `sql:"executor_type"` //awf, system
ImagePathReservationId int `sql:"image_path_reservation_id"`
CiPipeline *CiPipeline
}

Expand All @@ -82,31 +83,32 @@ func (r *CiWorkflow) IsExternalRunInJobType() bool {
}

type WorkflowWithArtifact struct {
Id int `json:"id"`
Name string `json:"name"`
PodName string `json:"podName"`
Status string `json:"status"`
PodStatus string `json:"pod_status"`
Message string `json:"message"`
StartedOn time.Time `json:"started_on"`
FinishedOn time.Time `json:"finished_on"`
CiPipelineId int `json:"ci_pipeline_id"`
Namespace string `json:"namespace"`
LogFilePath string `json:"log_file_path"`
GitTriggers map[int]GitCommit `json:"git_triggers"`
TriggeredBy int32 `json:"triggered_by"`
EmailId string `json:"email_id"`
Image string `json:"image"`
CiArtifactLocation string `json:"ci_artifact_location"`
CiArtifactId int `json:"ci_artifact_d"`
BlobStorageEnabled bool `json:"blobStorageEnabled"`
CiBuildType string `json:"ci_build_type"`
IsArtifactUploaded bool `json:"is_artifact_uploaded"`
EnvironmentId int `json:"environmentId"`
EnvironmentName string `json:"environmentName"`
ImagePathReservationId int `json:"image_path_reservation_id"`
RefCiWorkflowId int `json:"referenceCiWorkflowId"`
ParentCiWorkflowId int `json:"parent_ci_workflow_id"`
Id int `json:"id"`
Name string `json:"name"`
PodName string `json:"podName"`
Status string `json:"status"`
PodStatus string `json:"pod_status"`
Message string `json:"message"`
StartedOn time.Time `json:"started_on"`
FinishedOn time.Time `json:"finished_on"`
CiPipelineId int `json:"ci_pipeline_id"`
Namespace string `json:"namespace"`
LogFilePath string `json:"log_file_path"`
GitTriggers map[int]GitCommit `json:"git_triggers"`
TriggeredBy int32 `json:"triggered_by"`
EmailId string `json:"email_id"`
Image string `json:"image"`
CiArtifactLocation string `json:"ci_artifact_location"`
CiArtifactId int `json:"ci_artifact_d"`
BlobStorageEnabled bool `json:"blobStorageEnabled"`
CiBuildType string `json:"ci_build_type"`
IsArtifactUploaded bool `json:"is_artifact_uploaded"`
EnvironmentId int `json:"environmentId"`
EnvironmentName string `json:"environmentName"`
RefCiWorkflowId int `json:"referenceCiWorkflowId"`
ParentCiWorkflowId int `json:"parent_ci_workflow_id"`
ExecutorType WorkflowExecutorType `json:"executor_type"` //awf, system
ImagePathReservationId int `json:"image_path_reservation_id"`
}

type GitCommit struct {
Expand Down
15 changes: 0 additions & 15 deletions pkg/cluster/ClusterService.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ type ClusterService interface {
ConvertClusterBeanObjectToCluster(bean *ClusterBean) *v1alpha1.Cluster

GetClusterConfigByClusterId(clusterId int) (*k8s.ClusterConfig, error)
GetClusterConfigByEnvId(envId int) (*k8s.ClusterConfig, error)
}

type ClusterServiceImpl struct {
Expand Down Expand Up @@ -1129,17 +1128,3 @@ func (impl ClusterServiceImpl) GetClusterConfigByClusterId(clusterId int) (*k8s.
}
return clusterConfig, nil
}

func (impl ClusterServiceImpl) GetClusterConfigByEnvId(envId int) (*k8s.ClusterConfig, error) {
envBean, err := impl.environmentService.FindById(envId)
if err != nil {
impl.logger.Errorw("error in getting envBean by envId", "err", err, "envId", envId)
return nil, err
}
clusterConfig, err := impl.GetClusterConfigByClusterId(envBean.ClusterId)
if err != nil {
impl.logger.Errorw("error in getting cluster config by env id", "err", err, "envId", envId)
return nil, err
}
return clusterConfig, nil
}
8 changes: 2 additions & 6 deletions pkg/pipeline/CdHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ func (impl *CdHandlerImpl) UpdateWorkflow(workflowStatus v1alpha1.WorkflowStatus
return savedWorkflow.Id, savedWorkflow.Status, nil
}

func (impl *CdHandlerImpl) extractWorkfowStatus(workflowStatus v1alpha1.WorkflowStatus) *WorkflowStatus {
func (impl *CdHandlerImpl) extractWorkfowStatus(workflowStatus v1alpha1.WorkflowStatus) *types.WorkflowStatus {
workflowName := ""
status := string(workflowStatus.Phase)
podStatus := "Pending"
Expand Down Expand Up @@ -724,7 +724,7 @@ func (impl *CdHandlerImpl) extractWorkfowStatus(workflowStatus v1alpha1.Workflow
break
}
}
workflowStatusRes := &WorkflowStatus{
workflowStatusRes := &types.WorkflowStatus{
WorkflowName: workflowName,
Status: status,
PodStatus: podStatus,
Expand All @@ -735,10 +735,6 @@ func (impl *CdHandlerImpl) extractWorkfowStatus(workflowStatus v1alpha1.Workflow
return workflowStatusRes
}

type WorkflowStatus struct {
WorkflowName, Status, PodStatus, Message, LogLocation, PodName string
}

func (impl *CdHandlerImpl) stateChanged(status string, podStatus string, msg string,
finishedAt time.Time, savedWorkflow *pipelineConfig.CdWorkflowRunner) bool {
return savedWorkflow.Status != status || savedWorkflow.PodStatus != podStatus || savedWorkflow.Message != msg || savedWorkflow.FinishedOn != finishedAt
Expand Down
Loading
Loading