template

package
v0.0.0-...-481a513 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UID = func() string { return rand.String(5) }

UID generates a random string like the Kubernetes apiserver generateName metafield postfix.

Functions

func ApplyParamsToResourceTemplate

func ApplyParamsToResourceTemplate(params []pipelinev1.Param, rt json.RawMessage) json.RawMessage

ApplyParamsToResourceTemplate returns the TriggerResourceTemplate with the param values substituted for all matching param variables in the template

func ApplyUIDToResourceTemplate

func ApplyUIDToResourceTemplate(rt json.RawMessage, uid string) json.RawMessage

ApplyUIDToResourceTemplate returns the TriggerResourceTemplate after uid replacement The same uid should be used per trigger to properly address resources throughout the TriggerTemplate.

func MergeBindingParams

func MergeBindingParams(bindings []*triggersv1.TriggerBinding, clusterbindings []*triggersv1.ClusterTriggerBinding) ([]pipelinev1.Param, error)

MergeBindingParams merges params across multiple bindings.

func MergeInDefaultParams

func MergeInDefaultParams(params []pipelinev1.Param, paramSpecs []pipelinev1.ParamSpec) []pipelinev1.Param

MergeInDefaultParams returns the params with the addition of all paramSpecs that have default values and are already in the params list

func ParseJSONPath

func ParseJSONPath(input interface{}, expr string) (string, error)

ParseJSONPath extracts a subset of the given JSON input using the provided JSONPath expression.

func ResolveParams

func ResolveParams(rt ResolvedTrigger, body []byte, header http.Header) ([]pipelinev1.Param, error)

ResolveParams takes given triggerbindings and produces the resulting resource params.

func ResolveResources

func ResolveResources(template *triggersv1.TriggerTemplate, params []pipelinev1.Param) []json.RawMessage

ResolveResources resolves a templated resource by replacing params with their values.

func TektonJSONPathExpression

func TektonJSONPathExpression(expr string) (string, error)

TektonJSONPathExpression returns a valid JSONPath expression. It accepts a "RelaxedJSONPath" expression that is wrapped in the Tekton variable interpolation syntax i.e. $(). RelaxedJSONPath expressions can optionally omit the leading curly braces '{}' and '.'

Types

type ResolvedTrigger

type ResolvedTrigger struct {
	TriggerBindings        []*triggersv1.TriggerBinding
	ClusterTriggerBindings []*triggersv1.ClusterTriggerBinding
	TriggerTemplate        *triggersv1.TriggerTemplate
}

ResolvedTrigger contains the dereferenced TriggerBindings and TriggerTemplate after resolving the k8s ObjectRef.

func ResolveTrigger

func ResolveTrigger(trigger triggersv1.EventListenerTrigger, getTB getTriggerBinding, getCTB getClusterTriggerBinding, getTT getTriggerTemplate) (ResolvedTrigger, error)

ResolveTrigger takes in a trigger containing object refs to bindings and templates and resolves them to their underlying values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL