@@ -47,7 +47,7 @@ import (
4747
4848type AppStoreDeploymentCommonService interface {
4949 // GetValuesString will return values string from the given valuesOverrideYaml
50- GetValuesString (chartName , valuesOverrideYaml string ) (string , error )
50+ GetValuesString (appStoreApplicationVersion * appStoreDiscoverRepository. AppStoreApplicationVersion , valuesOverrideYaml string ) (string , error )
5151 // GetRequirementsString will return requirement dependencies for the given appStoreVersionId
5252 GetRequirementsString (appStoreApplicationVersion * appStoreDiscoverRepository.AppStoreApplicationVersion ) (string , error )
5353 // CreateChartProxyAndGetPath parse chart in local directory and returns path of local dir and values.yaml
@@ -169,7 +169,7 @@ func (impl *AppStoreDeploymentCommonServiceImpl) GetDeploymentHistoryInfoFromDB(
169169 return values , err
170170}
171171
172- func (impl AppStoreDeploymentCommonServiceImpl ) GetValuesString (chartName , valuesOverrideYaml string ) (string , error ) {
172+ func (impl AppStoreDeploymentCommonServiceImpl ) GetValuesString (appStoreApplicationVersion * appStoreDiscoverRepository. AppStoreApplicationVersion , valuesOverrideYaml string ) (string , error ) {
173173
174174 ValuesOverrideByte , err := yaml .YAMLToJSON ([]byte (valuesOverrideYaml ))
175175 if err != nil {
@@ -184,7 +184,7 @@ func (impl AppStoreDeploymentCommonServiceImpl) GetValuesString(chartName, value
184184 }
185185
186186 valuesMap := make (map [string ]map [string ]interface {})
187- valuesMap [chartName ] = dat
187+ valuesMap [GetChartNameFromAppStoreApplicationVersion ( appStoreApplicationVersion ) ] = dat
188188 valuesByte , err := json .Marshal (valuesMap )
189189 if err != nil {
190190 impl .logger .Errorw ("error in marshaling" , "err" , err )
@@ -193,23 +193,29 @@ func (impl AppStoreDeploymentCommonServiceImpl) GetValuesString(chartName, value
193193 return string (valuesByte ), nil
194194}
195195
196+ func GetChartNameFromAppStoreApplicationVersion (appStoreApplicationVersion * appStoreDiscoverRepository.AppStoreApplicationVersion ) string {
197+ if len (appStoreApplicationVersion .Name ) > 0 {
198+ return appStoreApplicationVersion .Name //we get this from chartMetadata in app sync job, so more reliable
199+ } else {
200+ return appStoreApplicationVersion .AppStore .Name
201+ }
202+ }
203+
196204func (impl AppStoreDeploymentCommonServiceImpl ) GetRequirementsString (appStoreAppVersion * appStoreDiscoverRepository.AppStoreApplicationVersion ) (string , error ) {
197205
198206 dependency := appStoreBean.Dependency {
199- Name : appStoreAppVersion . AppStore . Name ,
207+ Name : GetChartNameFromAppStoreApplicationVersion ( appStoreAppVersion ) ,
200208 Version : appStoreAppVersion .Version ,
201209 }
202210 if appStoreAppVersion .AppStore .ChartRepo != nil {
203211 dependency .Repository = appStoreAppVersion .AppStore .ChartRepo .Url
204212 } else if appStoreAppVersion .AppStore .DockerArtifactStore != nil {
205- dependency .Repository = appStoreAppVersion .AppStore .DockerArtifactStore .RegistryURL
206- repositoryURL , repositoryName , err := sanitizeRepoNameAndURLForOCIRepo (dependency .Repository , dependency .Name )
213+ repositoryURL , repositoryName , err := sanitizeRepoNameAndURLForOCIRepo (appStoreAppVersion .AppStore .DockerArtifactStore .RegistryURL , appStoreAppVersion .AppStore .Name )
207214 if err != nil {
208215 impl .logger .Errorw ("error in getting sanitized repository name and url" , "repositoryURL" , repositoryURL , "repositoryName" , repositoryName , "err" , err )
209216 return "" , err
210217 }
211218 dependency .Repository = repositoryURL
212- dependency .Name = repositoryName
213219 }
214220
215221 var dependencies []appStoreBean.Dependency
0 commit comments