Skip to content

Commit d16595b

Browse files
feat: Helm async deploy Devtron Apps (#4045)
* wip: refactored deployment code * feat: helm async install for devtron apps * updated: pubsub lib version * removed unnecessary comments * removed: unnecessary code * feat: deployment cron updated * updated: review comments * refactored: deployment status cron job logic * updated: runner states for deployment * fixed: unable to update cdWorkflowRunner * chore: main merge * updated: cdWfr for gitops deployment * fixed: cdWfr skipped status list * fixed: test file arguments * fixed: handled for event redelivery case * used the constant * handling for context deadline exceeded * updated: context deadline error expression * handled: error in unmarshalling * fixed: context deadline error in cdWfr * handled: pending-install state * feat: helm install/upgrade with ctx * handling: nil pointer * updated: error handling * updated: error message * fixed: updatePreviousDeploymentStatus handling * fixed: updatePreviousDeploymentStatus handling * feat: refactored * updated variable name * updated default value for env * updated GetValuesOverrideForTrigger * updated GetValuesOverrideForTrigger * code review comments * incorporated review suggestions * chore: removed unnecessary env flag * handled: context deadline error * fixed: migration * fixed: update status in progress * fine-tuned and refactoring * handling for hibernate app --------- Co-authored-by: Kripansh <[email protected]>
1 parent eae2e3f commit d16595b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1701
-8062
lines changed

Wire.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,9 @@ func InitializeApp() (*App, error) {
967967

968968
pipeline.NewPluginInputVariableParserImpl,
969969
wire.Bind(new(pipeline.PluginInputVariableParser), new(*pipeline.PluginInputVariableParserImpl)),
970+
971+
pipeline.NewPipelineConfigListenerServiceImpl,
972+
wire.Bind(new(pipeline.PipelineConfigListenerService), new(*pipeline.PipelineConfigListenerServiceImpl)),
970973
)
971974
return &App{}, nil
972975
}

api/bean/ValuesOverrideRequest.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ type ValuesOverrideRequest struct {
6464
CdWorkflowType WorkflowType `json:"cdWorkflowType,notnull"`
6565
WfrId int `json:"wfrId,notnull"`
6666
CdWorkflowId int `json:"cdWorkflowId"`
67+
PipelineOverrideId int `json:"pipelineOverrideId"` //required for async install/upgrade event;
68+
DeploymentType models.DeploymentType `json:"deploymentType"` //required for async install/upgrade handling; previously if was used internally
6769
UserId int32 `json:"-"`
68-
DeploymentType models.DeploymentType `json:"-"`
6970
EnvId int `json:"-"`
7071
EnvName string `json:"-"`
7172
ClusterId int `json:"-"`
@@ -80,6 +81,12 @@ type BulkCdDeployEvent struct {
8081
UserId int32 `json:"userId"`
8182
}
8283

84+
type AsyncCdDeployEvent struct {
85+
ValuesOverrideRequest *ValuesOverrideRequest `json:"valuesOverrideRequest"`
86+
TriggeredAt time.Time `json:"triggeredAt"`
87+
TriggeredBy int32 `json:"triggeredBy"`
88+
}
89+
8390
type ReleaseStatusUpdateRequest struct {
8491
RequestId string `json:"requestId"`
8592
NewStatus models.ChartStatus `json:"newStatus"`
@@ -117,7 +124,6 @@ type ArtifactsListFilterOptions struct {
117124
//excludeWfRunners
118125
ExcludeWfrIds []int
119126

120-
121127
//pluginStage
122128
PluginStage string
123129
}

api/helm-app/HelmAppService.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import (
4242
type HelmAppService interface {
4343
ListHelmApplications(ctx context.Context, clusterIds []int, w http.ResponseWriter, token string, helmAuth func(token string, object string) bool)
4444
GetApplicationDetail(ctx context.Context, app *AppIdentifier) (*AppDetail, error)
45-
GetApplicationStatus(ctx context.Context, app *AppIdentifier) (string, error)
45+
GetApplicationAndReleaseStatus(ctx context.Context, app *AppIdentifier) (*AppStatus, error)
4646
GetApplicationDetailWithFilter(ctx context.Context, app *AppIdentifier, resourceTreeFilter *ResourceTreeFilter) (*AppDetail, error)
4747
HibernateApplication(ctx context.Context, app *AppIdentifier, hibernateRequest *openapi.HibernateRequest) ([]*openapi.HibernateStatus, error)
4848
UnHibernateApplication(ctx context.Context, app *AppIdentifier, hibernateRequest *openapi.HibernateRequest) ([]*openapi.HibernateStatus, error)
@@ -287,8 +287,8 @@ func (impl *HelmAppServiceImpl) GetApplicationDetail(ctx context.Context, app *A
287287
return impl.getApplicationDetail(ctx, app, nil)
288288
}
289289

290-
func (impl *HelmAppServiceImpl) GetApplicationStatus(ctx context.Context, app *AppIdentifier) (string, error) {
291-
return impl.getApplicationStatus(ctx, app)
290+
func (impl *HelmAppServiceImpl) GetApplicationAndReleaseStatus(ctx context.Context, app *AppIdentifier) (*AppStatus, error) {
291+
return impl.getApplicationAndReleaseStatus(ctx, app)
292292
}
293293

294294
func (impl *HelmAppServiceImpl) GetApplicationDetailWithFilter(ctx context.Context, app *AppIdentifier, resourceTreeFilter *ResourceTreeFilter) (*AppDetail, error) {
@@ -331,12 +331,11 @@ func (impl *HelmAppServiceImpl) getApplicationDetail(ctx context.Context, app *A
331331
return appdetail, err
332332
}
333333

334-
func (impl *HelmAppServiceImpl) getApplicationStatus(ctx context.Context, app *AppIdentifier) (string, error) {
335-
applicationStatus := ""
334+
func (impl *HelmAppServiceImpl) getApplicationAndReleaseStatus(ctx context.Context, app *AppIdentifier) (*AppStatus, error) {
336335
config, err := impl.GetClusterConf(app.ClusterId)
337336
if err != nil {
338337
impl.logger.Errorw("error in fetching cluster detail", "err", err)
339-
return applicationStatus, err
338+
return nil, err
340339
}
341340
req := &AppDetailRequest{
342341
ClusterConfig: config,
@@ -346,10 +345,9 @@ func (impl *HelmAppServiceImpl) getApplicationStatus(ctx context.Context, app *A
346345
appStatus, err := impl.helmAppClient.GetAppStatus(ctx, req)
347346
if err != nil {
348347
impl.logger.Errorw("error in fetching app status", "err", err)
349-
return applicationStatus, err
348+
return nil, err
350349
}
351-
applicationStatus = appStatus.ApplicationStatus
352-
return applicationStatus, err
350+
return appStatus, err
353351
}
354352

355353
func (impl *HelmAppServiceImpl) GetDeploymentHistory(ctx context.Context, app *AppIdentifier) (*HelmAppDeploymentHistory, error) {

0 commit comments

Comments
 (0)