Skip to content

Commit 127203b

Browse files
Merge pull request #6052 from devtron-labs/release-candidate-v0.22.0
release: Release candidate v0.22.0
2 parents b6ba56e + aa975d4 commit 127203b

File tree

24 files changed

+451
-424
lines changed

24 files changed

+451
-424
lines changed

Wire.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ import (
112112
"github.com/devtron-labs/devtron/pkg/appStatus"
113113
"github.com/devtron-labs/devtron/pkg/appStore/chartGroup"
114114
repository4 "github.com/devtron-labs/devtron/pkg/appStore/chartGroup/repository"
115+
repository9 "github.com/devtron-labs/devtron/pkg/appStore/installedApp/repository"
115116
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/FullMode"
116117
deployment3 "github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/FullMode/deployment"
117118
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/FullMode/deploymentTypeChange"
@@ -339,9 +340,6 @@ func InitializeApp() (*App, error) {
339340
pipelineConfig.NewMaterialRepositoryImpl,
340341
wire.Bind(new(pipelineConfig.MaterialRepository), new(*pipelineConfig.MaterialRepositoryImpl)),
341342

342-
util.NewChartTemplateServiceImpl,
343-
wire.Bind(new(util.ChartTemplateService), new(*util.ChartTemplateServiceImpl)),
344-
345343
// scoped variables start
346344
variables.NewScopedVariableServiceImpl,
347345
wire.Bind(new(variables.ScopedVariableService), new(*variables.ScopedVariableServiceImpl)),
@@ -647,6 +645,8 @@ func InitializeApp() (*App, error) {
647645
wire.Bind(new(chartGroup2.ChartGroupRouter), new(*chartGroup2.ChartGroupRouterImpl)),
648646
repository4.NewChartGroupDeploymentRepositoryImpl,
649647
wire.Bind(new(repository4.ChartGroupDeploymentRepository), new(*repository4.ChartGroupDeploymentRepositoryImpl)),
648+
repository9.NewClusterInstalledAppsRepositoryImpl,
649+
wire.Bind(new(repository9.ClusterInstalledAppsRepository), new(*repository9.ClusterInstalledAppsRepositoryImpl)),
650650

651651
commonService.NewCommonServiceImpl,
652652
wire.Bind(new(commonService.CommonService), new(*commonService.CommonServiceImpl)),

api/appStore/deployment/AppStoreDeploymentRestHandler.go

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,14 @@ import (
2121
"encoding/json"
2222
"errors"
2323
"fmt"
24-
service2 "github.com/devtron-labs/devtron/api/helm-app/service"
25-
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/EAMode"
26-
"net/http"
27-
"strconv"
28-
"strings"
29-
"time"
30-
3124
openapi "github.com/devtron-labs/devtron/api/helm-app/openapiClient"
25+
service2 "github.com/devtron-labs/devtron/api/helm-app/service"
3226
"github.com/devtron-labs/devtron/api/restHandler/common"
3327
"github.com/devtron-labs/devtron/internal/util"
3428
appStoreBean "github.com/devtron-labs/devtron/pkg/appStore/bean"
3529
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service"
30+
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/EAMode"
31+
bean2 "github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/bean"
3632
"github.com/devtron-labs/devtron/pkg/attributes"
3733
"github.com/devtron-labs/devtron/pkg/auth/authorisation/casbin"
3834
"github.com/devtron-labs/devtron/pkg/auth/user"
@@ -43,10 +39,11 @@ import (
4339
"github.com/gorilla/mux"
4440
"go.uber.org/zap"
4541
"gopkg.in/go-playground/validator.v9"
42+
"net/http"
43+
"strconv"
44+
"strings"
4645
)
4746

48-
const HELM_APP_UPDATE_COUNTER = "HelmAppUpdateCounter"
49-
5047
type AppStoreDeploymentRestHandler interface {
5148
InstallApp(w http.ResponseWriter, r *http.Request)
5249
GetInstalledAppsByAppStoreId(w http.ResponseWriter, r *http.Request)
@@ -68,17 +65,17 @@ type AppStoreDeploymentRestHandlerImpl struct {
6865
validator *validator.Validate
6966
helmAppService service2.HelmAppService
7067
argoUserService argo.ArgoUserService
71-
attributesService attributes.AttributesService
7268
installAppService EAMode.InstalledAppDBService
69+
attributesService attributes.AttributesService
7370
}
7471

7572
func NewAppStoreDeploymentRestHandlerImpl(Logger *zap.SugaredLogger, userAuthService user.UserService,
7673
enforcer casbin.Enforcer, enforcerUtil rbac.EnforcerUtil, enforcerUtilHelm rbac.EnforcerUtilHelm,
7774
appStoreDeploymentService service.AppStoreDeploymentService,
7875
appStoreDeploymentDBService service.AppStoreDeploymentDBService,
7976
validator *validator.Validate, helmAppService service2.HelmAppService,
80-
argoUserService argo.ArgoUserService, attributesService attributes.AttributesService,
81-
installAppService EAMode.InstalledAppDBService) *AppStoreDeploymentRestHandlerImpl {
77+
argoUserService argo.ArgoUserService,
78+
installAppService EAMode.InstalledAppDBService, attributesService attributes.AttributesService) *AppStoreDeploymentRestHandlerImpl {
8279
return &AppStoreDeploymentRestHandlerImpl{
8380
Logger: Logger,
8481
userAuthService: userAuthService,
@@ -90,8 +87,8 @@ func NewAppStoreDeploymentRestHandlerImpl(Logger *zap.SugaredLogger, userAuthSer
9087
validator: validator,
9188
helmAppService: helmAppService,
9289
argoUserService: argoUserService,
93-
attributesService: attributesService,
9490
installAppService: installAppService,
91+
attributesService: attributesService,
9592
}
9693
}
9794

@@ -488,7 +485,6 @@ func (handler AppStoreDeploymentRestHandlerImpl) UpdateInstalledApp(w http.Respo
488485
}
489486
ctx = context.WithValue(r.Context(), "token", acdToken)
490487
}
491-
triggeredAt := time.Now()
492488
res, err := handler.appStoreDeploymentService.UpdateInstalledApp(ctx, &request)
493489
if err != nil {
494490
if strings.Contains(err.Error(), "application spec is invalid") {
@@ -498,13 +494,7 @@ func (handler AppStoreDeploymentRestHandlerImpl) UpdateInstalledApp(w http.Respo
498494
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
499495
return
500496
}
501-
err1 := handler.appStoreDeploymentService.UpdatePreviousDeploymentStatusForAppStore(res, triggeredAt, err)
502-
if err1 != nil {
503-
handler.Logger.Errorw("error while update previous installed app version history", "err", err, "installAppVersionRequest", res)
504-
//if installed app is updated and error is in updating previous deployment status, then don't block user, just show error.
505-
}
506-
507-
err = handler.attributesService.UpdateKeyValueByOne(HELM_APP_UPDATE_COUNTER)
497+
err = handler.attributesService.UpdateKeyValueByOne(bean2.HELM_APP_UPDATE_COUNTER)
508498

509499
common.WriteJsonResp(w, err, res, http.StatusOK)
510500
}

api/appStore/deployment/CommonDeploymentRestHandler.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ import (
2222
"fmt"
2323
service2 "github.com/devtron-labs/devtron/api/helm-app/service"
2424
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/EAMode"
25+
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/bean"
26+
"github.com/devtron-labs/devtron/pkg/attributes"
2527
"net/http"
2628
"strconv"
2729
"time"
2830

2931
"github.com/devtron-labs/common-lib/utils/k8sObjectsUtil"
30-
client "github.com/devtron-labs/devtron/api/helm-app"
3132
openapi2 "github.com/devtron-labs/devtron/api/openapi/openapiClient"
3233
"github.com/devtron-labs/devtron/api/restHandler/common"
3334
"github.com/devtron-labs/devtron/internal/util"
@@ -60,15 +61,15 @@ type CommonDeploymentRestHandlerImpl struct {
6061
installedAppService EAMode.InstalledAppDBService
6162
validator *validator.Validate
6263
helmAppService service2.HelmAppService
63-
helmAppRestHandler client.HelmAppRestHandler
6464
argoUserService argo.ArgoUserService
65+
attributesService attributes.AttributesService
6566
}
6667

6768
func NewCommonDeploymentRestHandlerImpl(Logger *zap.SugaredLogger, userAuthService user.UserService,
6869
enforcer casbin.Enforcer, enforcerUtil rbac.EnforcerUtil, enforcerUtilHelm rbac.EnforcerUtilHelm,
6970
appStoreDeploymentService service.AppStoreDeploymentService, installedAppService EAMode.InstalledAppDBService,
7071
validator *validator.Validate, helmAppService service2.HelmAppService,
71-
helmAppRestHandler client.HelmAppRestHandler, argoUserService argo.ArgoUserService) *CommonDeploymentRestHandlerImpl {
72+
argoUserService argo.ArgoUserService, attributesService attributes.AttributesService) *CommonDeploymentRestHandlerImpl {
7273
return &CommonDeploymentRestHandlerImpl{
7374
Logger: Logger,
7475
userAuthService: userAuthService,
@@ -79,8 +80,8 @@ func NewCommonDeploymentRestHandlerImpl(Logger *zap.SugaredLogger, userAuthServi
7980
installedAppService: installedAppService,
8081
validator: validator,
8182
helmAppService: helmAppService,
82-
helmAppRestHandler: helmAppRestHandler,
8383
argoUserService: argoUserService,
84+
attributesService: attributesService,
8485
}
8586
}
8687
func (handler *CommonDeploymentRestHandlerImpl) getAppOfferingMode(installedAppId string, appId string) (string, *appStoreBean.InstallAppVersionDTO, error) {
@@ -324,5 +325,6 @@ func (handler *CommonDeploymentRestHandlerImpl) RollbackApplication(w http.Respo
324325
res := &openapi2.RollbackReleaseResponse{
325326
Success: &success,
326327
}
328+
handler.attributesService.UpdateKeyValueByOne(bean.HELM_APP_UPDATE_COUNTER)
327329
common.WriteJsonResp(w, err, res, http.StatusOK)
328330
}

api/appStore/deployment/wire_appStoreDeployment.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,23 @@ package appStoreDeployment
1818

1919
import (
2020
"github.com/devtron-labs/devtron/client/argocdServer"
21-
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/repository"
21+
"github.com/devtron-labs/devtron/internal/util"
22+
repository3 "github.com/devtron-labs/devtron/pkg/appStore/installedApp/repository"
2223
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service"
2324
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/EAMode"
24-
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/common"
25+
deployment2 "github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/EAMode/deployment"
26+
appStoreDeploymentCommon "github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/common"
2527
"github.com/google/wire"
2628
)
2729

2830
var AppStoreDeploymentWireSet = wire.NewSet(
2931
//util.GetDeploymentServiceTypeConfig,
30-
repository.NewClusterInstalledAppsRepositoryImpl,
31-
wire.Bind(new(repository.ClusterInstalledAppsRepository), new(*repository.ClusterInstalledAppsRepositoryImpl)),
32+
util.NewChartTemplateServiceImpl,
33+
wire.Bind(new(util.ChartTemplateService), new(*util.ChartTemplateServiceImpl)),
3234
appStoreDeploymentCommon.NewAppStoreDeploymentCommonServiceImpl,
3335
wire.Bind(new(appStoreDeploymentCommon.AppStoreDeploymentCommonService), new(*appStoreDeploymentCommon.AppStoreDeploymentCommonServiceImpl)),
34-
EAMode.NewEAModeDeploymentServiceImpl,
35-
wire.Bind(new(EAMode.EAModeDeploymentService), new(*EAMode.EAModeDeploymentServiceImpl)),
36+
deployment2.NewEAModeDeploymentServiceImpl,
37+
wire.Bind(new(deployment2.EAModeDeploymentService), new(*deployment2.EAModeDeploymentServiceImpl)),
3638
service.NewAppStoreDeploymentServiceImpl,
3739
wire.Bind(new(service.AppStoreDeploymentService), new(*service.AppStoreDeploymentServiceImpl)),
3840
service.NewAppStoreDeploymentDBServiceImpl,
@@ -41,8 +43,8 @@ var AppStoreDeploymentWireSet = wire.NewSet(
4143
wire.Bind(new(AppStoreDeploymentRestHandler), new(*AppStoreDeploymentRestHandlerImpl)),
4244
NewAppStoreDeploymentRouterImpl,
4345
wire.Bind(new(AppStoreDeploymentRouter), new(*AppStoreDeploymentRouterImpl)),
44-
repository.NewInstalledAppVersionHistoryRepositoryImpl,
45-
wire.Bind(new(repository.InstalledAppVersionHistoryRepository), new(*repository.InstalledAppVersionHistoryRepositoryImpl)),
46+
repository3.NewInstalledAppVersionHistoryRepositoryImpl,
47+
wire.Bind(new(repository3.InstalledAppVersionHistoryRepository), new(*repository3.InstalledAppVersionHistoryRepositoryImpl)),
4648

4749
NewCommonDeploymentRestHandlerImpl,
4850
wire.Bind(new(CommonDeploymentRestHandler), new(*CommonDeploymentRestHandlerImpl)),

api/bean/AppView.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ type DeploymentDetailContainer struct {
186186
DeploymentConfig *bean.DeploymentConfig `json:"-"`
187187
IsPipelineTriggered bool `json:"isPipelineTriggered"`
188188
ReleaseMode string `json:"releaseMode"`
189+
LastDeployedById int `json:"-" sql:"last_deployed_by_id"`
189190
}
190191

191192
type AppDetailContainer struct {

cmd/external-app/wire.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ import (
6666
"github.com/devtron-labs/devtron/pkg/app"
6767
"github.com/devtron-labs/devtron/pkg/app/dbMigration"
6868
repository4 "github.com/devtron-labs/devtron/pkg/appStore/chartGroup/repository"
69-
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/EAMode"
69+
deployment2 "github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/EAMode/deployment"
7070
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/FullMode/deployment"
7171
"github.com/devtron-labs/devtron/pkg/argoRepositoryCreds"
7272
"github.com/devtron-labs/devtron/pkg/attributes"
@@ -185,7 +185,7 @@ func InitializeApp() (*App, error) {
185185
// needed for enforcer util ends
186186

187187
// binding gitops to helm (for hyperion)
188-
wire.Bind(new(deployment.FullModeDeploymentService), new(*EAMode.EAModeDeploymentServiceImpl)),
188+
wire.Bind(new(deployment.FullModeDeploymentService), new(*deployment2.EAModeDeploymentServiceImpl)),
189189

190190
router.NewTelemetryRouterImpl,
191191
wire.Bind(new(router.TelemetryRouter), new(*router.TelemetryRouterImpl)),

cmd/external-app/wire_gen.go

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

internal/sql/repository/AppListingRepository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ func (impl AppListingRepositoryImpl) FetchMinDetailOtherEnvironment(appId int) (
699699
func (impl AppListingRepositoryImpl) DeploymentDetailByArtifactId(ciArtifactId int, envId int) (bean.DeploymentDetailContainer, error) {
700700
impl.Logger.Debug("reached at AppListingRepository:")
701701
var deploymentDetail bean.DeploymentDetailContainer
702-
query := "SELECT env.id AS environment_id, env.environment_name, env.default, pco.created_on as last_deployed_time, a.app_name" +
702+
query := "SELECT env.id AS environment_id, env.environment_name, env.default, pco.created_on as last_deployed_time, pco.updated_by as last_deployed_by_id, a.app_name" +
703703
" FROM pipeline_config_override pco" +
704704
" INNER JOIN pipeline p on p.id = pco.pipeline_id" +
705705
" INNER JOIN environment env ON env.id=p.environment_id" +

internal/util/ChartTemplateService.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ type ChartTemplateService interface {
7474
CreateZipFileForChart(chart *chart.Chart, outputChartPathDir string) ([]byte, error)
7575
PackageChart(tempReferenceTemplateDir string, chartMetaData *chart.Metadata) (*string, string, error)
7676
}
77+
7778
type ChartTemplateServiceImpl struct {
7879
randSource rand.Source
7980
logger *zap.SugaredLogger

0 commit comments

Comments
 (0)