Skip to content

Commit eae4ea6

Browse files
Merge pull request #6291 from devtron-labs/release-candidate-v0.27.0
sync: Release candidate v0.27.0
2 parents d4aff12 + d6eb9d4 commit eae4ea6

File tree

309 files changed

+34926
-9408
lines changed

Some content is hidden

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

309 files changed

+34926
-9408
lines changed

App.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package main
1919
import (
2020
"context"
2121
"crypto/tls"
22+
"errors"
2223
"fmt"
2324
"github.com/devtron-labs/common-lib/middlewares"
2425
pubsub "github.com/devtron-labs/common-lib/pubsub-lib"
@@ -137,7 +138,7 @@ func (app *App) Start() {
137138
err = server.ListenAndServe()
138139
}
139140
//err := http.ListenAndServe(fmt.Sprintf(":%d", port), auth.Authorizer(app.Enforcer, app.sessionManager)(app.MuxRouter.Router))
140-
if err != nil {
141+
if err != nil && !errors.Is(err, http.ErrServerClosed) {
141142
app.Logger.Errorw("error in startup", "err", err)
142143
os.Exit(2)
143144
}

Wire.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,11 @@ import (
8282
"github.com/devtron-labs/devtron/client/argocdServer/certificate"
8383
cluster2 "github.com/devtron-labs/devtron/client/argocdServer/cluster"
8484
"github.com/devtron-labs/devtron/client/argocdServer/connection"
85+
"github.com/devtron-labs/devtron/client/argocdServer/repoCredsK8sClient"
8586
repocreds "github.com/devtron-labs/devtron/client/argocdServer/repocreds"
8687
repository2 "github.com/devtron-labs/devtron/client/argocdServer/repository"
8788
session2 "github.com/devtron-labs/devtron/client/argocdServer/session"
89+
"github.com/devtron-labs/devtron/client/argocdServer/version"
8890
"github.com/devtron-labs/devtron/client/cron"
8991
"github.com/devtron-labs/devtron/client/dashboard"
9092
eClient "github.com/devtron-labs/devtron/client/events"
@@ -117,7 +119,6 @@ import (
117119
repository9 "github.com/devtron-labs/devtron/pkg/appStore/installedApp/repository"
118120
deployment3 "github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/FullMode/deployment"
119121
"github.com/devtron-labs/devtron/pkg/appWorkflow"
120-
"github.com/devtron-labs/devtron/pkg/argoRepositoryCreds"
121122
"github.com/devtron-labs/devtron/pkg/asyncProvider"
122123
"github.com/devtron-labs/devtron/pkg/attributes"
123124
"github.com/devtron-labs/devtron/pkg/build"
@@ -167,7 +168,6 @@ import (
167168
workflow3 "github.com/devtron-labs/devtron/pkg/workflow"
168169
"github.com/devtron-labs/devtron/pkg/workflow/dag"
169170
util2 "github.com/devtron-labs/devtron/util"
170-
"github.com/devtron-labs/devtron/util/argo"
171171
cron2 "github.com/devtron-labs/devtron/util/cron"
172172
"github.com/devtron-labs/devtron/util/rbac"
173173
"github.com/google/wire"
@@ -449,8 +449,8 @@ func InitializeApp() (*App, error) {
449449
wire.Bind(new(repository8.ImageTaggingRepository), new(*repository8.ImageTaggingRepositoryImpl)),
450450
imageTagging.NewImageTaggingServiceImpl,
451451
wire.Bind(new(imageTagging.ImageTaggingService), new(*imageTagging.ImageTaggingServiceImpl)),
452-
argocdServer.NewVersionServiceImpl,
453-
wire.Bind(new(argocdServer.VersionService), new(*argocdServer.VersionServiceImpl)),
452+
version.NewVersionServiceImpl,
453+
wire.Bind(new(version.VersionService), new(*version.VersionServiceImpl)),
454454

455455
router.NewGitProviderRouterImpl,
456456
wire.Bind(new(router.GitProviderRouter), new(*router.GitProviderRouterImpl)),
@@ -801,9 +801,9 @@ func InitializeApp() (*App, error) {
801801

802802
connection.NewArgoCDConnectionManagerImpl,
803803
wire.Bind(new(connection.ArgoCDConnectionManager), new(*connection.ArgoCDConnectionManagerImpl)),
804-
argo.NewArgoUserServiceImpl,
805-
wire.Bind(new(argo.ArgoUserService), new(*argo.ArgoUserServiceImpl)),
806-
//util2.GetEnvironmentVariables,
804+
//argo.NewArgoUserServiceImpl,
805+
//wire.Bind(new(argo.ArgoUserService), new(*argo.ArgoUserServiceImpl)),
806+
////util2.GetEnvironmentVariables,
807807
// AuthWireSet,
808808

809809
cron.NewCdApplicationStatusUpdateHandlerImpl,
@@ -950,8 +950,8 @@ func InitializeApp() (*App, error) {
950950
common.NewDeploymentConfigServiceImpl,
951951
wire.Bind(new(common.DeploymentConfigService), new(*common.DeploymentConfigServiceImpl)),
952952

953-
argoRepositoryCreds.NewRepositorySecret,
954-
wire.Bind(new(argoRepositoryCreds.RepositorySecret), new(*argoRepositoryCreds.RepositorySecretImpl)),
953+
repoCredsK8sClient.NewRepositorySecret,
954+
wire.Bind(new(repoCredsK8sClient.RepositoryCreds), new(*repoCredsK8sClient.RepositorySecretImpl)),
955955

956956
repocreds.NewServiceClientImpl,
957957
wire.Bind(new(repocreds.ServiceClient), new(*repocreds.ServiceClientImpl)),

api/appStore/InstalledAppRestHandler.go

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,21 @@ import (
2121
"encoding/json"
2222
"errors"
2323
"fmt"
24+
bean2 "github.com/devtron-labs/devtron/api/bean/AppView"
2425
client "github.com/devtron-labs/devtron/api/helm-app/gRPC"
2526
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/FullMode"
2627
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/FullMode/deploymentTypeChange"
2728
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/FullMode/resource"
2829
util3 "github.com/devtron-labs/devtron/pkg/appStore/util"
2930
"github.com/devtron-labs/devtron/pkg/bean"
31+
"github.com/devtron-labs/devtron/pkg/cluster/read"
3032
"gopkg.in/go-playground/validator.v9"
3133
"net/http"
3234
"reflect"
3335
"strconv"
3436
"strings"
3537
"time"
3638

37-
bean2 "github.com/devtron-labs/devtron/api/bean"
3839
"github.com/devtron-labs/devtron/api/restHandler/common"
3940
"github.com/devtron-labs/devtron/client/argocdServer/application"
4041
"github.com/devtron-labs/devtron/client/cron"
@@ -50,7 +51,6 @@ import (
5051
"github.com/devtron-labs/devtron/pkg/auth/user"
5152
"github.com/devtron-labs/devtron/pkg/cluster"
5253
"github.com/devtron-labs/devtron/util"
53-
"github.com/devtron-labs/devtron/util/argo"
5454
"github.com/devtron-labs/devtron/util/rbac"
5555
"github.com/devtron-labs/devtron/util/response"
5656
"github.com/go-pg/pg"
@@ -88,11 +88,11 @@ type InstalledAppRestHandlerImpl struct {
8888
appStoreDeploymentService service.AppStoreDeploymentService
8989
appStoreDeploymentDBService service.AppStoreDeploymentDBService
9090
helmAppClient client.HelmAppClient
91-
argoUserService argo.ArgoUserService
9291
cdApplicationStatusUpdateHandler cron.CdApplicationStatusUpdateHandler
9392
installedAppRepository repository.InstalledAppRepository
9493
appCrudOperationService app2.AppCrudOperationService
9594
installedAppDeploymentTypeChangeService deploymentTypeChange.InstalledAppDeploymentTypeChangeService
95+
clusterReadService read.ClusterReadService
9696
}
9797

9898
func NewInstalledAppRestHandlerImpl(Logger *zap.SugaredLogger, userAuthService user.UserService,
@@ -102,11 +102,13 @@ func NewInstalledAppRestHandlerImpl(Logger *zap.SugaredLogger, userAuthService u
102102
chartGroupService chartGroup.ChartGroupService, validator *validator.Validate, clusterService cluster.ClusterService,
103103
acdServiceClient application.ServiceClient, appStoreDeploymentService service.AppStoreDeploymentService,
104104
appStoreDeploymentDBService service.AppStoreDeploymentDBService,
105-
helmAppClient client.HelmAppClient, argoUserService argo.ArgoUserService,
105+
helmAppClient client.HelmAppClient,
106+
106107
cdApplicationStatusUpdateHandler cron.CdApplicationStatusUpdateHandler,
107108
installedAppRepository repository.InstalledAppRepository,
108109
appCrudOperationService app2.AppCrudOperationService,
109-
installedAppDeploymentTypeChangeService deploymentTypeChange.InstalledAppDeploymentTypeChangeService) *InstalledAppRestHandlerImpl {
110+
installedAppDeploymentTypeChangeService deploymentTypeChange.InstalledAppDeploymentTypeChangeService,
111+
clusterReadService read.ClusterReadService) *InstalledAppRestHandlerImpl {
110112
return &InstalledAppRestHandlerImpl{
111113
Logger: Logger,
112114
userAuthService: userAuthService,
@@ -122,11 +124,11 @@ func NewInstalledAppRestHandlerImpl(Logger *zap.SugaredLogger, userAuthService u
122124
appStoreDeploymentService: appStoreDeploymentService,
123125
appStoreDeploymentDBService: appStoreDeploymentDBService,
124126
helmAppClient: helmAppClient,
125-
argoUserService: argoUserService,
126127
cdApplicationStatusUpdateHandler: cdApplicationStatusUpdateHandler,
127128
installedAppRepository: installedAppRepository,
128129
appCrudOperationService: appCrudOperationService,
129130
installedAppDeploymentTypeChangeService: installedAppDeploymentTypeChangeService,
131+
clusterReadService: clusterReadService,
130132
}
131133
}
132134
func (handler *InstalledAppRestHandlerImpl) FetchAppOverview(w http.ResponseWriter, r *http.Request) {
@@ -550,7 +552,7 @@ func (impl *InstalledAppRestHandlerImpl) DefaultComponentInstallation(w http.Res
550552
return
551553
}
552554
impl.Logger.Errorw("request payload, DefaultComponentInstallation", "clusterId", clusterId)
553-
cluster, err := impl.clusterService.FindById(clusterId)
555+
cluster, err := impl.clusterReadService.FindById(clusterId)
554556
if err != nil {
555557
impl.Logger.Errorw("service err, DefaultComponentInstallation", "error", err, "clusterId", clusterId)
556558
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
@@ -648,13 +650,6 @@ func (handler *InstalledAppRestHandlerImpl) DeleteArgoInstalledAppWithNonCascade
648650
return
649651
}
650652
//rback block ends here
651-
acdToken, err := handler.argoUserService.GetLatestDevtronArgoCdUserToken()
652-
if err != nil {
653-
handler.Logger.Errorw("error in getting acd token", "err", err)
654-
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
655-
return
656-
}
657-
ctx := context.WithValue(r.Context(), "token", acdToken)
658653
request := &appStoreBean.InstallAppVersionDTO{}
659654
request.InstalledAppId = installedAppId
660655
request.AppName = installedApp.AppName
@@ -668,7 +663,7 @@ func (handler *InstalledAppRestHandlerImpl) DeleteArgoInstalledAppWithNonCascade
668663
request.Namespace = installedApp.Namespace
669664
request.AcdPartialDelete = true
670665

671-
request, err = handler.appStoreDeploymentService.DeleteInstalledApp(ctx, request)
666+
request, err = handler.appStoreDeploymentService.DeleteInstalledApp(r.Context(), request)
672667
if err != nil {
673668
handler.Logger.Errorw("service err, DeleteInstalledApp", "err", err, "installAppId", installedAppId)
674669
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)

api/appStore/deployment/AppStoreDeploymentRestHandler.go

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import (
3333
"github.com/devtron-labs/devtron/pkg/auth/authorisation/casbin"
3434
"github.com/devtron-labs/devtron/pkg/auth/user"
3535
util2 "github.com/devtron-labs/devtron/util"
36-
"github.com/devtron-labs/devtron/util/argo"
3736
"github.com/devtron-labs/devtron/util/rbac"
3837
"github.com/go-pg/pg"
3938
"github.com/gorilla/mux"
@@ -64,7 +63,6 @@ type AppStoreDeploymentRestHandlerImpl struct {
6463
appStoreDeploymentDBService service.AppStoreDeploymentDBService
6564
validator *validator.Validate
6665
helmAppService service2.HelmAppService
67-
argoUserService argo.ArgoUserService
6866
installAppService EAMode.InstalledAppDBService
6967
attributesService attributes.AttributesService
7068
}
@@ -73,8 +71,8 @@ func NewAppStoreDeploymentRestHandlerImpl(Logger *zap.SugaredLogger, userAuthSer
7371
enforcer casbin.Enforcer, enforcerUtil rbac.EnforcerUtil, enforcerUtilHelm rbac.EnforcerUtilHelm,
7472
appStoreDeploymentService service.AppStoreDeploymentService,
7573
appStoreDeploymentDBService service.AppStoreDeploymentDBService,
76-
validator *validator.Validate, helmAppService service2.HelmAppService,
77-
argoUserService argo.ArgoUserService,
74+
validator *validator.Validate,
75+
helmAppService service2.HelmAppService,
7876
installAppService EAMode.InstalledAppDBService, attributesService attributes.AttributesService) *AppStoreDeploymentRestHandlerImpl {
7977
return &AppStoreDeploymentRestHandlerImpl{
8078
Logger: Logger,
@@ -86,7 +84,6 @@ func NewAppStoreDeploymentRestHandlerImpl(Logger *zap.SugaredLogger, userAuthSer
8684
appStoreDeploymentDBService: appStoreDeploymentDBService,
8785
validator: validator,
8886
helmAppService: helmAppService,
89-
argoUserService: argoUserService,
9087
installAppService: installAppService,
9188
attributesService: attributesService,
9289
}
@@ -165,16 +162,7 @@ func (handler AppStoreDeploymentRestHandlerImpl) InstallApp(w http.ResponseWrite
165162
}
166163
if util2.IsBaseStack() || util2.IsHelmApp(request.AppOfferingMode) {
167164
ctx = context.WithValue(r.Context(), "token", token)
168-
} else {
169-
acdToken, err := handler.argoUserService.GetLatestDevtronArgoCdUserToken()
170-
if err != nil {
171-
handler.Logger.Errorw("error in getting acd token", "err", err)
172-
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
173-
return
174-
}
175-
ctx = context.WithValue(r.Context(), "token", acdToken)
176165
}
177-
178166
defer cancel()
179167
res, err := handler.appStoreDeploymentService.InstallApp(&request, ctx)
180168
if err != nil {
@@ -348,14 +336,6 @@ func (handler AppStoreDeploymentRestHandlerImpl) DeleteInstalledApp(w http.Respo
348336
}
349337
if util2.IsBaseStack() || util2.IsHelmApp(request.AppOfferingMode) {
350338
ctx = context.WithValue(r.Context(), "token", token)
351-
} else {
352-
acdToken, err := handler.argoUserService.GetLatestDevtronArgoCdUserToken()
353-
if err != nil {
354-
handler.Logger.Errorw("error in getting acd token", "err", err)
355-
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
356-
return
357-
}
358-
ctx = context.WithValue(r.Context(), "token", acdToken)
359339
}
360340

361341
request, err = handler.appStoreDeploymentService.DeleteInstalledApp(ctx, request)
@@ -476,14 +456,6 @@ func (handler AppStoreDeploymentRestHandlerImpl) UpdateInstalledApp(w http.Respo
476456
}
477457
if util2.IsBaseStack() || util2.IsHelmApp(request.AppOfferingMode) {
478458
ctx = context.WithValue(r.Context(), "token", token)
479-
} else {
480-
acdToken, err := handler.argoUserService.GetLatestDevtronArgoCdUserToken()
481-
if err != nil {
482-
handler.Logger.Errorw("error in getting acd token", "err", err)
483-
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
484-
return
485-
}
486-
ctx = context.WithValue(r.Context(), "token", acdToken)
487459
}
488460
res, err := handler.appStoreDeploymentService.UpdateInstalledApp(ctx, &request)
489461
if err != nil {

api/appStore/deployment/CommonDeploymentRestHandler.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import (
3737
"github.com/devtron-labs/devtron/pkg/auth/authorisation/casbin"
3838
"github.com/devtron-labs/devtron/pkg/auth/user"
3939
util2 "github.com/devtron-labs/devtron/util"
40-
"github.com/devtron-labs/devtron/util/argo"
4140
"github.com/devtron-labs/devtron/util/rbac"
4241
"github.com/gorilla/mux"
4342
"go.opentelemetry.io/otel"
@@ -61,15 +60,14 @@ type CommonDeploymentRestHandlerImpl struct {
6160
installedAppService EAMode.InstalledAppDBService
6261
validator *validator.Validate
6362
helmAppService service2.HelmAppService
64-
argoUserService argo.ArgoUserService
6563
attributesService attributes.AttributesService
6664
}
6765

6866
func NewCommonDeploymentRestHandlerImpl(Logger *zap.SugaredLogger, userAuthService user.UserService,
6967
enforcer casbin.Enforcer, enforcerUtil rbac.EnforcerUtil, enforcerUtilHelm rbac.EnforcerUtilHelm,
7068
appStoreDeploymentService service.AppStoreDeploymentService, installedAppService EAMode.InstalledAppDBService,
7169
validator *validator.Validate, helmAppService service2.HelmAppService,
72-
argoUserService argo.ArgoUserService, attributesService attributes.AttributesService) *CommonDeploymentRestHandlerImpl {
70+
attributesService attributes.AttributesService) *CommonDeploymentRestHandlerImpl {
7371
return &CommonDeploymentRestHandlerImpl{
7472
Logger: Logger,
7573
userAuthService: userAuthService,
@@ -80,7 +78,6 @@ func NewCommonDeploymentRestHandlerImpl(Logger *zap.SugaredLogger, userAuthServi
8078
installedAppService: installedAppService,
8179
validator: validator,
8280
helmAppService: helmAppService,
83-
argoUserService: argoUserService,
8481
attributesService: attributesService,
8582
}
8683
}
@@ -305,14 +302,6 @@ func (handler *CommonDeploymentRestHandlerImpl) RollbackApplication(w http.Respo
305302
}
306303
if util2.IsBaseStack() || util2.IsHelmApp(appOfferingMode) {
307304
ctx = context.WithValue(r.Context(), "token", token)
308-
} else {
309-
acdToken, err := handler.argoUserService.GetLatestDevtronArgoCdUserToken()
310-
if err != nil {
311-
handler.Logger.Errorw("error in getting acd token", "err", err)
312-
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
313-
return
314-
}
315-
ctx = context.WithValue(r.Context(), "token", acdToken)
316305
}
317306

318307
defer cancel()

api/bean/AppView.go renamed to api/bean/AppView/AppView.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package bean
17+
package AppView
1818

1919
import (
2020
"encoding/json"

api/bean/Security.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ type CreateVulnerabilityPolicyRequest struct {
2727
Severity string `json:"severity,omitempty"`
2828
}
2929

30+
func (r *CreateVulnerabilityPolicyRequest) IsRequestGlobal() bool {
31+
if r.ClusterId == 0 && r.EnvId == 0 && r.AppId == 0 {
32+
return true
33+
}
34+
return false
35+
}
36+
3037
// CreateVulnerabilityPolicyResponse defines model for CreateVulnerabilityPolicyResponse.
3138
type CreateVulnerabilityPolicyResponse struct {
3239
// Error object

api/bean/ValuesOverrideRequest.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ type ValuesOverrideRequest struct {
8181
PipelineOverrideId int `json:"pipelineOverrideId"` // required for async install/upgrade event;
8282
DeploymentType models.DeploymentType `json:"deploymentType"` // required for async install/upgrade handling; previously if was used internally
8383
ForceSyncDeployment bool `json:"forceSyncDeployment,notnull"`
84+
IsRollbackDeployment bool `json:"isRollbackDeployment"`
8485
UserId int32 `json:"-"`
8586
EnvId int `json:"-"`
8687
EnvName string `json:"-"`

0 commit comments

Comments
 (0)