@@ -24,6 +24,8 @@ import (
24
24
app2 "github.com/devtron-labs/devtron/api/restHandler/app/pipeline/configure"
25
25
"github.com/devtron-labs/devtron/internal/sql/constants"
26
26
appWorkflowBean "github.com/devtron-labs/devtron/pkg/appWorkflow/bean"
27
+ read2 "github.com/devtron-labs/devtron/pkg/build/git/gitMaterial/read"
28
+ repository3 "github.com/devtron-labs/devtron/pkg/build/git/gitMaterial/repository"
27
29
"github.com/devtron-labs/devtron/pkg/build/git/gitProvider"
28
30
"github.com/devtron-labs/devtron/pkg/build/git/gitProvider/read"
29
31
pipelineBean "github.com/devtron-labs/devtron/pkg/build/pipeline/bean"
@@ -91,7 +93,7 @@ type CoreAppRestHandlerImpl struct {
91
93
appListingService app.AppListingService
92
94
propertiesConfigService pipeline.PropertiesConfigService
93
95
appWorkflowService appWorkflow.AppWorkflowService
94
- materialRepository pipelineConfig. MaterialRepository
96
+ gitMaterialReadService read2. GitMaterialReadService
95
97
appWorkflowRepository appWorkflow2.AppWorkflowRepository
96
98
environmentRepository repository2.EnvironmentRepository
97
99
configMapRepository chartConfig.ConfigMapRepository
@@ -106,11 +108,11 @@ func NewCoreAppRestHandlerImpl(logger *zap.SugaredLogger, userAuthService user.U
106
108
enforcer casbin.Enforcer , appCrudOperationService app.AppCrudOperationService , pipelineBuilder pipeline.PipelineBuilder , gitRegistryService gitProvider.GitRegistryConfig ,
107
109
chartService chart.ChartService , configMapService pipeline.ConfigMapService , appListingService app.AppListingService ,
108
110
propertiesConfigService pipeline.PropertiesConfigService , appWorkflowService appWorkflow.AppWorkflowService ,
109
- materialRepository pipelineConfig.MaterialRepository ,
110
111
appWorkflowRepository appWorkflow2.AppWorkflowRepository , environmentRepository repository2.EnvironmentRepository , configMapRepository chartConfig.ConfigMapRepository ,
111
112
chartRepo chartRepoRepository.ChartRepository , teamService team.TeamService ,
112
113
argoUserService argo.ArgoUserService , pipelineStageService pipeline.PipelineStageService , ciPipelineRepository pipelineConfig.CiPipelineRepository ,
113
- gitProviderReadService read.GitProviderReadService ) * CoreAppRestHandlerImpl {
114
+ gitProviderReadService read.GitProviderReadService ,
115
+ gitMaterialReadService read2.GitMaterialReadService ) * CoreAppRestHandlerImpl {
114
116
handler := & CoreAppRestHandlerImpl {
115
117
logger : logger ,
116
118
userAuthService : userAuthService ,
@@ -126,7 +128,7 @@ func NewCoreAppRestHandlerImpl(logger *zap.SugaredLogger, userAuthService user.U
126
128
appListingService : appListingService ,
127
129
propertiesConfigService : propertiesConfigService ,
128
130
appWorkflowService : appWorkflowService ,
129
- materialRepository : materialRepository ,
131
+ gitMaterialReadService : gitMaterialReadService ,
130
132
appWorkflowRepository : appWorkflowRepository ,
131
133
environmentRepository : environmentRepository ,
132
134
configMapRepository : configMapRepository ,
@@ -514,7 +516,7 @@ func (handler CoreAppRestHandlerImpl) buildDockerConfig(appId int) (*appBean.Doc
514
516
}
515
517
516
518
//getting gitMaterialUrl by id
517
- gitMaterial , err := handler .materialRepository .FindById (ciConfig .CiBuildConfig .GitMaterialId )
519
+ gitMaterial , err := handler .gitMaterialReadService .FindById (ciConfig .CiBuildConfig .GitMaterialId )
518
520
if err != nil {
519
521
handler .logger .Errorw ("error in fetching materialUrl by ID in GetAppAllDetail" , "err" , err , "gitMaterialId" , ciConfig .CiBuildConfig .GitMaterialId )
520
522
return nil , err , http .StatusInternalServerError
@@ -730,7 +732,7 @@ func (handler CoreAppRestHandlerImpl) buildCiPipelineResp(appId int, ciPipeline
730
732
//build ciPipelineMaterial resp
731
733
var ciPipelineMaterialsConfig []* appBean.CiPipelineMaterialConfig
732
734
for _ , ciMaterial := range ciPipeline .CiMaterial {
733
- gitMaterial , err := handler .materialRepository .FindById (ciMaterial .GitMaterialId )
735
+ gitMaterial , err := handler .gitMaterialReadService .FindById (ciMaterial .GitMaterialId )
734
736
if err != nil {
735
737
handler .logger .Errorw ("service err, GitMaterialById in GetAppAllDetail" , "err" , err , "appId" , appId )
736
738
return nil , err
@@ -1346,7 +1348,7 @@ func (handler CoreAppRestHandlerImpl) createDockerConfig(appId int, dockerConfig
1346
1348
}
1347
1349
1348
1350
//finding gitMaterial by appId and checkoutPath
1349
- gitMaterial , err := handler .materialRepository .FindByAppIdAndCheckoutPath (appId , dockerConfig .CheckoutPath )
1351
+ gitMaterial , err := handler .gitMaterialReadService .FindByAppIdAndCheckoutPath (appId , dockerConfig .CheckoutPath )
1350
1352
if err != nil {
1351
1353
handler .logger .Errorw ("service err, FindByAppIdAndCheckoutPath in CreateDockerConfig" , "err" , err , "appId" , appId )
1352
1354
return err , http .StatusInternalServerError
@@ -1633,14 +1635,14 @@ func (handler CoreAppRestHandlerImpl) createCiPipeline(appId int, userId int32,
1633
1635
// build ci pipeline materials starts
1634
1636
var ciMaterialsRequest []* bean.CiMaterial
1635
1637
for _ , ciMaterial := range ciPipelineData .CiPipelineMaterialsConfig {
1636
- var gitMaterial * pipelineConfig .GitMaterial
1638
+ var gitMaterial * repository3 .GitMaterial
1637
1639
var err error
1638
1640
if ciPipelineData .ParentCiPipeline == 0 && ciPipelineData .ParentAppId == 0 {
1639
1641
//finding gitMaterial by appId and checkoutPath
1640
- gitMaterial , err = handler .materialRepository .FindByAppIdAndCheckoutPath (appId , ciMaterial .CheckoutPath )
1642
+ gitMaterial , err = handler .gitMaterialReadService .FindByAppIdAndCheckoutPath (appId , ciMaterial .CheckoutPath )
1641
1643
} else {
1642
1644
//if linked CI find git material by it's parentAppId and Id
1643
- gitMaterial , err = handler .materialRepository .FindByAppIdAndGitMaterialId (ciPipelineData .ParentAppId , ciMaterial .GitMaterialId )
1645
+ gitMaterial , err = handler .gitMaterialReadService .FindByAppIdAndGitMaterialId (ciPipelineData .ParentAppId , ciMaterial .GitMaterialId )
1644
1646
}
1645
1647
if err != nil {
1646
1648
handler .logger .Errorw ("service err, FindByAppIdAndCheckoutPath in CreateWorkflows" , "err" , err , "appId" , appId )
@@ -2172,7 +2174,7 @@ func (handler CoreAppRestHandlerImpl) ValidateAppWorkflowRequest(createAppWorkfl
2172
2174
ciMaterialCheckoutPaths := make ([]string , 0 )
2173
2175
for _ , ciPipelineMaterialConfig := range workflow .CiPipeline .CiPipelineMaterialsConfig {
2174
2176
// value for webhook type CiPipelineMaterial should be a valid json string
2175
- if ciPipelineMaterialConfig .Type == pipelineConfig .SOURCE_TYPE_WEBHOOK {
2177
+ if ciPipelineMaterialConfig .Type == constants .SOURCE_TYPE_WEBHOOK {
2176
2178
var jsonValueMap map [string ]interface {}
2177
2179
err := json .Unmarshal ([]byte (ciPipelineMaterialConfig .Value ), & jsonValueMap )
2178
2180
if err != nil {
0 commit comments