Skip to content

Commit b4a68c6

Browse files
authored
Merge branch 'develop' into dev-notif
2 parents a00dfc3 + 562938c commit b4a68c6

File tree

325 files changed

+40741
-7653
lines changed

Some content is hidden

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

325 files changed

+40741
-7653
lines changed

Wire.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ import (
102102
appWorkflow2 "github.com/devtron-labs/devtron/internal/sql/repository/appWorkflow"
103103
"github.com/devtron-labs/devtron/internal/sql/repository/bulkUpdate"
104104
"github.com/devtron-labs/devtron/internal/sql/repository/chartConfig"
105-
"github.com/devtron-labs/devtron/internal/sql/repository/deploymentConfig"
106105
dockerRegistryRepository "github.com/devtron-labs/devtron/internal/sql/repository/dockerRegistry"
107106
"github.com/devtron-labs/devtron/internal/sql/repository/helper"
108107
repository8 "github.com/devtron-labs/devtron/internal/sql/repository/imageTagging"
109108
"github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig"
110109
resourceGroup "github.com/devtron-labs/devtron/internal/sql/repository/resourceGroup"
111110
"github.com/devtron-labs/devtron/internal/util"
112111
"github.com/devtron-labs/devtron/pkg/app"
112+
read4 "github.com/devtron-labs/devtron/pkg/app/appDetails/read"
113113
"github.com/devtron-labs/devtron/pkg/app/dbMigration"
114114
"github.com/devtron-labs/devtron/pkg/app/status"
115115
"github.com/devtron-labs/devtron/pkg/appClone"
@@ -128,6 +128,7 @@ import (
128128
"github.com/devtron-labs/devtron/pkg/bulkAction/service"
129129
"github.com/devtron-labs/devtron/pkg/chart"
130130
"github.com/devtron-labs/devtron/pkg/chart/gitOpsConfig"
131+
read2 "github.com/devtron-labs/devtron/pkg/chart/read"
131132
chartRepoRepository "github.com/devtron-labs/devtron/pkg/chartRepo/repository"
132133
"github.com/devtron-labs/devtron/pkg/commonService"
133134
"github.com/devtron-labs/devtron/pkg/config"
@@ -357,6 +358,8 @@ func InitializeApp() (*App, error) {
357358
wire.Bind(new(gitOpsConfig.DevtronAppGitOpConfigService), new(*gitOpsConfig.DevtronAppGitOpConfigServiceImpl)),
358359
chart.NewChartServiceImpl,
359360
wire.Bind(new(chart.ChartService), new(*chart.ChartServiceImpl)),
361+
read2.NewChartReadServiceImpl,
362+
wire.Bind(new(read2.ChartReadService), new(*read2.ChartReadServiceImpl)),
360363
service.NewBulkUpdateServiceImpl,
361364
wire.Bind(new(service.BulkUpdateService), new(*service.BulkUpdateServiceImpl)),
362365

@@ -375,6 +378,10 @@ func InitializeApp() (*App, error) {
375378
wire.Bind(new(appList.AppListingRouter), new(*appList.AppListingRouterImpl)),
376379
appList2.NewAppListingRestHandlerImpl,
377380
wire.Bind(new(appList2.AppListingRestHandler), new(*appList2.AppListingRestHandlerImpl)),
381+
382+
read4.NewAppDetailsReadServiceImpl,
383+
wire.Bind(new(read4.AppDetailsReadService), new(*read4.AppDetailsReadServiceImpl)),
384+
378385
app.NewAppListingServiceImpl,
379386
wire.Bind(new(app.AppListingService), new(*app.AppListingServiceImpl)),
380387
repository.NewAppListingRepositoryImpl,
@@ -622,6 +629,7 @@ func InitializeApp() (*App, error) {
622629
repository9.NewClusterInstalledAppsRepositoryImpl,
623630
wire.Bind(new(repository9.ClusterInstalledAppsRepository), new(*repository9.ClusterInstalledAppsRepositoryImpl)),
624631

632+
commonService.NewCommonBaseServiceImpl,
625633
commonService.NewCommonServiceImpl,
626634
wire.Bind(new(commonService.CommonService), new(*commonService.CommonServiceImpl)),
627635

@@ -659,8 +667,8 @@ func InitializeApp() (*App, error) {
659667

660668
router.NewCommonRouterImpl,
661669
wire.Bind(new(router.CommonRouter), new(*router.CommonRouterImpl)),
662-
restHandler.NewCommonRestHanlderImpl,
663-
wire.Bind(new(restHandler.CommonRestHanlder), new(*restHandler.CommonRestHanlderImpl)),
670+
restHandler.NewCommonRestHandlerImpl,
671+
wire.Bind(new(restHandler.CommonRestHandler), new(*restHandler.CommonRestHandlerImpl)),
664672

665673
router.NewScopedVariableRouterImpl,
666674
wire.Bind(new(router.ScopedVariableRouter), new(*router.ScopedVariableRouterImpl)),
@@ -941,11 +949,7 @@ func InitializeApp() (*App, error) {
941949
cel.NewCELServiceImpl,
942950
wire.Bind(new(cel.EvaluatorService), new(*cel.EvaluatorServiceImpl)),
943951

944-
deploymentConfig.NewRepositoryImpl,
945-
wire.Bind(new(deploymentConfig.Repository), new(*deploymentConfig.RepositoryImpl)),
946-
947-
common.NewDeploymentConfigServiceImpl,
948-
wire.Bind(new(common.DeploymentConfigService), new(*common.DeploymentConfigServiceImpl)),
952+
common.WireSet,
949953

950954
repoCredsK8sClient.NewRepositoryCredsK8sClientImpl,
951955
wire.Bind(new(repoCredsK8sClient.RepositoryCredsK8sClient), new(*repoCredsK8sClient.RepositoryCredsK8sClientImpl)),

WiringNilCheck.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ func skipUnnecessaryFieldsForCheck(fieldName, valName string) bool {
114114
"modulecronserviceimpl": {"cron"},
115115
"oteltracingserviceimpl": {"traceprovider"},
116116
"terminalaccessrepositoryimpl": {"templatescache"},
117+
"grpcapiclientimpl": {"serviceclient"},
118+
"serverenvconfig": {"errorencounteredongettingdevtronhelmrelease"},
117119
}
118120
if _, ok := fieldAndValName[valName]; ok {
119121
for _, ignoreFieldName := range fieldAndValName[valName] {

api/argoApplication/ArgoApplicationRestHandler.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package argoApplication
1818

1919
import (
20+
"context"
2021
"errors"
2122
"github.com/devtron-labs/devtron/api/restHandler/common"
2223
"github.com/devtron-labs/devtron/pkg/argoApplication"
@@ -89,6 +90,9 @@ func (handler *ArgoApplicationRestHandlerImpl) GetApplicationDetail(w http.Respo
8990
common.WriteJsonResp(w, errors.New("unauthorized"), nil, http.StatusForbidden)
9091
return
9192
}
93+
ctx := r.Context()
94+
ctx = context.WithValue(ctx, "token", token)
95+
9296
var err error
9397
v := r.URL.Query()
9498
resourceName := v.Get("name")
@@ -104,7 +108,7 @@ func (handler *ArgoApplicationRestHandlerImpl) GetApplicationDetail(w http.Respo
104108
return
105109
}
106110
}
107-
resp, err := handler.readService.GetAppDetail(resourceName, namespace, clusterId)
111+
resp, err := handler.readService.GetAppDetailEA(ctx, resourceName, namespace, clusterId)
108112
if err != nil {
109113
handler.logger.Errorw("error in getting argo application app detail", "err", err, "resourceName", resourceName, "clusterId", clusterId)
110114
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)

api/argoApplication/wire_argoApplication.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var ArgoApplicationWireSetFull = wire.NewSet(
3030
config.NewArgoApplicationConfigServiceImpl,
3131
wire.Bind(new(config.ArgoApplicationConfigService), new(*config.ArgoApplicationConfigServiceImpl)),
3232

33+
argoApplication.NewArgoApplicationServiceImpl,
3334
argoApplication.NewArgoApplicationServiceExtendedServiceImpl,
3435
wire.Bind(new(argoApplication.ArgoApplicationService), new(*argoApplication.ArgoApplicationServiceExtendedImpl)),
3536

api/bean/AppView/AppView.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,3 +294,16 @@ type LinkOuts struct {
294294
Link string `json:"link,omitempty"`
295295
Description string `json:"description,omitempty"`
296296
}
297+
298+
type AppStages struct {
299+
AppId int `json:"app_id,omitempty" sql:"app_id"`
300+
CiTemplateId int `json:"ci_template_id,omitempty" sql:"ci_template_id"`
301+
CiPipelineId int `json:"ci_pipeline_id,omitempty" sql:"ci_pipeline_id"`
302+
ChartId int `json:"chart_id,omitempty" sql:"chart_id"`
303+
ChartGitRepoUrl string `json:"chart_git_repo_url,omitempty" sql:"chart_git_repo_url"`
304+
PipelineId int `json:"pipeline_id,omitempty" sql:"pipeline_id"`
305+
YamlStatus int `json:"yaml_status,omitempty" sql:"yaml_status"`
306+
YamlReviewed bool `json:"yaml_reviewed,omitempty" sql:"yaml_reviewed"`
307+
DeploymentConfigRepoURL string `json:"deployment_config_repo_url" sql:"-"`
308+
GitMaterialExists int `json:"-" sql:"-"`
309+
}

api/bean/gitOps/GitOpsConfig.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,15 @@ type GitOpsConfigDto struct {
4242
IsTLSKeyDataPresent bool `json:"isTLSKeyDataPresent"`
4343

4444
// TODO refactoring: create different struct for internal fields
45-
GitRepoName string `json:"-"`
46-
UserEmailId string `json:"-"`
47-
Description string `json:"-"`
48-
UserId int32 `json:"-"`
45+
GitRepoName string `json:"-"`
46+
TargetRevision string `json:"-"`
47+
UserEmailId string `json:"-"`
48+
Description string `json:"-"`
49+
UserId int32 `json:"-"`
50+
}
51+
52+
func (dto GitOpsConfigDto) GetHostUrl() string {
53+
return dto.Host
4954
}
5055

5156
type GitRepoRequestDto struct {
@@ -80,5 +85,5 @@ func IsGitOpsRepoNotConfigured(gitRepoUrl string) bool {
8085
}
8186

8287
func IsGitOpsRepoConfigured(gitRepoUrl string) bool {
83-
return len(gitRepoUrl) != 0 || gitRepoUrl != GIT_REPO_NOT_CONFIGURED
88+
return !IsGitOpsRepoNotConfigured(gitRepoUrl)
8489
}

api/helm-app/HelmAppRestHandler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/EAMode"
2727
"github.com/devtron-labs/devtron/pkg/argoApplication"
2828
"github.com/devtron-labs/devtron/pkg/argoApplication/helper"
29+
clusterBean "github.com/devtron-labs/devtron/pkg/cluster/bean"
2930
clientErrors "github.com/devtron-labs/devtron/pkg/errors"
3031
"github.com/devtron-labs/devtron/pkg/fluxApplication"
3132
bean2 "github.com/devtron-labs/devtron/pkg/k8s/application/bean"
@@ -467,7 +468,7 @@ func (handler *HelmAppRestHandlerImpl) DeleteApplication(w http.ResponseWriter,
467468
// validate if the devtron-operator helm release, block that for deletion
468469
if appIdentifier.ReleaseName == handler.serverEnvConfig.DevtronHelmReleaseName &&
469470
appIdentifier.Namespace == handler.serverEnvConfig.DevtronHelmReleaseNamespace &&
470-
appIdentifier.ClusterId == bean.DEFAULT_CLUSTER_ID {
471+
appIdentifier.ClusterId == clusterBean.DefaultClusterId {
471472
common.WriteJsonResp(w, errors.New("cannot delete this default helm app"), nil, http.StatusForbidden)
472473
return
473474
}

api/helm-app/bean/bean.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
)
2424

2525
const (
26-
DEFAULT_CLUSTER_ID = 1
2726
SOURCE_DEVTRON_APP SourceAppType = "devtron-app"
2827
SOURCE_HELM_APP SourceAppType = "helm-app"
2928
SOURCE_EXTERNAL_HELM_APP SourceAppType = "external-helm-app"

api/k8s/application/k8sApplicationRestHandler.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ func (handler *K8sApplicationRestHandlerImpl) GetHostUrlsByBatch(w http.Response
253253
}
254254

255255
token := r.Header.Get("token")
256+
ctx := r.Context()
257+
ctx = context.WithValue(ctx, "token", token)
256258
var k8sAppDetail AppView.AppDetailContainer
257259
var resourceTreeResponse *gRPC.ResourceTreeResponse
258260
var clusterId int
@@ -276,7 +278,7 @@ func (handler *K8sApplicationRestHandlerImpl) GetHostUrlsByBatch(w http.Response
276278
return
277279
}
278280
//RBAC enforcer Ends
279-
appDetail, err := handler.helmAppService.GetApplicationDetail(r.Context(), appIdentifier)
281+
appDetail, err := handler.helmAppService.GetApplicationDetail(ctx, appIdentifier)
280282
if err != nil {
281283
apiError := clientErrors.ConvertToApiError(err)
282284
if apiError != nil {
@@ -303,7 +305,7 @@ func (handler *K8sApplicationRestHandlerImpl) GetHostUrlsByBatch(w http.Response
303305
}
304306
//RBAC enforcer Ends
305307

306-
appDetail, err := handler.argoApplicationReadService.GetAppDetail(appIdentifier.AppName, appIdentifier.Namespace, appIdentifier.ClusterId)
308+
appDetail, err := handler.argoApplicationReadService.GetAppDetailEA(r.Context(), appIdentifier.AppName, appIdentifier.Namespace, appIdentifier.ClusterId)
307309
if err != nil {
308310
apiError := clientErrors.ConvertToApiError(err)
309311
if apiError != nil {

api/module/ModuleRestHandler.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package module
1919
import (
2020
"encoding/json"
2121
"errors"
22+
"github.com/devtron-labs/devtron/pkg/module/bean"
2223
"net/http"
2324

2425
"github.com/devtron-labs/devtron/api/restHandler/common"
@@ -135,7 +136,7 @@ func (impl ModuleRestHandlerImpl) HandleModuleAction(w http.ResponseWriter, r *h
135136

136137
// decode request
137138
decoder := json.NewDecoder(r.Body)
138-
var moduleActionRequestDto *module.ModuleActionRequestDto
139+
var moduleActionRequestDto *bean.ModuleActionRequestDto
139140
err = decoder.Decode(&moduleActionRequestDto)
140141
if err != nil {
141142
impl.logger.Errorw("error in decoding request in HandleModuleAction", "err", err)
@@ -184,7 +185,7 @@ func (impl ModuleRestHandlerImpl) EnableModule(w http.ResponseWriter, r *http.Re
184185
}
185186
// decode request
186187
decoder := json.NewDecoder(r.Body)
187-
var moduleEnableRequestDto module.ModuleEnableRequestDto
188+
var moduleEnableRequestDto bean.ModuleEnableRequestDto
188189
err = decoder.Decode(&moduleEnableRequestDto)
189190
if err != nil {
190191
impl.logger.Errorw("error in decoding request in ModuleEnableRequestDto", "err", err)

0 commit comments

Comments
 (0)