Skip to content

Commit 1ee821c

Browse files
committed
develop sync
2 parents 42623d6 + ac9affc commit 1ee821c

File tree

57 files changed

+2496
-317
lines changed

Some content is hidden

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

57 files changed

+2496
-317
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.24.0 AS build-env
1+
FROM golang:1.24.6 AS build-env
22

33
RUN echo $GOPATH && \
44
apt update && \

DockerfileEA

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.24.0 AS build-env
1+
FROM golang:1.24.6 AS build-env
22

33
RUN echo $GOPATH && \
44
apt update && \

api/appStore/chartGroup/ChartGroupRestHandler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ func (impl *ChartGroupRestHandlerImpl) GetChartGroupWithChartMetaData(w http.Res
191191
}
192192

193193
// Use enhanced parameter parsing with context
194-
chartGroupId, err := common.ExtractIntPathParamWithContext(w, r, "chartGroupId", "chart group")
194+
chartGroupId, err := common.ExtractIntPathParamWithContext(w, r, "chartGroupId")
195195
if err != nil {
196196
// Error already written by ExtractIntPathParamWithContext
197197
return
@@ -223,7 +223,7 @@ func (impl *ChartGroupRestHandlerImpl) GetChartGroupInstallationDetail(w http.Re
223223
}
224224

225225
// Use enhanced parameter parsing with context
226-
chartGroupId, err := common.ExtractIntPathParamWithContext(w, r, "chartGroupId", "chart group")
226+
chartGroupId, err := common.ExtractIntPathParamWithContext(w, r, "chartGroupId")
227227
if err != nil {
228228
// Error already written by ExtractIntPathParamWithContext
229229
return

api/appStore/deployment/AppStoreDeploymentRestHandler.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,10 @@ func (handler AppStoreDeploymentRestHandlerImpl) UpdateInstalledApp(w http.Respo
415415
handler.Logger.Debugw("request payload, UpdateInstalledApp", "payload", request)
416416
installedApp, err := handler.appStoreDeploymentDBService.GetInstalledApp(request.InstalledAppId)
417417
if err != nil {
418+
if util.IsErrNoRows(err) {
419+
common.HandleResourceNotFound(w, r, "installedApp", strconv.Itoa(request.InstalledAppVersionId))
420+
return
421+
}
418422
handler.Logger.Errorw("service err, UpdateInstalledApp", "err", err, "payload", request)
419423
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
420424
return
@@ -461,6 +465,8 @@ func (handler AppStoreDeploymentRestHandlerImpl) UpdateInstalledApp(w http.Respo
461465
if err != nil {
462466
if strings.Contains(err.Error(), "application spec is invalid") {
463467
err = &util.ApiError{Code: "400", HttpStatusCode: 400, UserMessage: "application spec is invalid, please check provided chart values"}
468+
} else if util.IsErrNoRows(err) {
469+
handler.Logger.Errorw("installed app not found", "err", err, "payload", request)
464470
}
465471
handler.Logger.Errorw("service err, UpdateInstalledApp", "err", err, "payload", request)
466472
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)

api/appStore/deployment/CommonDeploymentRestHandler.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ func (handler *CommonDeploymentRestHandlerImpl) getAppOfferingMode(installedAppI
8787
if len(appId) > 0 {
8888
appIdentifier, err := handler.helmAppService.DecodeAppId(appId)
8989
if err != nil {
90-
err = &util.ApiError{HttpStatusCode: http.StatusBadRequest, UserMessage: "invalid app id"}
90+
// err = &util.ApiError{HttpStatusCode: http.StatusBadRequest, UserMessage: "invalid app id"}
9191
return appOfferingMode, installedAppDto, err
9292
}
9393
installedAppDto, err = handler.installedAppService.GetInstalledAppByClusterNamespaceAndName(appIdentifier)
9494
if err != nil {
95-
err = &util.ApiError{HttpStatusCode: http.StatusBadRequest, UserMessage: "unable to find app in database"}
95+
// err = &util.ApiError{HttpStatusCode: http.StatusBadRequest, UserMessage: "unable to find app in database"}
9696
return appOfferingMode, installedAppDto, err
9797
}
9898
// this is the case when hyperion apps does not linked yet
@@ -103,7 +103,7 @@ func (handler *CommonDeploymentRestHandlerImpl) getAppOfferingMode(installedAppI
103103
installedAppDto.AppOfferingMode = appOfferingMode
104104
appIdentifier, err := handler.helmAppService.DecodeAppId(appId)
105105
if err != nil {
106-
err = &util.ApiError{HttpStatusCode: http.StatusBadRequest, UserMessage: "invalid app id"}
106+
// err = &util.ApiError{HttpStatusCode: http.StatusBadRequest, UserMessage: "invalid app id, expected format clusterId|namespace|releaseName"}
107107
return appOfferingMode, installedAppDto, err
108108
}
109109
installedAppDto.ClusterId = appIdentifier.ClusterId
@@ -113,16 +113,17 @@ func (handler *CommonDeploymentRestHandlerImpl) getAppOfferingMode(installedAppI
113113
} else if len(installedAppId) > 0 {
114114
installedAppId, err := strconv.Atoi(installedAppId)
115115
if err != nil {
116-
err = &util.ApiError{HttpStatusCode: http.StatusBadRequest, UserMessage: "invalid installed app id"}
116+
handler.Logger.Errorw("Invalid installedAppId expected int value", "installedAppId", installedAppId, "err", err)
117117
return appOfferingMode, installedAppDto, err
118118
}
119119
installedAppDto, err = handler.installedAppService.GetInstalledAppByInstalledAppId(installedAppId)
120120
if err != nil {
121-
err = &util.ApiError{HttpStatusCode: http.StatusBadRequest, UserMessage: "unable to find app in database"}
121+
// err = &util.ApiError{HttpStatusCode: http.StatusBadRequest, UserMessage: "unable to find app in database"}
122122
return appOfferingMode, installedAppDto, err
123123
}
124124
} else {
125125
err := &util.ApiError{HttpStatusCode: http.StatusBadRequest, UserMessage: "app id missing in request"}
126+
handler.Logger.Errorw("appId is missing and is a required field", "appId", appId, "err", err)
126127
return appOfferingMode, installedAppDto, err
127128
}
128129
if installedAppDto != nil && installedAppDto.InstalledAppId > 0 {
@@ -188,6 +189,7 @@ func (handler *CommonDeploymentRestHandlerImpl) GetDeploymentHistoryValues(w htt
188189
v := r.URL.Query()
189190
installedAppId := v.Get("installedAppId")
190191
appId := v.Get("appId")
192+
191193
appOfferingMode, installedAppDto, err := handler.getAppOfferingMode(installedAppId, appId)
192194
if err != nil {
193195
common.WriteJsonResp(w, err, "bad request", http.StatusBadRequest)

api/auth/user/UserRestHandler.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func (handler UserRestHandlerImpl) GetById(w http.ResponseWriter, r *http.Reques
210210
}
211211

212212
// Use enhanced parameter parsing with context
213-
id, err := common.ExtractIntPathParamWithContext(w, r, "id", "user")
213+
id, err := common.ExtractIntPathParamWithContext(w, r, "id")
214214
if err != nil {
215215
// Error already written by ExtractIntPathParamWithContext
216216
return
@@ -334,7 +334,7 @@ func (handler UserRestHandlerImpl) DeleteUser(w http.ResponseWriter, r *http.Req
334334
}
335335

336336
// Use enhanced parameter parsing with context
337-
id, err := common.ExtractIntPathParamWithContext(w, r, "id", "user")
337+
id, err := common.ExtractIntPathParamWithContext(w, r, "id")
338338
if err != nil {
339339
// Error already written by ExtractIntPathParamWithContext
340340
return
@@ -427,7 +427,7 @@ func (handler UserRestHandlerImpl) BulkDeleteUsers(w http.ResponseWriter, r *htt
427427

428428
func (handler UserRestHandlerImpl) FetchRoleGroupById(w http.ResponseWriter, r *http.Request) {
429429
// Use enhanced parameter parsing with context
430-
id, err := common.ExtractIntPathParamWithContext(w, r, "id", "role group")
430+
id, err := common.ExtractIntPathParamWithContext(w, r, "id")
431431
if err != nil {
432432
// Error already written by ExtractIntPathParamWithContext
433433
return

api/chartRepo/ChartRepositoryRestHandler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func (handler *ChartRepositoryRestHandlerImpl) GetChartRepoById(w http.ResponseW
8585
}
8686

8787
// Use enhanced parameter parsing with context
88-
id, err := common.ExtractIntPathParamWithContext(w, r, "id", "chart repository")
88+
id, err := common.ExtractIntPathParamWithContext(w, r, "id")
8989
if err != nil {
9090
// Error already written by ExtractIntPathParamWithContext
9191
return

api/cluster/ClusterRestHandler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ func (impl ClusterRestHandlerImpl) FindByIds(w http.ResponseWriter, r *http.Requ
356356

357357
func (impl ClusterRestHandlerImpl) FindById(w http.ResponseWriter, r *http.Request) {
358358
// Use enhanced parameter parsing with context
359-
clusterId, err := common.ExtractIntPathParamWithContext(w, r, "id", "cluster")
359+
clusterId, err := common.ExtractIntPathParamWithContext(w, r, "id")
360360
if err != nil {
361361
// Error already written by ExtractIntPathParamWithContext
362362
return
@@ -734,7 +734,7 @@ func (impl ClusterRestHandlerImpl) GetClusterNamespaces(w http.ResponseWriter, r
734734
isActionUserSuperAdmin = true
735735
}
736736
// extract cluster and handle response on error
737-
clusterId, err := common.ExtractIntPathParamWithContext(w, r, "clusterId", "cluster")
737+
clusterId, err := common.ExtractIntPathParamWithContext(w, r, "clusterId")
738738
if err != nil {
739739
impl.logger.Error("error in parsing clusterId", "clusterId", clusterId, "err", err)
740740
return

api/cluster/EnvironmentRestHandler.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ func (impl EnvironmentRestHandlerImpl) Update(w http.ResponseWriter, r *http.Req
314314

315315
func (impl EnvironmentRestHandlerImpl) FindById(w http.ResponseWriter, r *http.Request) {
316316
// Use enhanced parameter parsing with context
317-
envId, err := common.ExtractIntPathParamWithContext(w, r, "id", "environment")
317+
envId, err := common.ExtractIntPathParamWithContext(w, r, "id")
318318
if err != nil {
319319
// Error already written by ExtractIntPathParamWithContext
320320
return
@@ -447,11 +447,15 @@ func (impl EnvironmentRestHandlerImpl) GetCombinedEnvironmentListForDropDownByCl
447447
id, err := strconv.Atoi(clusterId)
448448
if err != nil {
449449
impl.logger.Errorw("request err, GetCombinedEnvironmentListForDropDownByClusterIds", "err", err, "clusterIdString", clusterIdString)
450-
common.WriteJsonResp(w, err, "please send valid cluster Ids", http.StatusBadRequest)
450+
common.HandleParameterError(w, r, "ids", clusterIdString)
451451
return
452452
}
453453
clusterIds = append(clusterIds, id)
454454
}
455+
} else {
456+
impl.logger.Errorw("request err empty query param, GetCombinedEnvironmentListForDropDownByClusterIds", "err", err, "clusterIdString", clusterIdString)
457+
common.HandleParameterError(w, r, "ids", clusterIdString)
458+
return
455459
}
456460
token := r.Header.Get("token")
457461
clusters, err := impl.environmentClusterMappingsService.GetCombinedEnvironmentListForDropDownByClusterIds(token, clusterIds, impl.rbacEnforcementUtil.CheckAuthorizationForGlobalEnvironment)

api/devtronResource/DevtronResourceHistoryRestHandler.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,16 @@ func (handler *HistoryRestHandlerImpl) GetDeploymentHistory(w http.ResponseWrite
5454
queryParams := apiBean.GetHistoryQueryParams{}
5555
err := decoder.Decode(&queryParams, v)
5656
if err != nil {
57+
handler.logger.Errorw("error in decoding query parameters", "queryParams", v, "err", err)
5758
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
5859
return
5960
}
61+
// Validating that filterCriteria is provided
62+
if len(queryParams.FilterCriteria) == 0 {
63+
handler.logger.Errorw("missing required filterCriteria parameter")
64+
common.HandleParameterError(w, r, "filterCriteria", "")
65+
return
66+
}
6067
decodedReqBean, err := handler.apiReqDecoderService.GetFilterCriteriaParamsForDeploymentHistory(queryParams.FilterCriteria)
6168
if err != nil {
6269
handler.logger.Errorw("error in getting filter criteria params", "err", err, "filterCriteria", queryParams.FilterCriteria)

0 commit comments

Comments
 (0)