Skip to content

Commit 97cc4bf

Browse files
Merge branch 'main' into release-bot
2 parents d5d86e8 + 5d1afe0 commit 97cc4bf

File tree

5,916 files changed

+820726
-283067
lines changed

Some content is hidden

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

5,916 files changed

+820726
-283067
lines changed

.nojekyll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.21 AS build-env
1+
FROM golang:1.24.0 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.21 AS build-env
1+
FROM golang:1.24.0 AS build-env
22

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

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
all: fetch-all-env build
44

5-
TARGET_BRANCH?=main
5+
TARGET_BRANCH?=develop
66
TAG?=$(shell bash -c 'git log --pretty=format:'%h' -n 1')
77
FLAGS=
88
ENVVAR=

Wire.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ import (
9393
"github.com/devtron-labs/devtron/client/cron"
9494
"github.com/devtron-labs/devtron/client/dashboard"
9595
eClient "github.com/devtron-labs/devtron/client/events"
96+
"github.com/devtron-labs/devtron/client/fluxcd"
9697
"github.com/devtron-labs/devtron/client/gitSensor"
9798
"github.com/devtron-labs/devtron/client/grafana"
9899
"github.com/devtron-labs/devtron/client/lens"
@@ -223,6 +224,7 @@ func InitializeApp() (*App, error) {
223224
policyGovernance.PolicyGovernanceWireSet,
224225
resourceScan.ScanningResultWireSet,
225226
executor.ExecutorWireSet,
227+
fluxcd.DeploymentWireSet,
226228
// -------wireset end ----------
227229
// -------
228230
gitSensor.GetConfig,
@@ -754,6 +756,10 @@ func InitializeApp() (*App, error) {
754756

755757
deployment3.NewFullModeDeploymentServiceImpl,
756758
wire.Bind(new(deployment3.FullModeDeploymentService), new(*deployment3.FullModeDeploymentServiceImpl)),
759+
760+
deployment3.NewFullModeFluxDeploymentServiceImpl,
761+
wire.Bind(new(deployment3.FullModeFluxDeploymentService), new(*deployment3.FullModeFluxDeploymentServiceImpl)),
762+
757763
// util2.NewGoJsonSchemaCustomFormatChecker,
758764

759765
//history starts

api/cluster/ClusterRestHandler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ func (impl ClusterRestHandlerImpl) DeleteCluster(w http.ResponseWriter, r *http.
556556
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
557557
return
558558
}
559-
var bean bean2.ClusterBean
559+
var bean bean2.DeleteClusterBean
560560
err = decoder.Decode(&bean)
561561
if err != nil {
562562
impl.logger.Errorw("request err, Delete", "error", err, "payload", bean)
@@ -580,7 +580,7 @@ func (impl ClusterRestHandlerImpl) DeleteCluster(w http.ResponseWriter, r *http.
580580
//RBAC enforcer Ends
581581
err = impl.deleteService.DeleteCluster(&bean, userId)
582582
if err != nil {
583-
impl.logger.Errorw("error in deleting cluster", "err", err, "id", bean.Id, "name", bean.ClusterName)
583+
impl.logger.Errorw("error in deleting cluster", "err", err, "id", bean.Id)
584584
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
585585
return
586586
}

api/fluxApplication/FluxApplicationRestHandler.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ func (handler *FluxApplicationRestHandlerImpl) ListFluxApplications(w http.Respo
4545
var clusterIds []int
4646
var err error
4747

48+
noStream := v.Get("noStream") == "true"
49+
4850
//handling when the clusterIds string is empty ,it will not support the
4951
if len(clusterIdString) == 0 {
5052
handler.logger.Errorw("error in getting cluster ids", "error", err, "clusterIds", clusterIds)
@@ -57,7 +59,7 @@ func (handler *FluxApplicationRestHandlerImpl) ListFluxApplications(w http.Respo
5759
return
5860
}
5961
handler.logger.Debugw("extracted ClusterIds successfully ", "clusterIds", clusterIds)
60-
handler.fluxApplicationService.ListFluxApplications(r.Context(), clusterIds, w)
62+
handler.fluxApplicationService.ListFluxApplications(r.Context(), clusterIds, noStream, w)
6163
}
6264

6365
func (handler *FluxApplicationRestHandlerImpl) GetApplicationDetail(w http.ResponseWriter, r *http.Request) {

api/helm-app/gRPC/applist.pb.go

Lines changed: 655 additions & 633 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/helm-app/gRPC/applist.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ message FluxAppDetail{
8686
FluxApplication fluxApplication=1;
8787
FluxAppStatusDetail FluxAppStatusDetail = 2;
8888
ResourceTreeResponse resourceTreeResponse =3;
89+
string applicationStatus = 4;
90+
string lastObservedGeneration = 5;
8991
}
9092

9193
message FluxAppStatusDetail{

api/restHandler/ImageScanRestHandler.go

Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/devtron-labs/devtron/pkg/policyGovernance/security/imageScanning"
2424
securityBean "github.com/devtron-labs/devtron/pkg/policyGovernance/security/imageScanning/bean"
2525
security2 "github.com/devtron-labs/devtron/pkg/policyGovernance/security/imageScanning/repository"
26+
"github.com/devtron-labs/devtron/util/sliceUtil"
2627
"net/http"
2728
"strconv"
2829

@@ -104,6 +105,45 @@ func (impl ImageScanRestHandlerImpl) ScanExecutionList(w http.ResponseWriter, r
104105
return
105106
}
106107
token := r.Header.Get("token")
108+
isSuperAdmin := false
109+
if ok := impl.enforcer.Enforce(token, casbin.ResourceGlobal, casbin.ActionGet, "*"); ok {
110+
isSuperAdmin = true
111+
}
112+
var ids []int
113+
if isSuperAdmin {
114+
ids = sliceUtil.NewSliceFromFuncExec(filteredDeployInfoList, func(item *security2.ImageScanDeployInfo) int {
115+
return item.Id
116+
})
117+
} else {
118+
ids, err = impl.getAuthorisedImageScanDeployInfoIds(token, filteredDeployInfoList)
119+
if err != nil {
120+
impl.logger.Errorw("error in getting authorised image scan deploy info ids", "err", err)
121+
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
122+
return
123+
}
124+
}
125+
126+
if len(ids) == 0 {
127+
responseList := make([]*securityBean.ImageScanHistoryResponse, 0)
128+
common.WriteJsonResp(w, nil, &securityBean.ImageScanHistoryListingResponse{ImageScanHistoryResponse: responseList}, http.StatusOK)
129+
return
130+
}
131+
132+
results, err := impl.imageScanService.FetchScanExecutionListing(request, ids)
133+
if err != nil {
134+
impl.logger.Errorw("service err, ScanExecutionList", "err", err, "payload", request)
135+
if util.IsErrNoRows(err) {
136+
responseList := make([]*securityBean.ImageScanHistoryResponse, 0)
137+
common.WriteJsonResp(w, nil, &securityBean.ImageScanHistoryListingResponse{ImageScanHistoryResponse: responseList}, http.StatusOK)
138+
} else {
139+
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
140+
}
141+
return
142+
}
143+
common.WriteJsonResp(w, err, results, http.StatusOK)
144+
}
145+
146+
func (impl ImageScanRestHandlerImpl) getAuthorisedImageScanDeployInfoIds(token string, filteredDeployInfoList []*security2.ImageScanDeployInfo) ([]int, error) {
107147
var ids []int
108148
var appRBACObjects []string
109149
var envRBACObjects []string
@@ -119,8 +159,8 @@ func (impl ImageScanRestHandlerImpl) ScanExecutionList(w http.ResponseWriter, r
119159

120160
appObjects, envObjects, appIdtoApp, envIdToEnv, err := impl.enforcerUtil.GetAppAndEnvRBACNamesByAppAndEnvIds(IdToAppEnvPairs)
121161
if err != nil {
122-
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
123-
return
162+
impl.logger.Errorw("error in getting app and env rbac objects", "err", err)
163+
return nil, err
124164
}
125165

126166
for _, item := range filteredDeployInfoList {
@@ -136,8 +176,8 @@ func (impl ImageScanRestHandlerImpl) ScanExecutionList(w http.ResponseWriter, r
136176
} else if item.ScanObjectMetaId > 0 && (item.ObjectType == ObjectTypePod) {
137177
environments, err := impl.environmentService.GetByClusterId(item.ClusterId)
138178
if err != nil {
139-
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
140-
return
179+
impl.logger.Errorw("error in getting environments for cluster", "clusterId", item.ClusterId, "err", err)
180+
return nil, err
141181
}
142182
for _, environment := range environments {
143183
podObject := environment.EnvironmentIdentifier
@@ -163,25 +203,7 @@ func (impl ImageScanRestHandlerImpl) ScanExecutionList(w http.ResponseWriter, r
163203
}
164204
}
165205
}
166-
167-
if ids == nil || len(ids) == 0 {
168-
responseList := make([]*securityBean.ImageScanHistoryResponse, 0)
169-
common.WriteJsonResp(w, nil, &securityBean.ImageScanHistoryListingResponse{ImageScanHistoryResponse: responseList}, http.StatusOK)
170-
return
171-
}
172-
173-
results, err := impl.imageScanService.FetchScanExecutionListing(request, ids)
174-
if err != nil {
175-
impl.logger.Errorw("service err, ScanExecutionList", "err", err, "payload", request)
176-
if util.IsErrNoRows(err) {
177-
responseList := make([]*securityBean.ImageScanHistoryResponse, 0)
178-
common.WriteJsonResp(w, nil, &securityBean.ImageScanHistoryListingResponse{ImageScanHistoryResponse: responseList}, http.StatusOK)
179-
} else {
180-
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
181-
}
182-
return
183-
}
184-
common.WriteJsonResp(w, err, results, http.StatusOK)
206+
return ids, nil
185207
}
186208

187209
func (impl ImageScanRestHandlerImpl) FetchExecutionDetail(w http.ResponseWriter, r *http.Request) {

0 commit comments

Comments
 (0)