code
stringlengths
12
335k
docstring
stringlengths
20
20.8k
func_name
stringlengths
1
105
language
stringclasses
1 value
repo
stringclasses
498 values
path
stringlengths
5
172
url
stringlengths
43
235
license
stringclasses
4 values
func findDups(vals []string) sets.String { seen := sets.String{} dups := sets.String{} for _, val := range vals { if seen.Has(val) { dups.Insert(val) } seen.Insert(val) } return dups }
findDups returns the duplicate element in the given slice
findDups
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func (p Param) GetVarSubstitutionExpressions() ([]string, bool) { var allExpressions []string switch p.Value.Type { case ParamTypeArray: // array type for _, value := range p.Value.ArrayVal { allExpressions = append(allExpressions, validateString(value)...) } case ParamTypeString: // string type allExpressions = append(allExpressions, validateString(p.Value.StringVal)...) case ParamTypeObject: // object type for _, value := range p.Value.ObjectVal { allExpressions = append(allExpressions, validateString(value)...) } default: return nil, false } return allExpressions, len(allExpressions) != 0 }
GetVarSubstitutionExpressions extracts all the value between "$(" and ")"" for a Parameter
GetVarSubstitutionExpressions
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func (ps Params) ExtractNames() sets.String { names := sets.String{} for _, p := range ps { names.Insert(p.Name) } return names }
ExtractNames returns a set of unique names
ExtractNames
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func (ps Params) extractParamMapArrVals() map[string][]string { paramsMap := make(map[string][]string) for _, p := range ps { paramsMap[p.Name] = p.Value.ArrayVal } return paramsMap }
extractParamMapArrVals creates a param map with the key: param.Name and val: param.Value.ArrayVal
extractParamMapArrVals
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func (p Param) ParseTaskandResultName() (string, string) { if expressions, ok := p.GetVarSubstitutionExpressions(); ok { for _, expression := range expressions { subExpressions := strings.Split(expression, ".") pipelineTaskName := subExpressions[1] if len(subExpressions) == 4 { return pipelineTaskName, "" } else if len(subExpressions) == 5 { resultName := subExpressions[3] return pipelineTaskName, resultName } } } return "", "" }
ParseTaskandResultName parses "task name", "result name" from a Matrix Context Variable Valid Example 1: - Input: tasks.myTask.matrix.length - Output: "myTask", "" Valid Example 2: - Input: tasks.myTask.matrix.ResultName.length - Output: "myTask", "ResultName"
ParseTaskandResultName
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func (ps Params) ExtractParamArrayLengths() map[string]int { // Collect all array params arrayParamsLengths := make(map[string]int) // Collect array params lengths from params for _, p := range ps { if p.Value.Type == ParamTypeArray { arrayParamsLengths[p.Name] = len(p.Value.ArrayVal) } } return arrayParamsLengths }
ExtractParamArrayLengths extract and return the lengths of all array params Example of returned value: {"a-array-params": 2,"b-array-params": 2 }
ExtractParamArrayLengths
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func (ps Params) validateDuplicateParameters() (errs *apis.FieldError) { taskParamNames := sets.NewString() for i, param := range ps { if taskParamNames.Has(param.Name) { errs = errs.Also(apis.ErrGeneric(fmt.Sprintf("parameter names must be unique,"+ " the parameter \"%s\" is also defined at", param.Name), fmt.Sprintf("[%d].name", i))) } taskParamNames.Insert(param.Name) } return errs }
validateDuplicateParameters checks if a parameter with the same name is defined more than once
validateDuplicateParameters
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func (ps Params) ReplaceVariables(stringReplacements map[string]string, arrayReplacements map[string][]string, objectReplacements map[string]map[string]string) Params { params := ps.DeepCopy() for i := range params { params[i].Value.ApplyReplacements(stringReplacements, arrayReplacements, objectReplacements) } return params }
ReplaceVariables applies string, array and object replacements to variables in Params
ReplaceVariables
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func (ps ParamSpecs) ExtractDefaultParamArrayLengths() map[string]int { // Collect all array params arrayParamsLengths := make(map[string]int) // Collect array params lengths from defaults for _, p := range ps { if p.Default != nil { if p.Default.Type == ParamTypeArray { arrayParamsLengths[p.Name] = len(p.Default.ArrayVal) } } } return arrayParamsLengths }
ExtractDefaultParamArrayLengths extract and return the lengths of all array params Example of returned value: {"a-array-params": 2,"b-array-params": 2 }
ExtractDefaultParamArrayLengths
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func extractArrayIndexingParamRefs(paramReference string) []string { l := []string{} list := substitution.ExtractArrayIndexingParamsExpressions(paramReference) for _, val := range list { indexString := substitution.ExtractIndexString(val) if indexString != "" { l = append(l, val) } } return l }
extractArrayIndexingParamRefs takes a string of the form `foo-$(params.array-param[1])-bar` and extracts the portions of the string that reference an element in an array param. For example, for the string “foo-$(params.array-param[1])-bar-$(params.other-array-param[2])-$(params.string-param)`, it would return ["$(params.array-param[1])", "$(params.other-array-param[2])"].
extractArrayIndexingParamRefs
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func extractParamRefsFromSteps(steps []Step) []string { paramsRefs := []string{} for _, step := range steps { paramsRefs = append(paramsRefs, step.Script) container := step.ToK8sContainer() paramsRefs = append(paramsRefs, extractParamRefsFromContainer(container)...) } return paramsRefs }
extractParamRefsFromSteps get all array indexing references from steps
extractParamRefsFromSteps
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func extractParamRefsFromStepTemplate(stepTemplate *StepTemplate) []string { if stepTemplate == nil { return nil } container := stepTemplate.ToK8sContainer() return extractParamRefsFromContainer(container) }
extractParamRefsFromStepTemplate get all array indexing references from StepsTemplate
extractParamRefsFromStepTemplate
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func extractParamRefsFromSidecars(sidecars []Sidecar) []string { paramsRefs := []string{} for _, s := range sidecars { paramsRefs = append(paramsRefs, s.Script) container := s.ToK8sContainer() paramsRefs = append(paramsRefs, extractParamRefsFromContainer(container)...) } return paramsRefs }
extractParamRefsFromSidecars get all array indexing references from sidecars
extractParamRefsFromSidecars
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func extractParamRefsFromVolumes(volumes []corev1.Volume) []string { paramsRefs := []string{} for i, v := range volumes { paramsRefs = append(paramsRefs, v.Name) if v.VolumeSource.ConfigMap != nil { paramsRefs = append(paramsRefs, v.ConfigMap.Name) for _, item := range v.ConfigMap.Items { paramsRefs = append(paramsRefs, item.Key) paramsRefs = append(paramsRefs, item.Path) } } if v.VolumeSource.Secret != nil { paramsRefs = append(paramsRefs, v.Secret.SecretName) for _, item := range v.Secret.Items { paramsRefs = append(paramsRefs, item.Key) paramsRefs = append(paramsRefs, item.Path) } } if v.PersistentVolumeClaim != nil { paramsRefs = append(paramsRefs, v.PersistentVolumeClaim.ClaimName) } if v.Projected != nil { for _, s := range volumes[i].Projected.Sources { if s.ConfigMap != nil { paramsRefs = append(paramsRefs, s.ConfigMap.Name) } if s.Secret != nil { paramsRefs = append(paramsRefs, s.Secret.Name) } if s.ServiceAccountToken != nil { paramsRefs = append(paramsRefs, s.ServiceAccountToken.Audience) } } } if v.CSI != nil { if v.CSI.NodePublishSecretRef != nil { paramsRefs = append(paramsRefs, v.CSI.NodePublishSecretRef.Name) } if v.CSI.VolumeAttributes != nil { for _, value := range v.CSI.VolumeAttributes { paramsRefs = append(paramsRefs, value) } } } } return paramsRefs }
extractParamRefsFromVolumes get all array indexing references from volumes
extractParamRefsFromVolumes
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func extractParamRefsFromContainer(c *corev1.Container) []string { paramsRefs := []string{} paramsRefs = append(paramsRefs, c.Name) paramsRefs = append(paramsRefs, c.Image) paramsRefs = append(paramsRefs, string(c.ImagePullPolicy)) paramsRefs = append(paramsRefs, c.Args...) for ie, e := range c.Env { paramsRefs = append(paramsRefs, e.Value) if c.Env[ie].ValueFrom != nil { if e.ValueFrom.SecretKeyRef != nil { paramsRefs = append(paramsRefs, e.ValueFrom.SecretKeyRef.LocalObjectReference.Name) paramsRefs = append(paramsRefs, e.ValueFrom.SecretKeyRef.Key) } if e.ValueFrom.ConfigMapKeyRef != nil { paramsRefs = append(paramsRefs, e.ValueFrom.ConfigMapKeyRef.LocalObjectReference.Name) paramsRefs = append(paramsRefs, e.ValueFrom.ConfigMapKeyRef.Key) } } } for _, e := range c.EnvFrom { paramsRefs = append(paramsRefs, e.Prefix) if e.ConfigMapRef != nil { paramsRefs = append(paramsRefs, e.ConfigMapRef.LocalObjectReference.Name) } if e.SecretRef != nil { paramsRefs = append(paramsRefs, e.SecretRef.LocalObjectReference.Name) } } paramsRefs = append(paramsRefs, c.WorkingDir) paramsRefs = append(paramsRefs, c.Command...) for _, v := range c.VolumeMounts { paramsRefs = append(paramsRefs, v.Name) paramsRefs = append(paramsRefs, v.MountPath) paramsRefs = append(paramsRefs, v.SubPath) } return paramsRefs }
extractParamRefsFromContainer get all array indexing references from container
extractParamRefsFromContainer
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func (paramValues *ParamValue) UnmarshalJSON(value []byte) error { // ParamValues is used for Results Value as well, the results can be any kind of // data so we need to check if it is empty. if len(value) == 0 { paramValues.Type = ParamTypeString return nil } if value[0] == '[' { // We're trying to Unmarshal to []string, but for cases like []int or other types // of nested array which we don't support yet, we should continue and Unmarshal // it to String. If the Type being set doesn't match what it actually should be, // it will be captured by validation in reconciler. // if failed to unmarshal to array, we will convert the value to string and marshal it to string var a []string if err := json.Unmarshal(value, &a); err == nil { paramValues.Type = ParamTypeArray paramValues.ArrayVal = a return nil } } if value[0] == '{' { // if failed to unmarshal to map, we will convert the value to string and marshal it to string var m map[string]string if err := json.Unmarshal(value, &m); err == nil { paramValues.Type = ParamTypeObject paramValues.ObjectVal = m return nil } } // By default we unmarshal to string paramValues.Type = ParamTypeString if err := json.Unmarshal(value, &paramValues.StringVal); err == nil { return nil } paramValues.StringVal = string(value) return nil }
UnmarshalJSON implements the json.Unmarshaller interface.
UnmarshalJSON
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func (paramValues ParamValue) MarshalJSON() ([]byte, error) { switch paramValues.Type { case ParamTypeString: return json.Marshal(paramValues.StringVal) case ParamTypeArray: return json.Marshal(paramValues.ArrayVal) case ParamTypeObject: return json.Marshal(paramValues.ObjectVal) default: return []byte{}, fmt.Errorf("impossible ParamValues.Type: %q", paramValues.Type) } }
MarshalJSON implements the json.Marshaller interface.
MarshalJSON
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func (paramValues *ParamValue) ApplyReplacements(stringReplacements map[string]string, arrayReplacements map[string][]string, objectReplacements map[string]map[string]string) { switch paramValues.Type { case ParamTypeArray: newArrayVal := []string{} for _, v := range paramValues.ArrayVal { newArrayVal = append(newArrayVal, substitution.ApplyArrayReplacements(v, stringReplacements, arrayReplacements)...) } paramValues.ArrayVal = newArrayVal case ParamTypeObject: newObjectVal := map[string]string{} for k, v := range paramValues.ObjectVal { newObjectVal[k] = substitution.ApplyReplacements(v, stringReplacements) } paramValues.ObjectVal = newObjectVal case ParamTypeString: fallthrough default: paramValues.applyOrCorrect(stringReplacements, arrayReplacements, objectReplacements) } }
ApplyReplacements applyes replacements for ParamValues type
ApplyReplacements
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func (paramValues *ParamValue) applyOrCorrect(stringReplacements map[string]string, arrayReplacements map[string][]string, objectReplacements map[string]map[string]string) { stringVal := paramValues.StringVal // if the stringVal is a string literal or a string that mixed with var references // just do the normal string replacement if !exactVariableSubstitutionRegex.MatchString(stringVal) { paramValues.StringVal = substitution.ApplyReplacements(paramValues.StringVal, stringReplacements) return } // trim the head "$(" and the tail ")" or "[*])" // i.e. get "params.name" from "$(params.name)" or "$(params.name[*])" trimedStringVal := substitution.StripStarVarSubExpression(stringVal) // if the stringVal is a reference to a string param if _, ok := stringReplacements[trimedStringVal]; ok { paramValues.StringVal = substitution.ApplyReplacements(paramValues.StringVal, stringReplacements) } // if the stringVal is a reference to an array param, we need to change the type other than apply replacement if _, ok := arrayReplacements[trimedStringVal]; ok { paramValues.StringVal = "" paramValues.ArrayVal = substitution.ApplyArrayReplacements(stringVal, stringReplacements, arrayReplacements) paramValues.Type = ParamTypeArray } // if the stringVal is a reference an object param, we need to change the type other than apply replacement if _, ok := objectReplacements[trimedStringVal]; ok { paramValues.StringVal = "" paramValues.ObjectVal = objectReplacements[trimedStringVal] paramValues.Type = ParamTypeObject } }
applyOrCorrect deals with string param whose value can be string literal or a reference to a string/array/object param/result. If the value of paramValues is a reference to array or object, the type will be corrected from string to array/object.
applyOrCorrect
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func NewStructuredValues(value string, values ...string) *ParamValue { if len(values) > 0 { return &ParamValue{ Type: ParamTypeArray, ArrayVal: append([]string{value}, values...), } } return &ParamValue{ Type: ParamTypeString, StringVal: value, } }
NewStructuredValues creates an ParamValues of type ParamTypeString or ParamTypeArray, based on how many inputs are given (>1 input will create an array, not string).
NewStructuredValues
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func NewObject(pairs map[string]string) *ParamValue { return &ParamValue{ Type: ParamTypeObject, ObjectVal: pairs, } }
NewObject creates an ParamValues of type ParamTypeObject using the provided key-value pairs
NewObject
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func ArrayReference(a string) string { return strings.TrimSuffix(strings.TrimPrefix(a, "$("+ParamsPrefix+"."), "[*])") }
ArrayReference returns the name of the parameter from array parameter reference returns arrayParam from $(params.arrayParam[*])
ArrayReference
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func validatePipelineParametersVariablesInTaskParameters(params Params, prefix string, paramNames sets.String, arrayParamNames sets.String, objectParamNameKeys map[string][]string) (errs *apis.FieldError) { errs = errs.Also(params.validateDuplicateParameters()).ViaField("params") for _, param := range params { switch param.Value.Type { case ParamTypeArray: for idx, arrayElement := range param.Value.ArrayVal { errs = errs.Also(validateArrayVariable(arrayElement, prefix, paramNames, arrayParamNames, objectParamNameKeys).ViaFieldIndex("value", idx).ViaFieldKey("params", param.Name)) } case ParamTypeObject: for key, val := range param.Value.ObjectVal { errs = errs.Also(validateStringVariable(val, prefix, paramNames, arrayParamNames, objectParamNameKeys).ViaFieldKey("properties", key).ViaFieldKey("params", param.Name)) } case ParamTypeString: fallthrough default: errs = errs.Also(validateParamStringValue(param, prefix, paramNames, arrayParamNames, objectParamNameKeys)) } } return errs }
validatePipelineParametersVariablesInTaskParameters validates param value that may contain the reference(s) to other params to make sure those references are used appropriately.
validatePipelineParametersVariablesInTaskParameters
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func validateParamStringValue(param Param, prefix string, paramNames sets.String, arrayVars sets.String, objectParamNameKeys map[string][]string) (errs *apis.FieldError) { stringValue := param.Value.StringVal // if the provided param value is an isolated reference to the whole array/object, we just check if the param name exists. isIsolated, errs := substitution.ValidateWholeArrayOrObjectRefInStringVariable(param.Name, stringValue, prefix, paramNames) if isIsolated { return errs } // if the provided param value is string literal and/or contains multiple variables // valid example: "$(params.myString) and another $(params.myObject.key1)" // invalid example: "$(params.myString) and another $(params.myObject[*])" return validateStringVariable(stringValue, prefix, paramNames, arrayVars, objectParamNameKeys).ViaFieldKey("params", param.Name) }
validateParamStringValue validates the param value field of string type that may contain references to other isolated array/object params other than string param.
validateParamStringValue
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func validateStringVariable(value, prefix string, stringVars sets.String, arrayVars sets.String, objectParamNameKeys map[string][]string) *apis.FieldError { errs := substitution.ValidateNoReferencesToUnknownVariables(value, prefix, stringVars) errs = errs.Also(validateObjectVariable(value, prefix, objectParamNameKeys)) return errs.Also(substitution.ValidateNoReferencesToProhibitedVariables(value, prefix, arrayVars)) }
validateStringVariable validates the normal string fields that can only accept references to string param or individual keys of object param
validateStringVariable
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go
Apache-2.0
func (tr *TaskRun) ConvertTo(ctx context.Context, sink apis.Convertible) error { if apis.IsInDelete(ctx) { return nil } return fmt.Errorf("v1 is the highest known version, got: %T", sink) }
ConvertTo implements apis.Convertible
ConvertTo
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_conversion.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_conversion.go
Apache-2.0
func (tr *TaskRun) ConvertFrom(ctx context.Context, source apis.Convertible) error { if apis.IsInDelete(ctx) { return nil } return fmt.Errorf("v1 is the highest known version, got: %T", source) }
ConvertFrom implements apis.Convertible
ConvertFrom
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_conversion.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_conversion.go
Apache-2.0
func (tr TaskResult) Validate(ctx context.Context) (errs *apis.FieldError) { if !resultNameFormatRegex.MatchString(tr.Name) { return apis.ErrInvalidKeyName(tr.Name, "name", fmt.Sprintf("Name must consist of alphanumeric characters, '-', '_', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my-name', or 'my_name', regex used for validation is '%s')", ResultNameFormat)) } switch { case tr.Type == ResultsTypeObject: errs = errs.Also(validateObjectResult(tr)) case tr.Type == ResultsTypeArray: // Resources created before the result. Type was introduced may not have Type set // and should be considered valid case tr.Type == "": // By default, the result type is string case tr.Type != ResultsTypeString: errs = errs.Also(apis.ErrInvalidValue(tr.Type, "type", "type must be string")) } return errs.Also(tr.validateValue(ctx)) }
Validate implements apis.Validatable
Validate
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/result_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/result_validation.go
Apache-2.0
func validateObjectResult(tr TaskResult) (errs *apis.FieldError) { if ParamType(tr.Type) == ParamTypeObject && tr.Properties == nil { return apis.ErrMissingField(tr.Name + ".properties") } invalidKeys := []string{} for key, propertySpec := range tr.Properties { if propertySpec.Type != ParamTypeString { invalidKeys = append(invalidKeys, key) } } if len(invalidKeys) != 0 { return &apis.FieldError{ Message: fmt.Sprintf("The value type specified for these keys %v is invalid, the type must be string", invalidKeys), Paths: []string{tr.Name + ".properties"}, } } return nil }
validateObjectResult validates the object result and check if the Properties is missing for Properties values it will check if the type is string.
validateObjectResult
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/result_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/result_validation.go
Apache-2.0
func (tr TaskResult) validateValue(ctx context.Context) (errs *apis.FieldError) { if tr.Value == nil { return nil } if !config.FromContextOrDefaults(ctx).FeatureFlags.EnableStepActions { return apis.ErrGeneric(fmt.Sprintf("feature flag %s should be set to true to fetch Results from Steps using StepActions.", config.EnableStepActions)) } if tr.Value.Type != ParamTypeString { return &apis.FieldError{ Message: fmt.Sprintf( "Invalid Type. Wanted string but got: \"%v\"", tr.Value.Type), Paths: []string{ tr.Name + ".type", }, } } if tr.Value.StringVal != "" { stepName, resultName, err := ExtractStepResultName(tr.Value.StringVal) if err != nil { return &apis.FieldError{ Message: fmt.Sprintf("%v", err), Paths: []string{tr.Name + ".value"}, } } if e := validation.IsDNS1123Label(stepName); len(e) > 0 { errs = errs.Also(&apis.FieldError{ Message: fmt.Sprintf("invalid extracted step name %q", stepName), Paths: []string{tr.Name + ".value"}, Details: "stepName in $(steps.<stepName>.results.<resultName>) must be a valid DNS Label, For more info refer to https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", }) } if !resultNameFormatRegex.MatchString(resultName) { errs = errs.Also(&apis.FieldError{ Message: fmt.Sprintf("invalid extracted result name %q", resultName), Paths: []string{tr.Name + ".value"}, Details: fmt.Sprintf("resultName in $(steps.<stepName>.results.<resultName>) must consist of alphanumeric characters, '-', '_', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my-name', or 'my_name', regex used for validation is '%s')", ResultNameFormat), }) } } return errs }
validateValue validates the value of the TaskResult. It requires that enable-step-actions is true, the value is of type string and format $(steps.<stepName>.results.<resultName>)
validateValue
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/result_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/result_validation.go
Apache-2.0
func (sr StepResult) Validate(ctx context.Context) (errs *apis.FieldError) { if !resultNameFormatRegex.MatchString(sr.Name) { return apis.ErrInvalidKeyName(sr.Name, "name", fmt.Sprintf("Name must consist of alphanumeric characters, '-', '_', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my-name', or 'my_name', regex used for validation is '%s')", ResultNameFormat)) } switch { case sr.Type == ResultsTypeObject: return validateObjectStepResult(sr) case sr.Type == ResultsTypeArray: return nil // The Type is string by default if it is empty. case sr.Type == "": return nil case sr.Type == ResultsTypeString: return nil default: return apis.ErrInvalidValue(sr.Type, "type", fmt.Sprintf("invalid type %s", sr.Type)) } }
Validate implements apis.Validatable
Validate
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/result_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/result_validation.go
Apache-2.0
func validateObjectStepResult(sr StepResult) (errs *apis.FieldError) { if ParamType(sr.Type) == ParamTypeObject && sr.Properties == nil { return apis.ErrMissingField(sr.Name + ".properties") } invalidKeys := []string{} for key, propertySpec := range sr.Properties { // In case we need to support other types in the future like the nested objects #7069 if propertySpec.Type != ParamTypeString { invalidKeys = append(invalidKeys, key) } } if len(invalidKeys) != 0 { return &apis.FieldError{ Message: fmt.Sprintf("the value type specified for these keys %v is invalid, the type must be string", invalidKeys), Paths: []string{sr.Name + ".properties"}, } } return nil }
validateObjectStepResult validates the object result and check if the Properties is missing for Properties values it will check if the type is string.
validateObjectStepResult
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/result_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/result_validation.go
Apache-2.0
func ExtractStepResultName(value string) (string, string, error) { re := regexp.MustCompile(`\$\(steps\.(.*?)\.results\.(.*?)\)`) rs := re.FindStringSubmatch(value) if len(rs) != 3 { return "", "", fmt.Errorf("Could not extract step name and result name. Expected value to look like $(steps.<stepName>.results.<resultName>) but got \"%v\"", value) } return rs[1], rs[2], nil }
ExtractStepResultName extracts the step name and result name from a string matching formtat $(steps.<stepName>.results.<resultName>). If a match is not found, an error is retured.
ExtractStepResultName
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/result_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/result_validation.go
Apache-2.0
func (trd *TaskRunDebug) NeedsDebugOnFailure() bool { if trd.Breakpoints == nil { return false } return trd.Breakpoints.OnFailure == EnabledOnFailureBreakpoint }
NeedsDebugOnFailure return true if the TaskRun is configured to debug on failure
NeedsDebugOnFailure
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (trd *TaskRunDebug) NeedsDebugBeforeStep(stepName string) bool { if trd.Breakpoints == nil { return false } beforeStepSets := sets.NewString(trd.Breakpoints.BeforeSteps...) return beforeStepSets.Has(stepName) }
NeedsDebugBeforeStep return true if the step is configured to debug before execution
NeedsDebugBeforeStep
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (trd *TaskRunDebug) StepNeedsDebug(stepName string) bool { return trd.NeedsDebugOnFailure() || trd.NeedsDebugBeforeStep(stepName) }
StepNeedsDebug return true if the step is configured to debug
StepNeedsDebug
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (trd *TaskRunDebug) NeedsDebug() bool { return trd.NeedsDebugOnFailure() || trd.HaveBeforeSteps() }
NeedsDebug return true if defined onfailure or have any before, after steps
NeedsDebug
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (trd *TaskRunDebug) HaveBeforeSteps() bool { return trd.Breakpoints != nil && len(trd.Breakpoints.BeforeSteps) > 0 }
HaveBeforeSteps return true if have any before steps
HaveBeforeSteps
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (trs *TaskRunStatus) GetStartedReason() string { return TaskRunReasonStarted.String() }
GetStartedReason returns the reason set to the "Succeeded" condition when InitializeConditions is invoked
GetStartedReason
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (trs *TaskRunStatus) GetRunningReason() string { return TaskRunReasonRunning.String() }
GetRunningReason returns the reason set to the "Succeeded" condition when the TaskRun starts running. This is used indicate that the resource could be validated is starting to perform its job.
GetRunningReason
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (trs *TaskRunStatus) MarkResourceOngoing(reason TaskRunReason, message string) { taskRunCondSet.Manage(trs).SetCondition(apis.Condition{ Type: apis.ConditionSucceeded, Status: corev1.ConditionUnknown, Reason: reason.String(), Message: message, }) }
MarkResourceOngoing sets the ConditionSucceeded condition to ConditionUnknown with the reason and message.
MarkResourceOngoing
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (trs *TaskRunStatus) MarkResourceFailed(reason TaskRunReason, err error) { taskRunCondSet.Manage(trs).SetCondition(apis.Condition{ Type: apis.ConditionSucceeded, Status: corev1.ConditionFalse, Reason: reason.String(), Message: pipelineErrors.GetErrorMessage(err), }) succeeded := trs.GetCondition(apis.ConditionSucceeded) trs.CompletionTime = &succeeded.LastTransitionTime.Inner }
MarkResourceFailed sets the ConditionSucceeded condition to ConditionFalse based on an error that occurred and a reason
MarkResourceFailed
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (*TaskRun) GetGroupVersionKind() schema.GroupVersionKind { return SchemeGroupVersion.WithKind(pipeline.TaskRunControllerName) }
GetGroupVersionKind implements kmeta.OwnerRefable.
GetGroupVersionKind
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (tr *TaskRun) GetStatusCondition() apis.ConditionAccessor { return &tr.Status }
GetStatusCondition returns the task run status as a ConditionAccessor
GetStatusCondition
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (trs *TaskRunStatus) GetCondition(t apis.ConditionType) *apis.Condition { return taskRunCondSet.Manage(trs).GetCondition(t) }
GetCondition returns the Condition matching the given type.
GetCondition
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (trs *TaskRunStatus) InitializeConditions() { started := false if trs.StartTime.IsZero() { trs.StartTime = &metav1.Time{Time: time.Now()} started = true } conditionManager := taskRunCondSet.Manage(trs) conditionManager.InitializeConditions() // Ensure the started reason is set for the "Succeeded" condition if started { initialCondition := conditionManager.GetCondition(apis.ConditionSucceeded) initialCondition.Reason = TaskRunReasonStarted.String() conditionManager.SetCondition(*initialCondition) } }
InitializeConditions will set all conditions in taskRunCondSet to unknown for the TaskRun and set the started time to the current time
InitializeConditions
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (trs *TaskRunStatus) SetCondition(newCond *apis.Condition) { if newCond != nil { taskRunCondSet.Manage(trs).SetCondition(*newCond) } }
SetCondition sets the condition, unsetting previous conditions with the same type as necessary.
SetCondition
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (tr *TaskRun) GetPipelineRunPVCName() string { if tr == nil { return "" } for _, ref := range tr.GetOwnerReferences() { if ref.Kind == pipeline.PipelineRunControllerName { return ref.Name + "-pvc" } } return "" }
GetPipelineRunPVCName for TaskRun gets pipelinerun
GetPipelineRunPVCName
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (tr *TaskRun) HasPipelineRunOwnerReference() bool { for _, ref := range tr.GetOwnerReferences() { if ref.Kind == pipeline.PipelineRunControllerName { return true } } return false }
HasPipelineRunOwnerReference returns true of TaskRun has owner reference of type PipelineRun
HasPipelineRunOwnerReference
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (tr *TaskRun) IsDone() bool { return !tr.Status.GetCondition(apis.ConditionSucceeded).IsUnknown() }
IsDone returns true if the TaskRun's status indicates that it is done.
IsDone
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (tr *TaskRun) HasStarted() bool { return tr.Status.StartTime != nil && !tr.Status.StartTime.IsZero() }
HasStarted function check whether TaskRun has valid start time set in its status
HasStarted
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (tr *TaskRun) IsSuccessful() bool { return tr != nil && tr.Status.GetCondition(apis.ConditionSucceeded).IsTrue() }
IsSuccessful returns true if the TaskRun's status indicates that it has succeeded.
IsSuccessful
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (tr *TaskRun) IsFailure() bool { return tr != nil && tr.Status.GetCondition(apis.ConditionSucceeded).IsFalse() }
IsFailure returns true if the TaskRun's status indicates that it has failed.
IsFailure
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (tr *TaskRun) IsCancelled() bool { return tr.Spec.Status == TaskRunSpecStatusCancelled }
IsCancelled returns true if the TaskRun's spec status is set to Cancelled state
IsCancelled
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (tr *TaskRun) IsRetriable() bool { return len(tr.Status.RetriesStatus) < tr.Spec.Retries }
IsRetriable returns true if the TaskRun's Retries is not exhausted.
IsRetriable
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (tr *TaskRun) HasTimedOut(ctx context.Context, c clock.PassiveClock) bool { if tr.Status.StartTime.IsZero() { return false } timeout := tr.GetTimeout(ctx) // If timeout is set to 0 or defaulted to 0, there is no timeout. if timeout == apisconfig.NoTimeoutDuration { return false } runtime := c.Since(tr.Status.StartTime.Time) return runtime > timeout }
HasTimedOut returns true if the TaskRun runtime is beyond the allowed timeout
HasTimedOut
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (tr *TaskRun) GetTimeout(ctx context.Context) time.Duration { // Use the platform default is no timeout is set if tr.Spec.Timeout == nil { defaultTimeout := time.Duration(config.FromContextOrDefaults(ctx).Defaults.DefaultTimeoutMinutes) return defaultTimeout * time.Minute //nolint:durationcheck } return tr.Spec.Timeout.Duration }
GetTimeout returns the timeout for the TaskRun, or the default if not specified
GetTimeout
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (tr *TaskRun) GetNamespacedName() types.NamespacedName { return types.NamespacedName{Namespace: tr.Namespace, Name: tr.Name} }
GetNamespacedName returns a k8s namespaced name that identifies this TaskRun
GetNamespacedName
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (tr *TaskRun) HasVolumeClaimTemplate() bool { for _, ws := range tr.Spec.Workspaces { if ws.VolumeClaimTemplate != nil { return true } } return false }
HasVolumeClaimTemplate returns true if TaskRun contains volumeClaimTemplates that is used for creating PersistentVolumeClaims with an OwnerReference for each run
HasVolumeClaimTemplate
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go
Apache-2.0
func (s *Step) ToK8sContainer() *corev1.Container { return &corev1.Container{ Name: s.Name, Image: s.Image, Command: s.Command, Args: s.Args, WorkingDir: s.WorkingDir, EnvFrom: s.EnvFrom, Env: s.Env, Resources: s.ComputeResources, VolumeMounts: s.VolumeMounts, VolumeDevices: s.VolumeDevices, ImagePullPolicy: s.ImagePullPolicy, SecurityContext: s.SecurityContext, } }
ToK8sContainer converts the Step to a Kubernetes Container struct
ToK8sContainer
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go
Apache-2.0
func (s *Step) SetContainerFields(c corev1.Container) { s.Name = c.Name s.Image = c.Image s.Command = c.Command s.Args = c.Args s.WorkingDir = c.WorkingDir s.EnvFrom = c.EnvFrom s.Env = c.Env s.ComputeResources = c.Resources s.VolumeMounts = c.VolumeMounts s.VolumeDevices = c.VolumeDevices s.ImagePullPolicy = c.ImagePullPolicy s.SecurityContext = c.SecurityContext }
SetContainerFields sets the fields of the Step to the values of the corresponding fields in the Container
SetContainerFields
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go
Apache-2.0
func (s *Step) GetVarSubstitutionExpressions() []string { var allExpressions []string allExpressions = append(allExpressions, validateString(s.Name)...) allExpressions = append(allExpressions, validateString(s.Image)...) allExpressions = append(allExpressions, validateString(string(s.ImagePullPolicy))...) allExpressions = append(allExpressions, validateString(s.Script)...) allExpressions = append(allExpressions, validateString(s.WorkingDir)...) for _, cmd := range s.Command { allExpressions = append(allExpressions, validateString(cmd)...) } for _, arg := range s.Args { allExpressions = append(allExpressions, validateString(arg)...) } for _, env := range s.Env { allExpressions = append(allExpressions, validateString(env.Value)...) if env.ValueFrom != nil { if env.ValueFrom.SecretKeyRef != nil { allExpressions = append(allExpressions, validateString(env.ValueFrom.SecretKeyRef.Key)...) allExpressions = append(allExpressions, validateString(env.ValueFrom.SecretKeyRef.LocalObjectReference.Name)...) } if env.ValueFrom.ConfigMapKeyRef != nil { allExpressions = append(allExpressions, validateString(env.ValueFrom.ConfigMapKeyRef.Key)...) allExpressions = append(allExpressions, validateString(env.ValueFrom.ConfigMapKeyRef.LocalObjectReference.Name)...) } } } return allExpressions }
GetVarSubstitutionExpressions walks all the places a substitution reference can be used
GetVarSubstitutionExpressions
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go
Apache-2.0
func (s *StepTemplate) SetContainerFields(c corev1.Container) { s.Image = c.Image s.Command = c.Command s.Args = c.Args s.WorkingDir = c.WorkingDir s.EnvFrom = c.EnvFrom s.Env = c.Env s.ComputeResources = c.Resources s.VolumeMounts = c.VolumeMounts s.VolumeDevices = c.VolumeDevices s.ImagePullPolicy = c.ImagePullPolicy s.SecurityContext = c.SecurityContext }
SetContainerFields sets the fields of the Step to the values of the corresponding fields in the Container
SetContainerFields
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go
Apache-2.0
func (s *StepTemplate) ToK8sContainer() *corev1.Container { return &corev1.Container{ Image: s.Image, Command: s.Command, Args: s.Args, WorkingDir: s.WorkingDir, EnvFrom: s.EnvFrom, Env: s.Env, Resources: s.ComputeResources, VolumeMounts: s.VolumeMounts, VolumeDevices: s.VolumeDevices, ImagePullPolicy: s.ImagePullPolicy, SecurityContext: s.SecurityContext, } }
ToK8sContainer converts the StepTemplate to a Kubernetes Container struct
ToK8sContainer
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go
Apache-2.0
func (s *Sidecar) ToK8sContainer() *corev1.Container { if s.RestartPolicy == nil { return &corev1.Container{ Name: s.Name, Image: s.Image, Command: s.Command, Args: s.Args, WorkingDir: s.WorkingDir, Ports: s.Ports, EnvFrom: s.EnvFrom, Env: s.Env, Resources: s.ComputeResources, VolumeMounts: s.VolumeMounts, VolumeDevices: s.VolumeDevices, LivenessProbe: s.LivenessProbe, ReadinessProbe: s.ReadinessProbe, StartupProbe: s.StartupProbe, Lifecycle: s.Lifecycle, TerminationMessagePath: s.TerminationMessagePath, TerminationMessagePolicy: s.TerminationMessagePolicy, ImagePullPolicy: s.ImagePullPolicy, SecurityContext: s.SecurityContext, Stdin: s.Stdin, StdinOnce: s.StdinOnce, TTY: s.TTY, } } return &corev1.Container{ Name: s.Name, Image: s.Image, Command: s.Command, Args: s.Args, WorkingDir: s.WorkingDir, Ports: s.Ports, EnvFrom: s.EnvFrom, Env: s.Env, Resources: s.ComputeResources, VolumeMounts: s.VolumeMounts, VolumeDevices: s.VolumeDevices, LivenessProbe: s.LivenessProbe, ReadinessProbe: s.ReadinessProbe, RestartPolicy: s.RestartPolicy, StartupProbe: s.StartupProbe, Lifecycle: s.Lifecycle, TerminationMessagePath: s.TerminationMessagePath, TerminationMessagePolicy: s.TerminationMessagePolicy, ImagePullPolicy: s.ImagePullPolicy, SecurityContext: s.SecurityContext, Stdin: s.Stdin, StdinOnce: s.StdinOnce, TTY: s.TTY, } }
ToK8sContainer converts the Sidecar to a Kubernetes Container struct
ToK8sContainer
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go
Apache-2.0
func (s *Sidecar) SetContainerFields(c corev1.Container) { s.Name = c.Name s.Image = c.Image s.Command = c.Command s.Args = c.Args s.WorkingDir = c.WorkingDir s.Ports = c.Ports s.EnvFrom = c.EnvFrom s.Env = c.Env s.ComputeResources = c.Resources s.VolumeMounts = c.VolumeMounts s.VolumeDevices = c.VolumeDevices s.LivenessProbe = c.LivenessProbe s.ReadinessProbe = c.ReadinessProbe s.StartupProbe = c.StartupProbe s.Lifecycle = c.Lifecycle s.TerminationMessagePath = c.TerminationMessagePath s.TerminationMessagePolicy = c.TerminationMessagePolicy s.ImagePullPolicy = c.ImagePullPolicy s.SecurityContext = c.SecurityContext s.Stdin = c.Stdin s.StdinOnce = c.StdinOnce s.TTY = c.TTY s.RestartPolicy = c.RestartPolicy }
SetContainerFields sets the fields of the Sidecar to the values of the corresponding fields in the Container
SetContainerFields
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go
Apache-2.0
func (s *Sidecar) GetVarSubstitutionExpressions() []string { var allExpressions []string allExpressions = append(allExpressions, validateString(s.Name)...) allExpressions = append(allExpressions, validateString(s.Image)...) allExpressions = append(allExpressions, validateString(string(s.ImagePullPolicy))...) allExpressions = append(allExpressions, validateString(s.Script)...) allExpressions = append(allExpressions, validateString(s.WorkingDir)...) for _, cmd := range s.Command { allExpressions = append(allExpressions, validateString(cmd)...) } for _, arg := range s.Args { allExpressions = append(allExpressions, validateString(arg)...) } for _, env := range s.Env { allExpressions = append(allExpressions, validateString(env.Value)...) if env.ValueFrom != nil { if env.ValueFrom.SecretKeyRef != nil { allExpressions = append(allExpressions, validateString(env.ValueFrom.SecretKeyRef.Key)...) allExpressions = append(allExpressions, validateString(env.ValueFrom.SecretKeyRef.LocalObjectReference.Name)...) } if env.ValueFrom.ConfigMapKeyRef != nil { allExpressions = append(allExpressions, validateString(env.ValueFrom.ConfigMapKeyRef.Key)...) allExpressions = append(allExpressions, validateString(env.ValueFrom.ConfigMapKeyRef.LocalObjectReference.Name)...) } } } return allExpressions }
GetVarSubstitutionExpressions walks all the places a substitution reference can be used
GetVarSubstitutionExpressions
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go
Apache-2.0
func (b *WorkspaceBinding) Validate(ctx context.Context) (errs *apis.FieldError) { if equality.Semantic.DeepEqual(b, &WorkspaceBinding{}) || b == nil { return apis.ErrMissingField(apis.CurrentField) } numSources := b.numSources() if numSources > 1 { return apis.ErrMultipleOneOf(allVolumeSourceFields...) } if numSources == 0 { return apis.ErrMissingOneOf(allVolumeSourceFields...) } // For a PersistentVolumeClaim to work, you must at least provide the name of the PVC to use. if b.PersistentVolumeClaim != nil && b.PersistentVolumeClaim.ClaimName == "" { return apis.ErrMissingField("persistentvolumeclaim.claimname") } // For a ConfigMap to work, you must provide the name of the ConfigMap to use. if b.ConfigMap != nil && b.ConfigMap.LocalObjectReference.Name == "" { return apis.ErrMissingField("configmap.name") } // For a Secret to work, you must provide the name of the Secret to use. if b.Secret != nil && b.Secret.SecretName == "" { return apis.ErrMissingField("secret.secretName") } // For a Projected volume to work, you must provide at least one source. if b.Projected != nil && len(b.Projected.Sources) == 0 { if len(b.Projected.Sources) == 0 { return apis.ErrMissingField("projected.sources") } } // For a CSI to work, you must provide and have installed the driver to use. if b.CSI != nil { if b.CSI.Driver == "" { return apis.ErrMissingField("csi.driver") } } return nil }
Validate looks at the Volume provided in wb and makes sure that it is valid. This means that only one VolumeSource can be specified, and also that the supported VolumeSource is itself valid.
Validate
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/workspace_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/workspace_validation.go
Apache-2.0
func (b *WorkspaceBinding) numSources() int { n := 0 if b.VolumeClaimTemplate != nil { n++ } if b.PersistentVolumeClaim != nil { n++ } if b.EmptyDir != nil { n++ } if b.ConfigMap != nil { n++ } if b.Secret != nil { n++ } if b.Projected != nil { n++ } if b.CSI != nil { n++ } return n }
numSources returns the total number of volume sources that this WorkspaceBinding has been configured with.
numSources
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/workspace_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/workspace_validation.go
Apache-2.0
func Kind(kind string) schema.GroupKind { return SchemeGroupVersion.WithKind(kind).GroupKind() }
Kind takes an unqualified kind and returns back a Group qualified GroupKind
Kind
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/register.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/register.go
Apache-2.0
func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() }
Resource takes an unqualified resource and returns a Group qualified GroupResource
Resource
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/register.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/register.go
Apache-2.0
func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &Task{}, &TaskList{}, &Pipeline{}, &PipelineList{}, &TaskRun{}, &TaskRunList{}, &PipelineRun{}, &PipelineRunList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil }
Adds the list of known types to Scheme.
addKnownTypes
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/register.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/register.go
Apache-2.0
func (t *Task) SetDefaults(ctx context.Context) { t.Spec.SetDefaults(ctx) }
SetDefaults implements apis.Defaultable
SetDefaults
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/task_defaults.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/task_defaults.go
Apache-2.0
func (ts *TaskSpec) SetDefaults(ctx context.Context) { cfg := config.FromContextOrDefaults(ctx) for _, s := range ts.Steps { if s.Ref != nil && s.Ref.Name == "" && s.Ref.Resolver == "" { s.Ref.Resolver = ResolverName(cfg.Defaults.DefaultResolverType) } } for i := range ts.Params { ts.Params[i].SetDefaults(ctx) } for i := range ts.Results { ts.Results[i].SetDefaults(ctx) } }
SetDefaults set any defaults for the task spec
SetDefaults
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/task_defaults.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/task_defaults.go
Apache-2.0
func (ref *Ref) Validate(ctx context.Context) (errs *apis.FieldError) { if ref == nil { return errs } return validateRef(ctx, ref.Name, ref.Resolver, ref.Params) }
Validate ensures that a supplied Ref field is populated correctly. No errors are returned for a nil Ref.
Validate
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_validation.go
Apache-2.0
func RefNameLikeUrl(name string) error { schemeRegex := regexp.MustCompile(`[\w-]+:\/\/*`) if !schemeRegex.MatchString(name) { return errors.New("invalid URI for request") } return nil }
RefNameLikeUrl checks if the name is url parsable and returns an error if it isn't.
RefNameLikeUrl
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_validation.go
Apache-2.0
func NewResultRefs(expressions []string) []*ResultRef { var resultRefs []*ResultRef for _, expression := range expressions { pr, err := resultref.ParseTaskExpression(expression) // If the expression isn't a result but is some other expression, // parseTaskExpression will return an error, in which case we just skip that expression, // since although it's not a result ref, it might be some other kind of reference if err == nil { resultRefs = append(resultRefs, &ResultRef{ PipelineTask: pr.ResourceName, Result: pr.ResultName, ResultsIndex: pr.ArrayIdx, Property: pr.ObjectKey, }) } } return resultRefs }
NewResultRefs extracts all ResultReferences from a param or a pipeline result. If the ResultReference can be extracted, they are returned. Expressions which are not results are ignored.
NewResultRefs
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/resultref.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/resultref.go
Apache-2.0
func LooksLikeContainsResultRefs(expressions []string) bool { for _, expression := range expressions { if resultref.LooksLikeResultRef(expression) { return true } } return false }
LooksLikeContainsResultRefs attempts to check if param or a pipeline result looks like it contains any result references. This is useful if we want to make sure the param looks like a ResultReference before performing strict validation
LooksLikeContainsResultRefs
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/resultref.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/resultref.go
Apache-2.0
func ParseResultName(resultName string) (string, string) { return resultref.ParseResultName(resultName) }
ParseResultName parse the input string to extract resultName and result index. Array indexing: Input: anArrayResult[1] Output: anArrayResult, "1" Array star reference: Input: anArrayResult[*] Output: anArrayResult, "*" retained for backwards compatibility
ParseResultName
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/resultref.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/resultref.go
Apache-2.0
func PipelineTaskResultRefs(pt *PipelineTask) []*ResultRef { refs := []*ResultRef{} // TODO move the whenExpression.GetVarSubstitutionExpressions() and GetVarSubstitutionExpressionsForParam(p) as well // separate cleanup, reference https://github.com/tektoncd/pipeline/pull/7121 for _, p := range pt.extractAllParams() { expressions, _ := p.GetVarSubstitutionExpressions() refs = append(refs, NewResultRefs(expressions)...) } for _, whenExpression := range pt.When { expressions, _ := whenExpression.GetVarSubstitutionExpressions() refs = append(refs, NewResultRefs(expressions)...) } taskSubExpressions := pt.GetVarSubstitutionExpressions() refs = append(refs, NewResultRefs(taskSubExpressions)...) return refs }
PipelineTaskResultRefs walks all the places a result reference can be used in a PipelineTask and returns a list of any references that are found.
PipelineTaskResultRefs
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/resultref.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/resultref.go
Apache-2.0
func (p *Pipeline) SetDefaults(ctx context.Context) { p.Spec.SetDefaults(ctx) }
SetDefaults sets default values on the Pipeline's Spec
SetDefaults
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_defaults.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_defaults.go
Apache-2.0
func (ps *PipelineSpec) SetDefaults(ctx context.Context) { for i := range ps.Params { ps.Params[i].SetDefaults(ctx) } for _, pt := range ps.Tasks { pt.SetDefaults(ctx) } for _, ft := range ps.Finally { ctx := ctx // Ensure local scoping per Task ft.SetDefaults(ctx) } }
SetDefaults sets default values for the PipelineSpec's Params, Tasks, and Finally
SetDefaults
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_defaults.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_defaults.go
Apache-2.0
func (pt *PipelineTask) SetDefaults(ctx context.Context) { cfg := config.FromContextOrDefaults(ctx) if pt.TaskRef != nil { if pt.TaskRef.Name == "" && pt.TaskRef.Resolver == "" { pt.TaskRef.Resolver = ResolverName(cfg.Defaults.DefaultResolverType) } if pt.TaskRef.Kind == "" && pt.TaskRef.Resolver == "" { pt.TaskRef.Kind = NamespacedTaskKind } } if pt.TaskSpec != nil { pt.TaskSpec.SetDefaults(ctx) } }
SetDefaults sets default values for a PipelineTask
SetDefaults
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_defaults.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_defaults.go
Apache-2.0
func (p *Pipeline) PipelineMetadata() metav1.ObjectMeta { return p.ObjectMeta }
PipelineMetadata returns the Pipeline's ObjectMeta, implementing PipelineObject
PipelineMetadata
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
Apache-2.0
func (p *Pipeline) PipelineSpec() PipelineSpec { return p.Spec }
PipelineSpec returns the Pipeline's Spec, implementing PipelineObject
PipelineSpec
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
Apache-2.0
func (*Pipeline) GetGroupVersionKind() schema.GroupVersionKind { return SchemeGroupVersion.WithKind(pipeline.PipelineControllerName) }
GetGroupVersionKind implements kmeta.OwnerRefable.
GetGroupVersionKind
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
Apache-2.0
func (p *Pipeline) Checksum() ([]byte, error) { objectMeta := checksum.PrepareObjectMeta(p) preprocessedPipeline := Pipeline{ TypeMeta: metav1.TypeMeta{ APIVersion: "tekton.dev/v1", Kind: "Pipeline"}, ObjectMeta: objectMeta, Spec: p.Spec, } sha256Checksum, err := checksum.ComputeSha256Checksum(preprocessedPipeline) if err != nil { return nil, err } return sha256Checksum, nil }
Checksum computes the sha256 checksum of the pipeline object. Prior to computing the checksum, it performs some preprocessing on the metadata of the object where it removes system provided annotations. Only the name, namespace, generateName, user-provided labels and annotations and the pipelineSpec are included for the checksum computation.
Checksum
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
Apache-2.0
func (et *EmbeddedTask) IsCustomTask() bool { // Note that if `apiVersion` is set to `"tekton.dev/v1beta1"` and `kind` is set to `"Task"`, // the reference will be considered a Custom Task - https://github.com/tektoncd/pipeline/issues/6457 return et != nil && et.APIVersion != "" && et.Kind != "" }
IsCustomTask checks whether an embedded TaskSpec is a Custom Task
IsCustomTask
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
Apache-2.0
func (pt *PipelineTask) IsMatrixed() bool { return pt.Matrix.HasParams() || pt.Matrix.HasInclude() }
IsMatrixed return whether pipeline task is matrixed
IsMatrixed
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
Apache-2.0
func (pt *PipelineTask) TaskSpecMetadata() PipelineTaskMetadata { return pt.TaskSpec.Metadata }
TaskSpecMetadata returns the metadata of the PipelineTask's EmbeddedTask spec.
TaskSpecMetadata
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
Apache-2.0
func (pt PipelineTask) HashKey() string { return pt.Name }
HashKey is the name of the PipelineTask, and is used as the key for this PipelineTask in the DAG
HashKey
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
Apache-2.0
func (pt PipelineTask) Deps() []string { // hold the list of dependencies in a set to avoid duplicates deps := sets.NewString() // add any new dependents from result references - resource dependency for _, ref := range PipelineTaskResultRefs(&pt) { deps.Insert(ref.PipelineTask) } // add any new dependents from runAfter - order dependency for _, runAfter := range pt.RunAfter { deps.Insert(runAfter) } return deps.List() }
Deps returns all other PipelineTask dependencies of this PipelineTask, based on resource usage or ordering
Deps
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
Apache-2.0
func (l PipelineTaskList) Deps() map[string][]string { deps := map[string][]string{} for _, pt := range l { // get the list of deps for this pipelineTask d := pt.Deps() // add the pipelineTask into the map if it has any deps if len(d) > 0 { deps[pt.HashKey()] = d } } return deps }
Deps returns a map with key as name of a pipelineTask and value as a list of its dependencies
Deps
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
Apache-2.0
func (l PipelineTaskList) Items() []dag.Task { tasks := []dag.Task{} for _, t := range l { tasks = append(tasks, dag.Task(t)) } return tasks }
Items returns a slice of all tasks in the PipelineTaskList, converted to dag.Tasks
Items
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
Apache-2.0
func (l PipelineTaskList) Names() sets.String { names := sets.String{} for _, pt := range l { names.Insert(pt.Name) } return names }
Names returns a set of pipeline task names from the given list of pipeline tasks
Names
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
Apache-2.0
func (result PipelineResult) GetVarSubstitutionExpressions() ([]string, bool) { allExpressions := validateString(result.Value.StringVal) for _, v := range result.Value.ArrayVal { allExpressions = append(allExpressions, validateString(v)...) } for _, v := range result.Value.ObjectVal { allExpressions = append(allExpressions, validateString(v)...) } return allExpressions, len(allExpressions) != 0 }
GetVarSubstitutionExpressions extracts all the value between "$(" and ")"" for a PipelineResult
GetVarSubstitutionExpressions
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go
Apache-2.0
func (in *Artifact) DeepCopyInto(out *Artifact) { *out = *in if in.Values != nil { in, out := &in.Values, &out.Values *out = make([]ArtifactValue, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return }
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
DeepCopyInto
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/zz_generated.deepcopy.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/zz_generated.deepcopy.go
Apache-2.0
func (in *Artifact) DeepCopy() *Artifact { if in == nil { return nil } out := new(Artifact) in.DeepCopyInto(out) return out }
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Artifact.
DeepCopy
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/zz_generated.deepcopy.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/zz_generated.deepcopy.go
Apache-2.0
func (in *ArtifactValue) DeepCopyInto(out *ArtifactValue) { *out = *in if in.Digest != nil { in, out := &in.Digest, &out.Digest *out = make(map[Algorithm]string, len(*in)) for key, val := range *in { (*out)[key] = val } } return }
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
DeepCopyInto
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/zz_generated.deepcopy.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/zz_generated.deepcopy.go
Apache-2.0
func (in *ArtifactValue) DeepCopy() *ArtifactValue { if in == nil { return nil } out := new(ArtifactValue) in.DeepCopyInto(out) return out }
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArtifactValue.
DeepCopy
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/zz_generated.deepcopy.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/zz_generated.deepcopy.go
Apache-2.0