WIP: abra recipe upgrade on the way

This commit is contained in:
2021-08-06 15:40:23 +02:00
parent c75c2254e4
commit 11ef64ead3
3 changed files with 69 additions and 1 deletions

View File

@ -219,3 +219,27 @@ func readAppsCatalogueWeb(target interface{}) error {
return nil
}
func VersionsOfService(recipe, serviceName string) ([]string, error) {
catl, err := ReadAppsCatalogue()
if err != nil {
return nil, err
}
app, ok := catl[recipe]
if !ok {
return nil, fmt.Errorf("recipe '%s' does not exist?", recipe)
}
versions := []string{}
alreadySeen := make(map[string]bool)
for version := range app.Versions {
appVersion := app.Versions[version][serviceName].Tag
if _, ok := alreadySeen[appVersion]; !ok {
alreadySeen[appVersion] = true
versions = append(versions, appVersion)
}
}
return versions, nil
}