Documentation
¶
Index ¶
- Constants
- Variables
- func ArrayReference(a string) string
- func ResultsArrayReference(a string) string
- type Algorithm
- type Artifact
- type ArtifactValue
- type Artifacts
- type ParamType
- type ParamValue
- type PropertySpec
- type ResultValue
- type ResultsType
- type StepResult
- type StepWhenExpressions
- type TaskResult
- type TaskRunResult
- type TaskRunStepArtifact
- type TaskRunStepResult
- type WhenExpression
- type WhenExpressions
Constants ¶
const ParamsPrefix = "params"
ParamsPrefix is the prefix used in $(...) expressions referring to parameters
Variables ¶
var AllParamTypes = []ParamType{ParamTypeString, ParamTypeArray, ParamTypeObject}
AllParamTypes can be used for ParamType validation.
var AllResultsTypes = []ResultsType{ResultsTypeString, ResultsTypeArray, ResultsTypeObject}
AllResultsTypes can be used for ResultsTypes validation.
var VariableSubstitutionRegex = regexp.MustCompile(variableSubstitutionFormat)
VariableSubstitutionRegex is a regex to find all result matching substitutions
Functions ¶
func ArrayReference ¶
ArrayReference returns the name of the parameter from array parameter reference returns arrayParam from $(params.arrayParam[*])
func ResultsArrayReference ¶
ResultsArrayReference returns the reference of the result. e.g. results.resultname from $(results.resultname[*])
Types ¶
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.
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.
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 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.