forked from toolshed/abra
@ -12,7 +12,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"coopcloud.tech/abra/pkg/client"
|
||||
"coopcloud.tech/abra/pkg/compose"
|
||||
"coopcloud.tech/abra/pkg/config"
|
||||
"coopcloud.tech/abra/pkg/formatter"
|
||||
@ -41,9 +40,8 @@ type service = string
|
||||
|
||||
// ServiceMeta represents meta info associated with a service.
|
||||
type ServiceMeta struct {
|
||||
Digest string `json:"digest"`
|
||||
Image string `json:"image"`
|
||||
Tag string `json:"tag"`
|
||||
Image string `json:"image"`
|
||||
Tag string `json:"tag"`
|
||||
}
|
||||
|
||||
// RecipeVersions are the versions associated with a recipe.
|
||||
@ -992,12 +990,6 @@ func GetRecipeVersions(recipeName string) (RecipeVersions, error) {
|
||||
return err
|
||||
}
|
||||
|
||||
cl, err := client.New("default") // only required for container registry calls
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
queryCache := make(map[reference.Named]string)
|
||||
versionMeta := make(map[string]ServiceMeta)
|
||||
for _, service := range recipe.Config.Services {
|
||||
|
||||
@ -1019,28 +1011,9 @@ func GetRecipeVersions(recipeName string) (RecipeVersions, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
var exists bool
|
||||
var digest string
|
||||
if digest, exists = queryCache[img]; !exists {
|
||||
logrus.Debugf("cache miss: querying for image: %s, tag: %s", path, tag)
|
||||
|
||||
var err error
|
||||
digest, err = client.GetTagDigest(cl, img)
|
||||
if err != nil {
|
||||
logrus.Warn(err)
|
||||
digest = "unknown"
|
||||
}
|
||||
|
||||
queryCache[img] = digest
|
||||
logrus.Debugf("cached insert: %s, tag: %s, digest: %s", path, tag, digest)
|
||||
} else {
|
||||
logrus.Debugf("cache hit: image: %s, tag: %s, digest: %s", path, tag, digest)
|
||||
}
|
||||
|
||||
versionMeta[service.Name] = ServiceMeta{
|
||||
Digest: digest,
|
||||
Image: path,
|
||||
Tag: img.(reference.NamedTagged).Tag(),
|
||||
Image: path,
|
||||
Tag: tag,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user