matcher

package
v0.54.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigFollowUp = "follow-up"

ConfigFollowUp is the Match.Config key the matcher sets on a definition carrying the on-pipelinerun annotation: the definition is then planned as a follow-up entry instead of being started right away, and the watcher creates its run once its dependencies are done.

Variables

View Source
var ErrRepositoryNameConflict = errors.New("multiple repositories exist with the given name")

Functions

func EvaluateFollowUp added in v0.54.0

func EvaluateFollowUp(ctx context.Context, expr string, event *info.Event, vcx provider.Interface,
	customParams map[string]string, eventEmitter *events.EventEmitter, repo *apipac.Repository, runs map[string]any,
) (bool, error)

EvaluateFollowUp evaluates the on-cel-expression of a follow-up exactly like the matcher evaluates an on-cel-expression: same variables, same refs/heads/ handling, same custom parameters. The webhook payload variables (body, headers, files) and the pathChanged function are not available, the runs map of the dependencies is. The event is copied, never modified.

func GetRepoByName added in v0.39.0

func GetRepoByName(ctx context.Context, cs *params.Run, repoName, ns string) (*apipac.Repository, error)

GetRepoByName get a repo by name anywhere on a cluster. Parameter 'ns' may optionally be supplied in case of a naming conflict.

func GrabPipelineFromAnnotations added in v0.28.0

func GrabPipelineFromAnnotations(annotations map[string]string) (string, error)

func GrabTasksFromAnnotations added in v0.28.0

func GrabTasksFromAnnotations(annotations map[string]string) ([]string, error)

func IncomingWebhookRule

func IncomingWebhookRule(branch string, incomingWebhooks []apipac.Incoming) *apipac.Incoming

IncomingWebhookRule will match a rule to an incoming rule, currently a rule is a target branch. Supports both exact string matching and glob patterns. Uses first-match-wins strategy: returns the first webhook with a matching target.

func MatchEventURLRepo

func MatchEventURLRepo(ctx context.Context, cs *params.Run, event *info.Event, ns string) (*apipac.Repository, error)

func MatchRunningPipelineRunForIncomingWebhook added in v0.21.0

func MatchRunningPipelineRunForIncomingWebhook(eventType, incomingPipelineRun string, prs []*tektonv1.PipelineRun) []*tektonv1.PipelineRun

func ResolveCustomParamsForCEL added in v0.54.0

func ResolveCustomParamsForCEL(ctx context.Context, repo *apipac.Repository, event *info.Event, cs *params.Run, vcx provider.Interface, eventEmitter *events.EventEmitter, logger *zap.SugaredLogger, paramFilters map[string]string) map[string]string

ResolveCustomParamsForCEL resolves custom parameters from the Repository CR for use in CEL expressions. It returns a map of parameter names to values, excluding reserved keywords. All parameters are returned as strings, including those from secret_ref.

paramFilters, when not nil, selects the filtered params from the outcomes recorded when the event was processed instead of evaluating the filters.

func ValidateFollowUp added in v0.54.0

func ValidateFollowUp(expr string, customParamNames []string) error

ValidateFollowUp compile-checks the on-cel-expression of a follow-up at event time, with the custom parameters of the repository declared.

Types

type Match

type Match struct {
	PipelineRun *tektonv1.PipelineRun
	Repo        *apipac.Repository
	Config      map[string]string
}

func MatchPipelinerunByAnnotation

func MatchPipelinerunByAnnotation(ctx context.Context, logger *zap.SugaredLogger, pruns []*tektonv1.PipelineRun, cs *params.Run, event *info.Event, vcx provider.Interface, eventEmitter *events.EventEmitter, repo *apipac.Repository, reportErrors bool) ([]Match, map[string]*tektonv1.PipelineRun, error)

type NoFailedPipelineToRetestError added in v0.44.0

type NoFailedPipelineToRetestError string

NoFailedPipelineToRetestError is an error type returned when /retest or /ok-to-test is used but all matching pipelines have already succeeded for this commit. The underlying string value is the gitops comment prefix used to construct the user-facing error message with the correct command syntax.

func (NoFailedPipelineToRetestError) Error added in v0.44.0

func (NoFailedPipelineToRetestError) Is added in v0.44.0

type NodeMatcher added in v0.41.0

type NodeMatcher func(expr *exprpb.Expr) bool

NodeMatcher is a predicate function that inspects a CEL AST node. It returns true if the node matches the criteria being searched for.

type RemoteTasks

type RemoteTasks struct {
	Run                *params.Run
	ProviderInterface  provider.Interface
	Event              *info.Event
	Logger             *zap.SugaredLogger
	RepositoryRevision string
}

func (*RemoteTasks) GetPipelineFromAnnotationName added in v0.28.0

func (rt *RemoteTasks) GetPipelineFromAnnotationName(ctx context.Context, name string) (*tektonv1.Pipeline, error)

func (*RemoteTasks) GetTaskFromAnnotationName added in v0.28.0

func (rt *RemoteTasks) GetTaskFromAnnotationName(ctx context.Context, name string) (*tektonv1.Task, error)

Jump to

Keyboard shortcuts

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