Skip to content

Commit fcbb193

Browse files
committed
Merge remote-tracking branch 'origin/develop' into fix/buildx-liveness-dailer
2 parents 065799b + 44137a0 commit fcbb193

File tree

198 files changed

+28922
-1335
lines changed

Some content is hidden

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

198 files changed

+28922
-1335
lines changed

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/app/pipeline/configure/BuildPipelineRestHandler.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,8 +625,10 @@ func (handler *PipelineConfigRestHandlerImpl) validateCiTriggerRBAC(token string
625625
appObject := handler.enforcerUtil.GetAppRBACNameByAppId(ciPipeline.AppId)
626626
workflowObject := handler.enforcerUtil.GetWorkflowRBACByCiPipelineId(ciPipelineId, workflowName)
627627
triggerObject := handler.enforcerUtil.GetTeamEnvRBACNameByCiPipelineIdAndEnvIdOrName(ciPipelineId, triggerEnvironmentId, envName)
628-
appRbacOk := handler.enforcer.Enforce(token, casbin.ResourceApplications, casbin.ActionTrigger, appObject)
629-
if !appRbacOk {
628+
var appRbacOk bool
629+
if ciPipeline.App.AppType == helper.CustomApp {
630+
appRbacOk = handler.enforcer.Enforce(token, casbin.ResourceApplications, casbin.ActionTrigger, appObject)
631+
} else if ciPipeline.App.AppType == helper.Job {
630632
appRbacOk = handler.enforcer.Enforce(token, casbin.ResourceJobs, casbin.ActionTrigger, appObject) && handler.enforcer.Enforce(token, casbin.ResourceWorkflow, casbin.ActionTrigger, workflowObject) && handler.enforcer.Enforce(token, casbin.ResourceJobsEnv, casbin.ActionTrigger, triggerObject)
631633
}
632634

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2472,6 +2472,11 @@ func (handler *PipelineConfigRestHandlerImpl) ValidateExternalAppLinkRequest(w h
24722472
common.WriteJsonResp(w, err, response, http.StatusOK)
24732473
return
24742474
// handle helm deployment types
2475+
} else if request.DeploymentAppType == util.PIPELINE_DEPLOYMENT_TYPE_FLUX {
2476+
response := handler.pipelineBuilder.ValidateLinkFluxAppRequest(ctx, &request)
2477+
common.WriteJsonResp(w, err, response, http.StatusOK)
2478+
return
2479+
// handle helm deployment types
24752480
}
24762481
common.WriteJsonResp(w, errors.New("invalid deployment app type in request"), nil, http.StatusBadRequest)
24772482
return
2.35 KB
Loading

client/cron/CdApplicationStatusUpdateHandler.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ func NewCdApplicationStatusUpdateHandlerImpl(logger *zap.SugaredLogger, appServi
115115
logger.Errorw("error in starting argo application status update cron job", "err", err)
116116
return nil
117117
}
118+
_, err = cron.AddFunc("@every 1m", impl.FluxApplicationStatusUpdate)
119+
if err != nil {
120+
logger.Errorw("error in starting argo application status update cron job", "err", err)
121+
return nil
122+
}
118123
return impl
119124
}
120125

@@ -137,6 +142,30 @@ func (impl *CdApplicationStatusUpdateHandlerImpl) HelmApplicationStatusUpdate()
137142
return
138143
}
139144

145+
func (impl *CdApplicationStatusUpdateHandlerImpl) FluxApplicationStatusUpdate() {
146+
cronProcessStartTime := time.Now()
147+
defer func() {
148+
middleware.DeploymentStatusCronDuration.WithLabelValues(pipeline.DEVTRON_APP_FLUX_PIPELINE_STATUS_UPDATE_CRON).Observe(time.Since(cronProcessStartTime).Seconds())
149+
}()
150+
getPipelineDeployedWithinHours := impl.AppStatusConfig.GetPipelineDeployedWithinHours
151+
FluxCDPipelineStatusCheckEligibleTime, err := strconv.Atoi(impl.AppStatusConfig.FluxCDPipelineStatusCheckEligibleTime)
152+
if err != nil {
153+
impl.logger.Errorw("error in converting string to int", "err", err)
154+
return
155+
}
156+
cdPipelineTimeoutDuration, err := strconv.Atoi(impl.AppStatusConfig.CdPipelineStatusTimeoutDuration)
157+
if err != nil {
158+
impl.logger.Errorw("error in converting string to int", "err", err)
159+
return
160+
}
161+
err = impl.workflowStatusService.CheckFluxAppStatusPeriodicallyAndUpdateInDb(FluxCDPipelineStatusCheckEligibleTime, getPipelineDeployedWithinHours, cdPipelineTimeoutDuration)
162+
if err != nil {
163+
impl.logger.Errorw("error helm app status update - cron job", "err", err)
164+
return
165+
}
166+
return
167+
}
168+
140169
func (impl *CdApplicationStatusUpdateHandlerImpl) ArgoApplicationStatusUpdate() {
141170
cronProcessStartTime := time.Now()
142171
defer func() {

0 commit comments

Comments
 (0)