function

package
v1.8.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Always

func Always() expr.Option

Always returns an expr.Option that provides an `always()` function for use in expressions.

The `always()` function unconditionally returns true.

func ChartFrom

func ChartFrom(
	ctx context.Context,
	c client.Client,
	project string,
	freightReqs []kargoapi.FreightRequest,
	freightRefs []kargoapi.FreightReference,
) expr.Option

ChartFrom returns an expr.Option that provides a `chartFrom()` function for use in expressions.

The chartFrom function finds Helm charts based on repository URL, optional chart name, and optional origin, using the provided freight requests and references within the project context.

func CommitFrom

func CommitFrom(
	ctx context.Context,
	c client.Client,
	project string,
	freightReqs []kargoapi.FreightRequest,
	freightRefs []kargoapi.FreightReference,
) expr.Option

CommitFrom returns an expr.Option that provides a `commitFrom()` function for use in expressions.

The commitFrom function finds Git commits based on repository URL and optional origin, using the provided freight requests and references within the project context.

func ConfigMap

func ConfigMap(ctx context.Context, c client.Client, cache *gocache.Cache, project string) expr.Option

ConfigMap returns an expr.Option that provides a `configMap()` function for use in expressions.

func DataOperations

func DataOperations(ctx context.Context, c client.Client, cache *gocache.Cache, project string) []expr.Option

DataOperations returns a slice of expr.Option containing functions for data operations, such as accessing ConfigMaps and Secrets.

When the cache parameter is set, the functions will cache the retrieved ConfigMaps and Secrets to avoid repeated API calls. This can improve performance when the same ConfigMaps and Secrets are accessed multiple times within the same expression evaluation.

func Failure

func Failure(stepExecMetas kargoapi.StepExecutionMetadataList) expr.Option

Failure returns an expr.Option that provides a `failure()` function for use in expressions.

The `failure()` function checks the status of all preceding steps and returns true if any of them have failed or errored and false otherwise.

func FreightMetadata

func FreightMetadata(
	ctx context.Context,
	c client.Client,
	project string,
) expr.Option

FreightMetadata returns an expr.Option that provides a `freightMetadata()` function for use in expressions.

Usage:

  • `freightMetadata(freightRefName)` returns the entire metadata map for the Freight.
  • `freightMetadata(freightRefName, key)` returns the value for the given key (DEPRECATED; will be removed in v1.10).

The second argument is deprecated as of v1.8. Prefer using the single-argument form.

func FreightOperations

func FreightOperations(
	ctx context.Context,
	c client.Client,
	project string,
	freightRequests []kargoapi.FreightRequest,
	freightRefs []kargoapi.FreightReference,
) []expr.Option

FreightOperations returns a slice of expr.Option containing functions for Freight operations.

It provides `warehouse()`, `commitFrom()`, `imageFrom()`, and `chartFrom()` functions that can be used within expressions. The functions operate within the context of a given project with the provided freight requests and references.

func ImageFrom

func ImageFrom(
	ctx context.Context,
	c client.Client,
	project string,
	freightReqs []kargoapi.FreightRequest,
	freightRefs []kargoapi.FreightReference,
) expr.Option

ImageFrom returns an expr.Option that provides an `imageFrom()` function for use in expressions.

The imageFrom function finds container images based on repository URL and optional origin, using the provided freight requests and references within the project context.

func Secret

func Secret(ctx context.Context, c client.Client, cache *gocache.Cache, project string) expr.Option

Secret returns an expr.Option that provides a `secret()` function for use in expressions.

func SemverDiff

func SemverDiff() expr.Option

SemverDiff returns an expr.Option that provides a `semverDiff()` function for use in expressions.

The semverDiff function compares two semantic version strings and returns a string indicating the magnitude of difference between them -- one of: "Major", "Minor", "Patch", "Metadata", "None", or "Incomparable" if either or both arguments are not valid semantic versions.

func StageMetadata

func StageMetadata(
	ctx context.Context,
	c client.Client,
	project string,
) expr.Option

StageMetadata returns an expr.Option that provides a `stageMetadata()` function for use in expressions.

Usage:

  • `stageMetadata(stageName)` returns the entire metadata map for the Stage.

func Status

func Status(
	currentStepAlias string,
	stepExecMetas kargoapi.StepExecutionMetadataList,
) expr.Option

Status returns an expr.Option that provides a `status()` function for use in expressions.

The `status()` function retrieves the status of a specific step by its alias within the current promotion context; returning its value as a string.

func StatusOperations

func StatusOperations(
	currentStepAlias string,
	stepExecMetas kargoapi.StepExecutionMetadataList,
) []expr.Option

StatusOperations returns a slice of expr.Option containing functions for assessing the status of all preceding steps.

func Success

func Success(stepExecMetas kargoapi.StepExecutionMetadataList) expr.Option

Success returns an expr.Option that provides a `success()` function for use in expressions.

The `success()` function checks the status of all preceding steps and returns true if none of them have failed or errored and false otherwise.

func UtilityOperations

func UtilityOperations() []expr.Option

UtilityOperations returns a slice of expr.Option containing functions for utility operations, such as semantic version comparisons.

func Warehouse

func Warehouse() expr.Option

Warehouse returns an expr.Option that provides a `warehouse()` function for use in expressions.

The warehouse function creates a v1alpha1.FreightOrigin of kind v1alpha1.Warehouse with the specified name.

Types

This section is empty.

Jump to

Keyboard shortcuts

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