types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2025 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const ParamsPrefix = "params"

ParamsPrefix is the prefix used in $(...) expressions referring to parameters

Variables

AllParamTypes can be used for ParamType validation.

AllResultsTypes can be used for ResultsTypes validation.

View Source
var VariableSubstitutionRegex = regexp.MustCompile(variableSubstitutionFormat)

VariableSubstitutionRegex is a regex to find all result matching substitutions

Functions

func ArrayReference

func ArrayReference(a string) string

ArrayReference returns the name of the parameter from array parameter reference returns arrayParam from $(params.arrayParam[*])

func ResultsArrayReference

func ResultsArrayReference(a string) string

ResultsArrayReference returns the reference of the result. e.g. results.resultname from $(results.resultname[*])

Types

type Algorithm

type Algorithm string

Algorithm Standard cryptographic hash algorithm

type Artifact

type Artifact struct {
	// The artifact's identifying category name
	Name string `json:"name,omitempty"`
	// A collection of values related to the artifact
	Values []ArtifactValue `json:"values,omitempty"`
	// Indicate if the artifact is a build output or a by-product
	BuildOutput bool `json:"buildOutput,omitempty"`
}

Artifact represents an artifact within a system, potentially containing multiple values associated with it.

type ArtifactValue

type ArtifactValue struct {
	Digest map[Algorithm]string `json:"digest,omitempty"` // Algorithm-specific digests for verifying the content (e.g., SHA256)
	Uri    string               `json:"uri,omitempty"`    // Location where the artifact value can be retrieved
}

ArtifactValue represents a specific value or data element within an Artifact.

type Artifacts

type Artifacts struct {
	Inputs  []Artifact `json:"inputs,omitempty"`
	Outputs []Artifact `json:"outputs,omitempty"`
}

Artifacts represents the collection of input and output artifacts associated with a task run or a similar process. Artifacts in this context are units of data or resources that the process either consumes as input or produces as output.

func (*Artifacts) Merge

func (a *Artifacts) Merge(another *Artifacts)

type ParamType

type ParamType string

ParamType indicates the type of an input parameter; Used to distinguish between a single string and an array of strings.

const (
	ParamTypeString ParamType = "string"
	ParamTypeArray  ParamType = "array"
	ParamTypeObject ParamType = "object"
)

Valid ParamTypes:

type ParamValue

type ParamValue struct {
	Type      ParamType // Represents the stored type of ParamValues.
	StringVal string
	// +listType=atomic
	ArrayVal  []string
	ObjectVal map[string]string
}

ParamValue is a type that can hold a single string, string array, or string map. Used in JSON unmarshalling so that a single JSON field can accept either an individual string or an array of strings.

func (*ParamValue) UnmarshalJSON

func (paramValues *ParamValue) UnmarshalJSON(value []byte) error

UnmarshalJSON implements the json.Unmarshaller interface.

type PropertySpec

type PropertySpec struct {
	Type ParamType `json:"type,omitempty"`
}

PropertySpec defines the struct for object keys

type ResultValue

type ResultValue = ParamValue

ResultValue is a type alias of ParamValue

type ResultsType

type ResultsType string

ResultsType indicates the type of a result; Used to distinguish between a single string and an array of strings. Note that there is ResultType used to find out whether a RunResult is from a task result or not, which is different from this ResultsType.

const (
	ResultsTypeString ResultsType = "string"
	ResultsTypeArray  ResultsType = "array"
	ResultsTypeObject ResultsType = "object"
)

Valid ResultsType:

type StepResult

type StepResult struct {
	// Name the given name
	Name string `json:"name"`

	// The possible types are 'string', 'array', and 'object', with 'string' as the default.
	// +optional
	Type ResultsType `json:"type,omitempty"`

	// Properties is the JSON Schema properties to support key-value pairs results.
	// +optional
	Properties map[string]PropertySpec `json:"properties,omitempty"`

	// Description is a human-readable description of the result
	// +optional
	Description string `json:"description,omitempty"`
}

StepResult used to describe the Results of a Step.

type StepWhenExpressions

type StepWhenExpressions = WhenExpressions

type TaskResult

type TaskResult struct {
	// Name the given name
	Name string `json:"name"`

	// Type is the user-specified type of the result. The possible type
	// is currently "string" and will support "array" in following work.
	// +optional
	Type ResultsType `json:"type,omitempty"`

	// Properties is the JSON Schema properties to support key-value pairs results.
	// +optional
	Properties map[string]PropertySpec `json:"properties,omitempty"`

	// Description is a human-readable description of the result
	// +optional
	Description string `json:"description,omitempty"`

	// Value the expression used to retrieve the value of the result from an underlying Step.
	// +optional
	Value *ResultValue `json:"value,omitempty"`
}

TaskResult used to describe the results of a task

type TaskRunResult

type TaskRunResult struct {
	// Name the given name
	Name string `json:"name"`

	// Type is the user-specified type of the result. The possible type
	// is currently "string" and will support "array" in following work.
	// +optional
	Type ResultsType `json:"type,omitempty"`

	// Value the given value of the result
	Value ResultValue `json:"value"`
}

TaskRunResult used to describe the results of a task

type TaskRunStepArtifact

type TaskRunStepArtifact = Artifact

TaskRunStepArtifact represents an artifact produced or used by a step within a task run. It directly uses the Artifact type for its structure.

type TaskRunStepResult

type TaskRunStepResult = TaskRunResult

TaskRunStepResult is a type alias of TaskRunResult

type WhenExpression

type WhenExpression struct {
	// Input is the string for guard checking which can be a static input or an output from a parent Task
	Input string `json:"input,omitempty"`

	// Operator that represents an Input's relationship to the values
	Operator selection.Operator `json:"operator,omitempty"`

	// Values is an array of strings, which is compared against the input, for guard checking
	// It must be non-empty
	// +listType=atomic
	Values []string `json:"values,omitempty"`

	// CEL is a string of Common Language Expression, which can be used to conditionally execute
	// the task based on the result of the expression evaluation
	// More info about CEL syntax: https://github.com/google/cel-spec/blob/master/doc/langdef.md
	// +optional
	CEL string `json:"cel,omitempty"`
}

WhenExpression allows a PipelineTask to declare expressions to be evaluated before the Task is run to determine whether the Task should be executed or skipped

func (*WhenExpression) GetVarSubstitutionExpressions

func (we *WhenExpression) GetVarSubstitutionExpressions() ([]string, bool)

GetVarSubstitutionExpressions extracts all the values between "$(" and ")" in a When Expression

type WhenExpressions

type WhenExpressions []WhenExpression

WhenExpressions are used to specify whether a Task should be executed or skipped All of them need to evaluate to True for a guarded Task to be executed.

func (WhenExpressions) AllowsExecution

func (wes WhenExpressions) AllowsExecution(evaluatedCEL map[string]bool) bool

AllowsExecution evaluates an Input's relationship to an array of Values, based on the Operator, to determine whether all the When Expressions are True. If they are all True, the guarded Task is executed, otherwise it is skipped. If CEL expression exists, AllowsExecution will get the evaluated results from evaluatedCEL and determine if the Task should be skipped.

func (WhenExpressions) ReplaceVariables

func (wes WhenExpressions) ReplaceVariables(replacements map[string]string, arrayReplacements map[string][]string) WhenExpressions

ReplaceVariables interpolates variables, such as Parameters and Results, in the Input and Values.

Jump to

Keyboard shortcuts

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