Skip to content

Commit a45eeb0

Browse files
committed
code refactored
1 parent 28414b9 commit a45eeb0

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

pkg/appStore/deployment/service/InstalledAppService.go

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import (
5050
util3 "github.com/devtron-labs/devtron/util"
5151
"github.com/devtron-labs/devtron/util/argo"
5252
"github.com/tidwall/gjson"
53+
"k8s.io/apimachinery/pkg/version"
5354
"net/http"
5455
"regexp"
5556
"sync"
@@ -947,23 +948,7 @@ func (impl *InstalledAppServiceImpl) FindNotesForArgoApplication(installedAppId,
947948
impl.logger.Errorw("exception caught in getting k8sServerVersion", "err", err)
948949
return notes, appName, err
949950
}
950-
951-
installReleaseRequest := &client.InstallReleaseRequest{
952-
ChartName: appStoreAppVersion.Name,
953-
ChartVersion: appStoreAppVersion.Version,
954-
ValuesYaml: installedAppVerison.ValuesYaml,
955-
K8SVersion: k8sServerVersion.String(),
956-
ChartRepository: &client.ChartRepository{
957-
Name: appStoreAppVersion.AppStore.ChartRepo.Name,
958-
Url: appStoreAppVersion.AppStore.ChartRepo.Url,
959-
Username: appStoreAppVersion.AppStore.ChartRepo.UserName,
960-
Password: appStoreAppVersion.AppStore.ChartRepo.Password,
961-
},
962-
ReleaseIdentifier: &client.ReleaseIdentifier{
963-
ReleaseNamespace: installedAppVerison.InstalledApp.Environment.Namespace,
964-
ReleaseName: installedAppVerison.InstalledApp.App.AppName,
965-
},
966-
}
951+
installReleaseRequest := setInstallReleaseRequest(appStoreAppVersion, installedAppVerison, k8sServerVersion)
967952

968953
notes, err = impl.helmAppService.GetNotes(context.Background(), installReleaseRequest)
969954
if err != nil {
@@ -980,6 +965,29 @@ func (impl *InstalledAppServiceImpl) FindNotesForArgoApplication(installedAppId,
980965
return notes, appName, nil
981966
}
982967

968+
func setInstallReleaseRequest(appStoreAppVersion *appStoreDiscoverRepository.AppStoreApplicationVersion, installedAppVerison *repository2.InstalledAppVersions, k8sServerVersion *version.Info) *client.InstallReleaseRequest {
969+
installReleaseRequest := &client.InstallReleaseRequest{
970+
ChartName: appStoreAppVersion.Name,
971+
ChartVersion: appStoreAppVersion.Version,
972+
ValuesYaml: installedAppVerison.ValuesYaml,
973+
K8SVersion: k8sServerVersion.String(),
974+
ChartRepository: &client.ChartRepository{
975+
Name: appStoreAppVersion.AppStore.ChartRepo.Name,
976+
Url: appStoreAppVersion.AppStore.ChartRepo.Url,
977+
Username: appStoreAppVersion.AppStore.ChartRepo.UserName,
978+
Password: appStoreAppVersion.AppStore.ChartRepo.Password,
979+
},
980+
ReleaseIdentifier: &client.ReleaseIdentifier{
981+
ReleaseNamespace: installedAppVerison.InstalledApp.Environment.Namespace,
982+
ReleaseName: installedAppVerison.InstalledApp.App.AppName,
983+
ClusterConfig: &client.ClusterConfig{
984+
ClusterId: int32(installedAppVerison.InstalledApp.Environment.ClusterId),
985+
},
986+
},
987+
}
988+
return installReleaseRequest
989+
}
990+
983991
func (impl InstalledAppServiceImpl) GetInstalledAppVersionHistory(installedAppId int) (*appStoreBean.InstallAppVersionHistoryDto, error) {
984992
result := &appStoreBean.InstallAppVersionHistoryDto{}
985993
var history []*appStoreBean.IAVHistory

wire_gen.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)