diff --git a/api/appStore/InstalledAppRestHandler.go b/api/appStore/InstalledAppRestHandler.go index 56b44e4e726..4cf7805da5f 100644 --- a/api/appStore/InstalledAppRestHandler.go +++ b/api/appStore/InstalledAppRestHandler.go @@ -48,7 +48,6 @@ import ( "github.com/devtron-labs/devtron/pkg/auth/authorisation/casbin" "github.com/devtron-labs/devtron/pkg/auth/user" "github.com/devtron-labs/devtron/pkg/cluster" - application2 "github.com/devtron-labs/devtron/pkg/k8s/application" "github.com/devtron-labs/devtron/util" "github.com/devtron-labs/devtron/util/argo" "github.com/devtron-labs/devtron/util/rbac" @@ -92,7 +91,6 @@ type InstalledAppRestHandlerImpl struct { argoUserService argo.ArgoUserService cdApplicationStatusUpdateHandler cron.CdApplicationStatusUpdateHandler installedAppRepository repository.InstalledAppRepository - K8sApplicationService application2.K8sApplicationService appCrudOperationService app2.AppCrudOperationService installedAppDeploymentTypeChangeService deploymentTypeChange.InstalledAppDeploymentTypeChangeService } diff --git a/api/appStore/deployment/AppStoreDeploymentRestHandler.go b/api/appStore/deployment/AppStoreDeploymentRestHandler.go index ab7faf49433..42a9e12a91f 100644 --- a/api/appStore/deployment/AppStoreDeploymentRestHandler.go +++ b/api/appStore/deployment/AppStoreDeploymentRestHandler.go @@ -29,7 +29,6 @@ import ( "strings" "time" - client "github.com/devtron-labs/devtron/api/helm-app" openapi "github.com/devtron-labs/devtron/api/helm-app/openapiClient" "github.com/devtron-labs/devtron/api/restHandler/common" "github.com/devtron-labs/devtron/internal/util" @@ -69,7 +68,6 @@ type AppStoreDeploymentRestHandlerImpl struct { appStoreDeploymentServiceC appStoreDeploymentCommon.AppStoreDeploymentCommonService validator *validator.Validate helmAppService service2.HelmAppService - helmAppRestHandler client.HelmAppRestHandler argoUserService argo.ArgoUserService attributesService attributes.AttributesService } diff --git a/api/router/TelemetryRouter.go b/api/router/TelemetryRouter.go index 5de447ab6ff..4f9f7637073 100644 --- a/api/router/TelemetryRouter.go +++ b/api/router/TelemetryRouter.go @@ -34,6 +34,7 @@ type TelemetryRouterImpl struct { func NewTelemetryRouterImpl(logger *zap.SugaredLogger, handler restHandler.TelemetryRestHandler) *TelemetryRouterImpl { router := &TelemetryRouterImpl{ + logger: logger, handler: handler, } return router diff --git a/client/cron/CdApplicationStatusUpdateHandler.go b/client/cron/CdApplicationStatusUpdateHandler.go index c110eb6ca14..264a9224036 100644 --- a/client/cron/CdApplicationStatusUpdateHandler.go +++ b/client/cron/CdApplicationStatusUpdateHandler.go @@ -45,7 +45,6 @@ type CdApplicationStatusUpdateHandlerImpl struct { appService app.AppService workflowDagExecutor dag.WorkflowDagExecutor installedAppService EAMode.InstalledAppDBService - CdHandler pipeline.CdHandler AppStatusConfig *app.AppServiceConfig pubsubClient *pubsub.PubSubClientServiceImpl pipelineStatusTimelineRepository pipelineConfig.PipelineStatusTimelineRepository diff --git a/cmd/external-app/wire_gen.go b/cmd/external-app/wire_gen.go index 077e5e99c07..d2864de0b4f 100644 --- a/cmd/external-app/wire_gen.go +++ b/cmd/external-app/wire_gen.go @@ -1,6 +1,6 @@ // Code generated by Wire. DO NOT EDIT. -//go:generate go run github.com/google/wire/cmd/wire +//go:generate go run -mod=mod github.com/google/wire/cmd/wire //go:build !wireinject // +build !wireinject @@ -155,7 +155,7 @@ func InitializeApp() (*App, error) { userAuditRepositoryImpl := repository.NewUserAuditRepositoryImpl(db) userAuditServiceImpl := user.NewUserAuditServiceImpl(sugaredLogger, userAuditRepositoryImpl) userServiceImpl := user.NewUserServiceImpl(userAuthRepositoryImpl, sugaredLogger, userRepositoryImpl, roleGroupRepositoryImpl, sessionManager, userCommonServiceImpl, userAuditServiceImpl) - ssoLoginRepositoryImpl := sso.NewSSOLoginRepositoryImpl(db) + ssoLoginRepositoryImpl := sso.NewSSOLoginRepositoryImpl(db, sugaredLogger) k8sServiceImpl := k8s.NewK8sUtil(sugaredLogger, runtimeConfig) devtronSecretConfig, err := util2.GetDevtronSecretName() if err != nil { @@ -201,7 +201,7 @@ func InitializeApp() (*App, error) { helmAppClientImpl := gRPC.NewHelmAppClientImpl(sugaredLogger, helmClientConfig) pumpImpl := connector.NewPumpImpl(sugaredLogger) appRepositoryImpl := app.NewAppRepositoryImpl(db, sugaredLogger) - enforcerUtilHelmImpl := rbac.NewEnforcerUtilHelmImpl(sugaredLogger, clusterRepositoryImpl, teamRepositoryImpl, appRepositoryImpl, environmentRepositoryImpl, installedAppRepositoryImpl) + enforcerUtilHelmImpl := rbac.NewEnforcerUtilHelmImpl(sugaredLogger, clusterRepositoryImpl, teamRepositoryImpl, appRepositoryImpl, installedAppRepositoryImpl) serverDataStoreServerDataStore := serverDataStore.InitServerDataStore() appStoreApplicationVersionRepositoryImpl := appStoreDiscoverRepository.NewAppStoreApplicationVersionRepositoryImpl(sugaredLogger, db) pipelineRepositoryImpl := pipelineConfig.NewPipelineRepositoryImpl(db, sugaredLogger) diff --git a/pkg/auth/sso/SSOLoginRepository.go b/pkg/auth/sso/SSOLoginRepository.go index 49eaaa53db0..ce9e4ad4620 100644 --- a/pkg/auth/sso/SSOLoginRepository.go +++ b/pkg/auth/sso/SSOLoginRepository.go @@ -44,8 +44,12 @@ type SSOLoginRepositoryImpl struct { Logger *zap.SugaredLogger } -func NewSSOLoginRepositoryImpl(dbConnection *pg.DB) *SSOLoginRepositoryImpl { - return &SSOLoginRepositoryImpl{dbConnection: dbConnection} +func NewSSOLoginRepositoryImpl(dbConnection *pg.DB, + logger *zap.SugaredLogger) *SSOLoginRepositoryImpl { + return &SSOLoginRepositoryImpl{ + dbConnection: dbConnection, + Logger: logger, + } } type SSOLoginModel struct { diff --git a/pkg/cluster/ClusterServiceExtended.go b/pkg/cluster/ClusterServiceExtended.go index cc5bc72ced5..2b79cb4629d 100644 --- a/pkg/cluster/ClusterServiceExtended.go +++ b/pkg/cluster/ClusterServiceExtended.go @@ -30,7 +30,6 @@ type ClusterServiceImplExtended struct { grafanaClient grafana.GrafanaClient installedAppRepository repository2.InstalledAppRepository clusterServiceCD cluster2.ServiceClient - K8sInformerFactory informer.K8sInformerFactory gitOpsConfigReadService config.GitOpsConfigReadService *ClusterServiceImpl } diff --git a/pkg/deployment/trigger/devtronApps/TriggerService.go b/pkg/deployment/trigger/devtronApps/TriggerService.go index 7076deb5f98..1480c2e1799 100644 --- a/pkg/deployment/trigger/devtronApps/TriggerService.go +++ b/pkg/deployment/trigger/devtronApps/TriggerService.go @@ -114,12 +114,12 @@ type TriggerServiceImpl struct { userService user.UserService gitSensorGrpcClient gitSensorClient.Client config *types.CdConfig - appRepository appRepository.AppRepository helmAppService client2.HelmAppService enforcerUtil rbac.EnforcerUtil helmAppClient gRPC.HelmAppClient //TODO refactoring: use helm app service instead + appRepository appRepository.AppRepository scanResultRepository security.ImageScanResultRepository cvePolicyRepository security.CvePolicyRepository ciPipelineMaterialRepository pipelineConfig.CiPipelineMaterialRepository @@ -170,6 +170,7 @@ func NewTriggerServiceImpl(logger *zap.SugaredLogger, cdWorkflowCommonService cd eventFactory client.EventFactory, eventClient client.EventClient, globalEnvVariables *util3.GlobalEnvVariables, + appRepository appRepository.AppRepository, scanResultRepository security.ImageScanResultRepository, cvePolicyRepository security.CvePolicyRepository, ciPipelineMaterialRepository pipelineConfig.CiPipelineMaterialRepository, @@ -220,6 +221,7 @@ func NewTriggerServiceImpl(logger *zap.SugaredLogger, cdWorkflowCommonService cd eventClient: eventClient, globalEnvVariables: globalEnvVariables, helmAppClient: helmAppClient, + appRepository: appRepository, scanResultRepository: scanResultRepository, cvePolicyRepository: cvePolicyRepository, ciPipelineMaterialRepository: ciPipelineMaterialRepository, diff --git a/pkg/pipeline/CiService.go b/pkg/pipeline/CiService.go index a0b03f2d4a3..ce5e75164b0 100644 --- a/pkg/pipeline/CiService.go +++ b/pkg/pipeline/CiService.go @@ -69,7 +69,6 @@ type CiServiceImpl struct { workflowService WorkflowService ciPipelineMaterialRepository pipelineConfig.CiPipelineMaterialRepository ciWorkflowRepository pipelineConfig.CiWorkflowRepository - ciConfig *types.CiConfig eventClient client.EventClient eventFactory client.EventFactory mergeUtil *util.MergeUtil diff --git a/util/rbac/EnforcerUtilHelm.go b/util/rbac/EnforcerUtilHelm.go index 2203f2b976e..77887dd28a1 100644 --- a/util/rbac/EnforcerUtilHelm.go +++ b/util/rbac/EnforcerUtilHelm.go @@ -21,7 +21,6 @@ type EnforcerUtilHelmImpl struct { clusterRepository repository.ClusterRepository teamRepository team.TeamRepository appRepository app.AppRepository - environmentRepository repository.EnvironmentRepository InstalledAppRepository repository2.InstalledAppRepository } @@ -29,7 +28,6 @@ func NewEnforcerUtilHelmImpl(logger *zap.SugaredLogger, clusterRepository repository.ClusterRepository, teamRepository team.TeamRepository, appRepository app.AppRepository, - environmentRepository repository.EnvironmentRepository, installedAppRepository repository2.InstalledAppRepository, ) *EnforcerUtilHelmImpl { return &EnforcerUtilHelmImpl{ @@ -37,7 +35,6 @@ func NewEnforcerUtilHelmImpl(logger *zap.SugaredLogger, clusterRepository: clusterRepository, teamRepository: teamRepository, appRepository: appRepository, - environmentRepository: environmentRepository, InstalledAppRepository: installedAppRepository, } } diff --git a/wire_gen.go b/wire_gen.go index bde73002813..1d1e39f4ed4 100644 --- a/wire_gen.go +++ b/wire_gen.go @@ -1,6 +1,6 @@ // Code generated by Wire. DO NOT EDIT. -//go:generate go run github.com/google/wire/cmd/wire +//go:generate go run -mod=mod github.com/google/wire/cmd/wire //go:build !wireinject // +build !wireinject @@ -314,7 +314,7 @@ func InitializeApp() (*App, error) { } helmAppClientImpl := gRPC.NewHelmAppClientImpl(sugaredLogger, helmClientConfig) pumpImpl := connector.NewPumpImpl(sugaredLogger) - enforcerUtilHelmImpl := rbac.NewEnforcerUtilHelmImpl(sugaredLogger, clusterRepositoryImpl, teamRepositoryImpl, appRepositoryImpl, environmentRepositoryImpl, installedAppRepositoryImpl) + enforcerUtilHelmImpl := rbac.NewEnforcerUtilHelmImpl(sugaredLogger, clusterRepositoryImpl, teamRepositoryImpl, appRepositoryImpl, installedAppRepositoryImpl) serverDataStoreServerDataStore := serverDataStore.InitServerDataStore() appStoreApplicationVersionRepositoryImpl := appStoreDiscoverRepository.NewAppStoreApplicationVersionRepositoryImpl(sugaredLogger, db) helmReleaseConfig, err := service.GetHelmReleaseConfig() @@ -597,7 +597,7 @@ func InitializeApp() (*App, error) { gitOpsManifestPushServiceImpl := app2.NewGitOpsManifestPushServiceImpl(sugaredLogger, pipelineStatusTimelineServiceImpl, pipelineStatusTimelineRepositoryImpl, acdConfig, chartRefServiceImpl, gitOpsConfigReadServiceImpl, gitOperationServiceImpl, argoClientWrapperServiceImpl) argoK8sClientImpl := argocdServer.NewArgoK8sClientImpl(sugaredLogger, k8sServiceImpl) manifestPushConfigRepositoryImpl := repository10.NewManifestPushConfigRepository(sugaredLogger, db) - triggerServiceImpl, err := devtronApps.NewTriggerServiceImpl(sugaredLogger, cdWorkflowCommonServiceImpl, gitOpsManifestPushServiceImpl, gitOpsConfigReadServiceImpl, argoK8sClientImpl, acdConfig, argoClientWrapperServiceImpl, pipelineStatusTimelineServiceImpl, chartTemplateServiceImpl, chartServiceImpl, workflowEventPublishServiceImpl, manifestCreationServiceImpl, deployedConfigurationHistoryServiceImpl, argoUserServiceImpl, pipelineStageServiceImpl, globalPluginServiceImpl, customTagServiceImpl, pluginInputVariableParserImpl, prePostCdScriptHistoryServiceImpl, scopedVariableCMCSManagerImpl, workflowServiceImpl, imageDigestPolicyServiceImpl, userServiceImpl, clientImpl, helmAppServiceImpl, enforcerUtilImpl, helmAppClientImpl, eventSimpleFactoryImpl, eventRESTClientImpl, globalEnvVariables, imageScanResultRepositoryImpl, cvePolicyRepositoryImpl, ciPipelineMaterialRepositoryImpl, imageScanHistoryRepositoryImpl, imageScanDeployInfoRepositoryImpl, pipelineRepositoryImpl, pipelineOverrideRepositoryImpl, manifestPushConfigRepositoryImpl, chartRepositoryImpl, environmentRepositoryImpl, cdWorkflowRepositoryImpl, ciWorkflowRepositoryImpl, ciArtifactRepositoryImpl, ciTemplateServiceImpl, materialRepositoryImpl, appLabelRepositoryImpl, ciPipelineRepositoryImpl, appWorkflowRepositoryImpl, dockerArtifactStoreRepositoryImpl) + triggerServiceImpl, err := devtronApps.NewTriggerServiceImpl(sugaredLogger, cdWorkflowCommonServiceImpl, gitOpsManifestPushServiceImpl, gitOpsConfigReadServiceImpl, argoK8sClientImpl, acdConfig, argoClientWrapperServiceImpl, pipelineStatusTimelineServiceImpl, chartTemplateServiceImpl, chartServiceImpl, workflowEventPublishServiceImpl, manifestCreationServiceImpl, deployedConfigurationHistoryServiceImpl, argoUserServiceImpl, pipelineStageServiceImpl, globalPluginServiceImpl, customTagServiceImpl, pluginInputVariableParserImpl, prePostCdScriptHistoryServiceImpl, scopedVariableCMCSManagerImpl, workflowServiceImpl, imageDigestPolicyServiceImpl, userServiceImpl, clientImpl, helmAppServiceImpl, enforcerUtilImpl, helmAppClientImpl, eventSimpleFactoryImpl, eventRESTClientImpl, globalEnvVariables, appRepositoryImpl, imageScanResultRepositoryImpl, cvePolicyRepositoryImpl, ciPipelineMaterialRepositoryImpl, imageScanHistoryRepositoryImpl, imageScanDeployInfoRepositoryImpl, pipelineRepositoryImpl, pipelineOverrideRepositoryImpl, manifestPushConfigRepositoryImpl, chartRepositoryImpl, environmentRepositoryImpl, cdWorkflowRepositoryImpl, ciWorkflowRepositoryImpl, ciArtifactRepositoryImpl, ciTemplateServiceImpl, materialRepositoryImpl, appLabelRepositoryImpl, ciPipelineRepositoryImpl, appWorkflowRepositoryImpl, dockerArtifactStoreRepositoryImpl) if err != nil { return nil, err } @@ -749,7 +749,7 @@ func InitializeApp() (*App, error) { return nil, err } grafanaRouterImpl := router.NewGrafanaRouterImpl(sugaredLogger, grafanaConfig) - ssoLoginRepositoryImpl := sso.NewSSOLoginRepositoryImpl(db) + ssoLoginRepositoryImpl := sso.NewSSOLoginRepositoryImpl(db, sugaredLogger) ssoLoginServiceImpl := sso.NewSSOLoginServiceImpl(sugaredLogger, ssoLoginRepositoryImpl, k8sServiceImpl, devtronSecretConfig, userAuthOidcHelperImpl) ssoLoginRestHandlerImpl := sso2.NewSsoLoginRestHandlerImpl(validate, sugaredLogger, enforcerImpl, userServiceImpl, ssoLoginServiceImpl) ssoLoginRouterImpl := sso2.NewSsoLoginRouterImpl(ssoLoginRestHandlerImpl)