Documentation
¶
Index ¶
- Constants
- func EnvMap(replaceMap map[string]string) map[string]interface{}
- func IsMissingVariableErr(err error) bool
- func IsPlaceholder(s string) bool
- func NewPlaceholder(index int) string
- func Replace(ctx context.Context, s string, replaceMap map[string]any, allowUnresolved bool) (string, error)
- func ReplaceStrictAny(ctx context.Context, s string, replaceMap map[string]any, ...) (string, error)
- func ResolveVar(s string, m map[string]interface{}) (interface{}, error)
- func ToAnyMap(m map[string]string) map[string]any
- func Validate(s string, validator func(tag string) error) error
- type Template
Constants ¶
const PlaceholderPrefix = "__argo__internal__placeholder-"
Variables ¶
This section is empty.
Functions ¶
func IsMissingVariableErr ¶
func IsPlaceholder ¶
IsPlaceholder reports whether s is an internal Argo placeholder value.
func NewPlaceholder ¶
NewPlaceholder generates an internal Argo placeholder string for the given index.
func Replace ¶
func Replace(ctx context.Context, s string, replaceMap map[string]any, allowUnresolved bool) (string, error)
Replace takes a json-formatted string and performs variable replacement. Values are raw: a nil entry marks an absent optional (a skipped/omitted node's output with no default), and a simple tag resolving to nil is a terminal error regardless of allowUnresolved, which only governs tags whose key is missing entirely.
func ReplaceStrictAny ¶ added in v4.0.7
func ReplaceStrictAny(ctx context.Context, s string, replaceMap map[string]any, strictPrefixes []string) (string, error)
ReplaceStrictAny behaves like Replace but enforces that tags starting with any of strictPrefixes MUST be resolved, even if allowUnresolved behavior is otherwise active (implicit). The exception is {{tasks.name}} and {{steps.name}}: they name the current task or step, are only set when it is executed, so they are left unresolved for the substitution done then (#17415). It takes raw values, preserving nil entries so that expression tags can distinguish an absent (nil) value from an empty string (e.g. via `??`). A simple tag resolving to a nil value is a terminal error (not a missing-variable error): an absent optional must be handled by a producer default, a consumer input default (dropping the argument before substitution), or an expression fallback.