Skip to content

Commit 88c5a4b

Browse files
authored
Merge branch 'develop' into api-specs-post
2 parents c37f741 + cd3403b commit 88c5a4b

File tree

229 files changed

+17826
-1312
lines changed

Some content is hidden

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

229 files changed

+17826
-1312
lines changed

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/cluster/EnvironmentRestHandler.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)

api/helm-app/service/helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
func DecodeExternalAppAppId(appId string) (*bean.AppIdentifier, error) {
3030
component := strings.Split(appId, "|")
3131
if len(component) != 3 {
32-
return nil, fmt.Errorf("malformed app id %s", appId)
32+
return nil, fmt.Errorf("malformed appId, appId: %s, expected format clusterId|namespace|releaseName", appId)
3333
}
3434
clusterId, err := strconv.Atoi(component[0])
3535
if err != nil {

api/restHandler/app/pipeline/AutoCompleteRestHandler.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ func (handler DevtronAppAutoCompleteRestHandlerImpl) GetAppListForAutocomplete(w
136136
return
137137
}
138138
} else {
139-
teamIdInt, err = strconv.Atoi(teamId)
139+
teamIdInt, err = common.ExtractIntPathParamWithContext(w, r, "teamId", teamId+" team")
140+
if err != nil {
141+
// Error already written by ExtractIntPathParamWithContext
142+
return
143+
}
140144
if err != nil {
141145
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
142146
return

api/restHandler/app/pipeline/configure/BuildPipelineRestHandler.go

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,15 +1209,21 @@ func (handler *PipelineConfigRestHandlerImpl) FetchMaterialInfo(w http.ResponseW
12091209

12101210
func (handler *PipelineConfigRestHandlerImpl) GetCIPipelineById(w http.ResponseWriter, r *http.Request) {
12111211
token := r.Header.Get("token")
1212-
vars := mux.Vars(r)
1213-
appId, err := strconv.Atoi(vars["appId"])
1212+
// vars := mux.Vars(r)
1213+
//appId, err := strconv.Atoi(vars["appId"])
1214+
appId, err := common.ExtractIntPathParamWithContext(w, r, "appId", "app")
12141215
if err != nil {
1215-
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
1216+
// response already written by ExtractIntPathParamWithContext
1217+
//common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
1218+
handler.Logger.Error("request err getting , GetCIPipelineById", "appId", appId, "err", err)
12161219
return
12171220
}
1218-
pipelineId, err := strconv.Atoi(vars["pipelineId"])
1221+
//pipelineId, err := strconv.Atoi(vars["pipelineId"])
1222+
pipelineId, err := common.ExtractIntPathParamWithContext(w, r, "pipelineId", "pipeline")
12191223
if err != nil {
1220-
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
1224+
// response already written by ExtractIntPathParamWithContext
1225+
// common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
1226+
handler.Logger.Error("request err getting , GetCIPipelineById", "pipelineId", pipelineId, "err", err)
12211227
return
12221228
}
12231229

@@ -1711,20 +1717,29 @@ func (handler *PipelineConfigRestHandlerImpl) FetchWorkflowDetails(w http.Respon
17111717
common.HandleUnauthorized(w, r)
17121718
return
17131719
}
1714-
vars := mux.Vars(r)
1715-
appId, err := strconv.Atoi(vars["appId"])
1720+
// vars := mux.Vars(r)
1721+
// appId, err = strconv.Atoi(vars["appId"])
1722+
appId, err := common.ExtractIntPathParamWithContext(w, r, "appId", "app")
17161723
if err != nil {
1717-
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
1724+
// response already written by ExtractIntPathParamWithContext
1725+
// common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
1726+
handler.Logger.Error("request err getting , FetchWorkflowDetails", "appId", appId, "err", err)
17181727
return
17191728
}
1720-
pipelineId, err := strconv.Atoi(vars["pipelineId"])
1729+
// pipelineId, err := strconv.Atoi(vars["pipelineId"])
1730+
pipelineId, err := common.ExtractIntPathParamWithContext(w, r, "pipelineId", "pipeline")
17211731
if err != nil {
1722-
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
1732+
// response already written by ExtractIntPathParamWithContext
1733+
// common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
1734+
handler.Logger.Error("request err getting , FetchWorkflowDetails", "pipelineId", pipelineId, "err", err)
17231735
return
17241736
}
1725-
buildId, err := strconv.Atoi(vars["workflowId"])
1737+
// buildId, err := strconv.Atoi(vars["workflowId"])
1738+
buildId, err := common.ExtractIntPathParamWithContext(w, r, "workflowId", "workflow")
17261739
if err != nil || buildId == 0 {
1727-
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
1740+
// response already written by ExtractIntPathParamWithContext
1741+
// common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
1742+
handler.Logger.Error("request err getting , FetchWorkflowDetails", "buildId", buildId, "err", err)
17281743
return
17291744
}
17301745
handler.Logger.Infow("request payload, FetchWorkflowDetails", "appId", appId, "pipelineId", pipelineId, "buildId", buildId, "buildId", buildId)

go.mod

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -74,26 +74,26 @@ require (
7474
go.opentelemetry.io/otel/sdk v1.36.0
7575
go.opentelemetry.io/otel/trace v1.36.0
7676
go.uber.org/zap v1.27.0
77-
golang.org/x/crypto v0.38.0
77+
golang.org/x/crypto v0.40.0
7878
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6
79-
golang.org/x/mod v0.24.0
79+
golang.org/x/mod v0.25.0
8080
golang.org/x/oauth2 v0.30.0
8181
google.golang.org/genproto/googleapis/api v0.0.0-20250519155744-55703ea1f237
8282
google.golang.org/grpc v1.72.2
8383
google.golang.org/protobuf v1.36.6
8484
gopkg.in/go-playground/validator.v9 v9.31.0
8585
gopkg.in/igm/sockjs-go.v3 v3.0.0
8686
gopkg.in/yaml.v2 v2.4.0
87-
helm.sh/helm/v3 v3.18.1
88-
k8s.io/api v0.33.1
89-
k8s.io/apimachinery v0.33.1
90-
k8s.io/client-go v0.33.1
87+
helm.sh/helm/v3 v3.18.6
88+
k8s.io/api v0.33.3
89+
k8s.io/apimachinery v0.33.3
90+
k8s.io/client-go v0.33.3
9191
k8s.io/helm v2.12.3+incompatible
92-
k8s.io/kubectl v0.33.0
92+
k8s.io/kubectl v0.33.3
9393
k8s.io/kubernetes v1.33.1
94-
k8s.io/metrics v0.33.0
94+
k8s.io/metrics v0.33.3
9595
k8s.io/utils v0.0.0-20250502105355-0f33e8f1c979
96-
sigs.k8s.io/yaml v1.4.0
96+
sigs.k8s.io/yaml v1.5.0
9797
)
9898

9999
require (
@@ -129,7 +129,7 @@ require (
129129
github.com/casbin/govaluate v1.2.0 // indirect
130130
github.com/cespare/xxhash/v2 v2.3.0 // indirect
131131
github.com/chai2010/gettext-go v1.0.2 // indirect
132-
github.com/cloudflare/circl v1.3.7 // indirect
132+
github.com/cloudflare/circl v1.6.1 // indirect
133133
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
134134
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
135135
github.com/distribution/reference v0.6.0 // indirect
@@ -214,7 +214,7 @@ require (
214214
github.com/sirupsen/logrus v1.9.3 // indirect
215215
github.com/skeema/knownhosts v1.3.0 // indirect
216216
github.com/spf13/cobra v1.9.1 // indirect
217-
github.com/spf13/pflag v1.0.6 // indirect
217+
github.com/spf13/pflag v1.0.7 // indirect
218218
github.com/stoewer/go-strcase v1.3.0 // indirect
219219
github.com/stretchr/objx v0.5.2 // indirect
220220
github.com/syndtr/goleveldb v1.0.0 // indirect
@@ -231,28 +231,28 @@ require (
231231
go.opentelemetry.io/otel/metric v1.36.0 // indirect
232232
go.opentelemetry.io/proto/otlp v1.6.0 // indirect
233233
go.uber.org/multierr v1.11.0 // indirect
234-
golang.org/x/net v0.40.0 // indirect
235-
golang.org/x/sync v0.14.0 // indirect
236-
golang.org/x/sys v0.33.0 // indirect
237-
golang.org/x/term v0.32.0 // indirect
238-
golang.org/x/text v0.25.0 // indirect
234+
golang.org/x/net v0.41.0 // indirect
235+
golang.org/x/sync v0.16.0 // indirect
236+
golang.org/x/sys v0.34.0 // indirect
237+
golang.org/x/term v0.33.0 // indirect
238+
golang.org/x/text v0.27.0 // indirect
239239
golang.org/x/time v0.11.0 // indirect
240240
google.golang.org/api v0.234.0 // indirect
241241
google.golang.org/genproto v0.0.0-20250519155744-55703ea1f237 // indirect
242242
google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237 // indirect
243243
gopkg.in/inf.v0 v0.9.1 // indirect
244244
gopkg.in/warnings.v0 v0.1.2 // indirect
245245
gopkg.in/yaml.v3 v3.0.1 // indirect
246-
k8s.io/apiextensions-apiserver v0.33.0 // indirect
247-
k8s.io/apiserver v0.33.0 // indirect
248-
k8s.io/cli-runtime v0.33.0 // indirect
249-
k8s.io/component-base v0.33.0 // indirect
250-
k8s.io/component-helpers v0.33.0 // indirect
246+
k8s.io/apiextensions-apiserver v0.33.3 // indirect
247+
k8s.io/apiserver v0.33.3 // indirect
248+
k8s.io/cli-runtime v0.33.3 // indirect
249+
k8s.io/component-base v0.33.3 // indirect
250+
k8s.io/component-helpers v0.33.3 // indirect
251251
k8s.io/klog/v2 v2.130.1 // indirect
252252
k8s.io/kube-aggregator v0.33.0 // indirect
253253
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
254254
mellium.im/sasl v0.3.2 // indirect
255-
oras.land/oras-go/v2 v2.5.0 // indirect
255+
oras.land/oras-go/v2 v2.6.0 // indirect
256256
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
257257
sigs.k8s.io/kustomize/api v0.19.0 // indirect
258258
sigs.k8s.io/kustomize/kyaml v0.19.0 // indirect
@@ -317,6 +317,7 @@ require (
317317
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 // indirect
318318
github.com/perimeterx/marshmallow v1.1.5 // indirect
319319
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
320+
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
320321
github.com/speakeasy-api/jsonpath v0.6.0 // indirect
321322
github.com/speakeasy-api/openapi-overlay v0.10.2 // indirect
322323
github.com/spiffe/go-spiffe/v2 v2.5.0 // indirect
@@ -326,7 +327,9 @@ require (
326327
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
327328
go.opentelemetry.io/contrib/detectors/gcp v1.36.0 // indirect
328329
go.opentelemetry.io/otel/sdk/metric v1.36.0 // indirect
329-
golang.org/x/tools v0.33.0 // indirect
330+
go.yaml.in/yaml/v2 v2.4.2 // indirect
331+
go.yaml.in/yaml/v3 v3.0.3 // indirect
332+
golang.org/x/tools v0.34.0 // indirect
330333
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
331334
k8s.io/controller-manager v0.33.0 // indirect
332335
sigs.k8s.io/randfill v1.0.0 // indirect
@@ -335,7 +338,7 @@ require (
335338
replace (
336339
github.com/argoproj/argo-workflows/v3 v3.5.13 => github.com/devtron-labs/argo-workflows/v3 v3.5.13
337340
github.com/cyphar/filepath-securejoin v0.4.1 => github.com/cyphar/filepath-securejoin v0.3.6 // indirect
338-
github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250806142853-d5a47198188d
339-
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250806142853-d5a47198188d
341+
github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250902070957-ff08ef4190df
342+
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250902070957-ff08ef4190df
340343
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 => go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1
341344
)

0 commit comments

Comments
 (0)