diff --git a/pkg/exprparser/interpreter.go b/pkg/exprparser/interpreter.go index c95c0224df7..ee96d9034c9 100644 --- a/pkg/exprparser/interpreter.go +++ b/pkg/exprparser/interpreter.go @@ -237,7 +237,7 @@ func (impl *interperterImpl) getPropertyValue(left reflect.Value, property strin } } - return nil, fmt.Errorf("'%s' not found in '%s'", property, left.Type()) + return nil, nil case reflect.Slice: var values []interface{} diff --git a/pkg/runner/expression.go b/pkg/runner/expression.go index f66952832f6..2892bbc035c 100644 --- a/pkg/runner/expression.go +++ b/pkg/runner/expression.go @@ -191,6 +191,10 @@ func EvalBool(evaluator ExpressionEvaluator, expr string) (bool, error) { return result, nil } +func escapeFormatString(in string) string { + return strings.ReplaceAll(strings.ReplaceAll(in, "{", "{{"), "}", "}}") +} + //nolint:gocyclo func rewriteSubExpression(in string, forceFormat bool) (string, error) { if !strings.Contains(in, "${{") || !strings.Contains(in, "}}") { @@ -237,11 +241,11 @@ func rewriteSubExpression(in string, forceFormat bool) (string, error) { } else { exprStart = strings.Index(in[pos:], "${{") if exprStart != -1 { - formatOut += in[pos : pos+exprStart] + formatOut += escapeFormatString(in[pos : pos+exprStart]) exprStart = pos + exprStart + 3 pos = exprStart } else { - formatOut += in[pos:] + formatOut += escapeFormatString(in[pos:]) pos = len(in) } }