github.com/argoproj/argo-cd/v3@v3.2.1/util/notification/expression/expr.go (about) 1 package expression 2 3 import ( 4 "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" 5 6 service "github.com/argoproj/argo-cd/v3/util/notification/argocd" 7 8 "github.com/argoproj/argo-cd/v3/util/notification/expression/repo" 9 "github.com/argoproj/argo-cd/v3/util/notification/expression/strings" 10 "github.com/argoproj/argo-cd/v3/util/notification/expression/time" 11 ) 12 13 var helpers = map[string]any{} 14 15 func init() { 16 helpers = make(map[string]any) 17 register("time", time.NewExprs()) 18 register("strings", strings.NewExprs()) 19 } 20 21 func register(namespace string, entry map[string]any) { 22 helpers[namespace] = entry 23 } 24 25 func Spawn(app *unstructured.Unstructured, argocdService service.Service, vars map[string]any) map[string]any { 26 clone := make(map[string]any) 27 for k := range vars { 28 clone[k] = vars[k] 29 } 30 for namespace, helper := range helpers { 31 clone[namespace] = helper 32 } 33 clone["repo"] = repo.NewExprs(argocdService, app) 34 35 return clone 36 }