in internal/utils/controller/cache_helper.go [68:84]
func (c CacheHelper) NewCacheKeyFromApplications(apps []v1alpha1.ApplicationSpec) string {
// sort the apps by name to ensure consistent hashing
sort.Slice(apps, func(i, j int) bool {
return apps[i].Name < apps[j].Name
})
srcCacheKeys := lo.Reduce(apps, func(acc []string, app v1alpha1.ApplicationSpec, index int) []string {
return append(acc, c.AppCacheFieldFromApplicationProvision(app).NewCacheKey())
}, []string{})
// get the cache id for the source
hasher := sha256.New()
for _, id := range srcCacheKeys {
hasher.Write([]byte(id))
}
return hex.EncodeToString(hasher.Sum(nil))
}