@@ -47,7 +47,7 @@ import (
47
47
48
48
type AppStoreDeploymentCommonService interface {
49
49
// 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 )
51
51
// GetRequirementsString will return requirement dependencies for the given appStoreVersionId
52
52
GetRequirementsString (appStoreApplicationVersion * appStoreDiscoverRepository.AppStoreApplicationVersion ) (string , error )
53
53
// CreateChartProxyAndGetPath parse chart in local directory and returns path of local dir and values.yaml
@@ -169,7 +169,7 @@ func (impl *AppStoreDeploymentCommonServiceImpl) GetDeploymentHistoryInfoFromDB(
169
169
return values , err
170
170
}
171
171
172
- func (impl AppStoreDeploymentCommonServiceImpl ) GetValuesString (chartName , valuesOverrideYaml string ) (string , error ) {
172
+ func (impl AppStoreDeploymentCommonServiceImpl ) GetValuesString (appStoreApplicationVersion * appStoreDiscoverRepository. AppStoreApplicationVersion , valuesOverrideYaml string ) (string , error ) {
173
173
174
174
ValuesOverrideByte , err := yaml .YAMLToJSON ([]byte (valuesOverrideYaml ))
175
175
if err != nil {
@@ -184,7 +184,7 @@ func (impl AppStoreDeploymentCommonServiceImpl) GetValuesString(chartName, value
184
184
}
185
185
186
186
valuesMap := make (map [string ]map [string ]interface {})
187
- valuesMap [chartName ] = dat
187
+ valuesMap [GetChartNameFromAppStoreApplicationVersion ( appStoreApplicationVersion ) ] = dat
188
188
valuesByte , err := json .Marshal (valuesMap )
189
189
if err != nil {
190
190
impl .logger .Errorw ("error in marshaling" , "err" , err )
@@ -193,23 +193,29 @@ func (impl AppStoreDeploymentCommonServiceImpl) GetValuesString(chartName, value
193
193
return string (valuesByte ), nil
194
194
}
195
195
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
+
196
204
func (impl AppStoreDeploymentCommonServiceImpl ) GetRequirementsString (appStoreAppVersion * appStoreDiscoverRepository.AppStoreApplicationVersion ) (string , error ) {
197
205
198
206
dependency := appStoreBean.Dependency {
199
- Name : appStoreAppVersion . AppStore . Name ,
207
+ Name : GetChartNameFromAppStoreApplicationVersion ( appStoreAppVersion ) ,
200
208
Version : appStoreAppVersion .Version ,
201
209
}
202
210
if appStoreAppVersion .AppStore .ChartRepo != nil {
203
211
dependency .Repository = appStoreAppVersion .AppStore .ChartRepo .Url
204
212
} 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 )
207
214
if err != nil {
208
215
impl .logger .Errorw ("error in getting sanitized repository name and url" , "repositoryURL" , repositoryURL , "repositoryName" , repositoryName , "err" , err )
209
216
return "" , err
210
217
}
211
218
dependency .Repository = repositoryURL
212
- dependency .Name = repositoryName
213
219
}
214
220
215
221
var dependencies []appStoreBean.Dependency
0 commit comments