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 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/v1beta1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/param_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/param_types.go
Apache-2.0
func (tr *TaskRun) ConvertTo(ctx context.Context, to apis.Convertible) error { if apis.IsInDelete(ctx) { return nil } switch sink := to.(type) { case *v1.TaskRun: sink.ObjectMeta = tr.ObjectMeta if err := serializeTaskRunResources(&sink.ObjectMeta, &tr.Spec); err != nil { return err } if err := serializeTaskRunCloudEvents(&sink.ObjectMeta, &tr.Status); err != nil { return err } if err := serializeTaskRunResourcesResult(&sink.ObjectMeta, &tr.Status); err != nil { return err } if err := serializeTaskRunResourcesStatus(&sink.ObjectMeta, &tr.Status); err != nil { return err } if err := tr.Status.ConvertTo(ctx, &sink.Status, &sink.ObjectMeta); err != nil { return err } return tr.Spec.ConvertTo(ctx, &sink.Spec, &sink.ObjectMeta) default: return fmt.Errorf("unknown version, got: %T", sink) }
ConvertTo implements apis.Convertible
ConvertTo
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/taskrun_conversion.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/result_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/result_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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 := v1.ExtractStepResultName(tr.Value.StringVal) if err != nil { return &apis.FieldError{ Message: err.Error(), 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/v1beta1/result_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/result_validation.go
Apache-2.0
func (s *StepAction) SupportedVerbs() []admissionregistrationv1.OperationType { return []admissionregistrationv1.OperationType{admissionregistrationv1.Create, admissionregistrationv1.Update} }
SupportedVerbs returns the operations that validation should be called for
SupportedVerbs
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
Apache-2.0
func (s *StepAction) Validate(ctx context.Context) (errs *apis.FieldError) { errs = validate.ObjectMetadata(s.GetObjectMeta()).ViaField("metadata") errs = errs.Also(s.Spec.Validate(apis.WithinSpec(ctx)).ViaField("spec")) return errs }
Validate implements apis.Validatable
Validate
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
Apache-2.0
func (ss *StepActionSpec) Validate(ctx context.Context) (errs *apis.FieldError) { if ss.Image == "" { errs = errs.Also(apis.ErrMissingField("Image")) } if ss.Script != "" { if len(ss.Command) > 0 { errs = errs.Also(&apis.FieldError{ Message: "script cannot be used with command", Paths: []string{"script"}, }) } cleaned := strings.TrimSpace(ss.Script) if strings.HasPrefix(cleaned, "#!win") { errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "windows script support", config.AlphaAPIFields).ViaField("script")) } errs = errs.Also(validateNoParamSubstitutionsInScript(ss.Script)) } errs = errs.Also(validateUsageOfDeclaredParameters(ctx, *ss)) errs = errs.Also(v1.ValidateParameterTypes(ctx, ss.Params).ViaField("params")) errs = errs.Also(validateParameterVariables(ctx, *ss, ss.Params)) errs = errs.Also(v1.ValidateStepResultsVariables(ctx, ss.Results, ss.Script)) errs = errs.Also(v1.ValidateStepResults(ctx, ss.Results).ViaField("results")) errs = errs.Also(validateVolumeMounts(ss.VolumeMounts, ss.Params).ViaField("volumeMounts")) return errs }
Validate implements apis.Validatable
Validate
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
Apache-2.0
func validateNoParamSubstitutionsInScript(script string) *apis.FieldError { _, present, errString := substitution.ExtractVariablesFromString(script, "params") if errString != "" || present { return &apis.FieldError{ Message: "param substitution in scripts is not allowed.", Paths: []string{"script"}, } } return nil }
validateNoParamSubstitutionsInScript validates that param substitutions are not invoked in the script
validateNoParamSubstitutionsInScript
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
Apache-2.0
func validateUsageOfDeclaredParameters(ctx context.Context, sas StepActionSpec) *apis.FieldError { params := sas.Params var errs *apis.FieldError _, _, objectParams := params.SortByType() allParameterNames := sets.NewString(params.GetNames()...) errs = errs.Also(validateStepActionVariables(ctx, sas, "params", allParameterNames)) errs = errs.Also(ValidateObjectUsage(ctx, sas, objectParams)) errs = errs.Also(v1.ValidateObjectParamsHaveProperties(ctx, params)) return errs }
validateUsageOfDeclaredParameters validates that all parameters referenced in the Task are declared by the Task.
validateUsageOfDeclaredParameters
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
Apache-2.0
func validateParameterVariables(ctx context.Context, sas StepActionSpec, params v1.ParamSpecs) *apis.FieldError { var errs *apis.FieldError errs = errs.Also(params.ValidateNoDuplicateNames()) stringParams, arrayParams, objectParams := params.SortByType() stringParameterNames := sets.NewString(stringParams.GetNames()...) arrayParameterNames := sets.NewString(arrayParams.GetNames()...) errs = errs.Also(v1.ValidateNameFormat(stringParameterNames.Insert(arrayParameterNames.List()...), objectParams)) return errs.Also(validateStepActionArrayUsage(sas, "params", arrayParameterNames)) }
validateParameterVariables validates all variables within a slice of ParamSpecs against a StepAction
validateParameterVariables
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
Apache-2.0
func ValidateObjectUsage(ctx context.Context, sas StepActionSpec, params v1.ParamSpecs) (errs *apis.FieldError) { objectParameterNames := sets.NewString() for _, p := range params { // collect all names of object type params objectParameterNames.Insert(p.Name) // collect all keys for this object param objectKeys := sets.NewString() for key := range p.Properties { objectKeys.Insert(key) } // check if the object's key names are referenced correctly i.e. param.objectParam.key1 errs = errs.Also(validateStepActionVariables(ctx, sas, "params\\."+p.Name, objectKeys)) } return errs.Also(validateStepActionObjectUsageAsWhole(sas, "params", objectParameterNames)) }
ValidateObjectUsage validates the usage of individual attributes of an object param and the usage of the entire object
ValidateObjectUsage
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
Apache-2.0
func validateStepActionObjectUsageAsWhole(sas StepActionSpec, prefix string, vars sets.String) *apis.FieldError { errs := substitution.ValidateNoReferencesToEntireProhibitedVariables(sas.Image, prefix, vars).ViaField("image") errs = errs.Also(substitution.ValidateNoReferencesToEntireProhibitedVariables(sas.Script, prefix, vars).ViaField("script")) for i, cmd := range sas.Command { errs = errs.Also(substitution.ValidateNoReferencesToEntireProhibitedVariables(cmd, prefix, vars).ViaFieldIndex("command", i)) } for i, arg := range sas.Args { errs = errs.Also(substitution.ValidateNoReferencesToEntireProhibitedVariables(arg, prefix, vars).ViaFieldIndex("args", i)) } for _, env := range sas.Env { errs = errs.Also(substitution.ValidateNoReferencesToEntireProhibitedVariables(env.Value, prefix, vars).ViaFieldKey("env", env.Name)) } for i, vm := range sas.VolumeMounts { errs = errs.Also(substitution.ValidateNoReferencesToEntireProhibitedVariables(vm.Name, prefix, vars).ViaFieldIndex("volumeMounts", i)) } return errs }
validateStepActionObjectUsageAsWhole returns an error if the StepAction contains references to the entire input object params in fields where these references are prohibited
validateStepActionObjectUsageAsWhole
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
Apache-2.0
func validateStepActionArrayUsage(sas StepActionSpec, prefix string, arrayParamNames sets.String) *apis.FieldError { errs := substitution.ValidateNoReferencesToProhibitedVariables(sas.Image, prefix, arrayParamNames).ViaField("image") errs = errs.Also(substitution.ValidateNoReferencesToProhibitedVariables(sas.Script, prefix, arrayParamNames).ViaField("script")) for i, cmd := range sas.Command { errs = errs.Also(substitution.ValidateVariableReferenceIsIsolated(cmd, prefix, arrayParamNames).ViaFieldIndex("command", i)) } for i, arg := range sas.Args { errs = errs.Also(substitution.ValidateVariableReferenceIsIsolated(arg, prefix, arrayParamNames).ViaFieldIndex("args", i)) } for _, env := range sas.Env { errs = errs.Also(substitution.ValidateNoReferencesToProhibitedVariables(env.Value, prefix, arrayParamNames).ViaFieldKey("env", env.Name)) } for i, vm := range sas.VolumeMounts { errs = errs.Also(substitution.ValidateNoReferencesToProhibitedVariables(vm.Name, prefix, arrayParamNames).ViaFieldIndex("volumeMounts", i)) } return errs }
validateStepActionArrayUsage returns an error if the Step contains references to the input array params in fields where these references are prohibited
validateStepActionArrayUsage
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
Apache-2.0
func validateStepActionVariables(ctx context.Context, sas StepActionSpec, prefix string, vars sets.String) *apis.FieldError { errs := substitution.ValidateNoReferencesToUnknownVariables(sas.Image, prefix, vars).ViaField("image") errs = errs.Also(substitution.ValidateNoReferencesToUnknownVariables(sas.Script, prefix, vars).ViaField("script")) for i, cmd := range sas.Command { errs = errs.Also(substitution.ValidateNoReferencesToUnknownVariables(cmd, prefix, vars).ViaFieldIndex("command", i)) } for i, arg := range sas.Args { errs = errs.Also(substitution.ValidateNoReferencesToUnknownVariables(arg, prefix, vars).ViaFieldIndex("args", i)) } for _, env := range sas.Env { errs = errs.Also(substitution.ValidateNoReferencesToUnknownVariables(env.Value, prefix, vars).ViaFieldKey("env", env.Name)) } for i, vm := range sas.VolumeMounts { errs = errs.Also(substitution.ValidateNoReferencesToUnknownVariables(vm.Name, prefix, vars).ViaFieldIndex("volumeMounts", i)) } return errs }
validateStepActionVariables returns an error if the StepAction contains references to any unknown variables
validateStepActionVariables
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_validation.go
Apache-2.0
func (ct *ClusterTask) ConvertTo(ctx context.Context, sink apis.Convertible) error { if apis.IsInDelete(ctx) { return nil } return fmt.Errorf("v1beta1 is the highest known version, got: %T", sink) }
ConvertTo implements apis.Convertible
ConvertTo
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/cluster_task_conversion.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/cluster_task_conversion.go
Apache-2.0
func (ct *ClusterTask) ConvertFrom(ctx context.Context, source apis.Convertible) error { if apis.IsInDelete(ctx) { return nil } return fmt.Errorf("v1beta1 is the highest known version, got: %T", source) }
ConvertFrom implements apis.Convertible
ConvertFrom
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/cluster_task_conversion.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/cluster_task_conversion.go
Apache-2.0
func (p *Param) ConvertFrom(ctx context.Context, source v1.Param) { p.Name = source.Name newValue := ParamValue{} newValue.convertFrom(ctx, source.Value) p.Value = newValue }
ConvertFrom converts v1beta1 Param from v1 Param
ConvertFrom
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/param_conversion.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/param_conversion.go
Apache-2.0
func (s *StepAction) StepActionSpec() StepActionSpec { return s.Spec }
StepAction returns the step action's spec
StepActionSpec
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_types.go
Apache-2.0
func (s *StepAction) StepActionMetadata() metav1.ObjectMeta { return s.ObjectMeta }
StepActionMetadata returns the step action's ObjectMeta
StepActionMetadata
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_types.go
Apache-2.0
func (s *StepAction) Copy() StepActionObject { return s.DeepCopy() }
Copy returns a deep copy of the stepaction
Copy
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_types.go
Apache-2.0
func (*StepAction) GetGroupVersionKind() schema.GroupVersionKind { return SchemeGroupVersion.WithKind("StepAction") }
GetGroupVersionKind implements kmeta.OwnerRefable.
GetGroupVersionKind
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_types.go
Apache-2.0
func (s *StepAction) Checksum() ([]byte, error) { objectMeta := checksum.PrepareObjectMeta(s) preprocessedStepaction := StepAction{ TypeMeta: metav1.TypeMeta{ APIVersion: "tekton.dev/v1beta1", Kind: "StepAction", }, ObjectMeta: objectMeta, Spec: s.Spec, } sha256Checksum, err := checksum.ComputeSha256Checksum(preprocessedStepaction) if err != nil { return nil, err } return sha256Checksum, nil }
Checksum computes the sha256 checksum of the stepaction 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 taskSpec are included for the checksum computation.
Checksum
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_types.go
Apache-2.0
func (ss *StepActionSpec) ToStep() *v1.Step { return &v1.Step{ Image: ss.Image, Command: ss.Command, Args: ss.Args, WorkingDir: ss.WorkingDir, Script: ss.Script, Env: ss.Env, VolumeMounts: ss.VolumeMounts, SecurityContext: ss.SecurityContext, Results: ss.Results, } }
ToStep converts the StepActionSpec to a Step struct
ToStep
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_types.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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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: err.Error(), }) 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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/taskrun_types.go
Apache-2.0
func (tr *TaskRun) IsTaskRunResultVerified() bool { return tr.Status.GetCondition(apis.ConditionType(TaskRunConditionResultsVerified.String())).IsTrue() }
IsTaskRunResultVerified returns true if the TaskRun's results have been validated by spire.
IsTaskRunResultVerified
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/taskrun_types.go
Apache-2.0
func (tr *TaskRun) IsTaskRunResultDone() bool { return !tr.Status.GetCondition(apis.ConditionType(TaskRunConditionResultsVerified.String())).IsUnknown() }
IsTaskRunResultDone returns true if the TaskRun's results are available for verification
IsTaskRunResultDone
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/taskrun_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/taskrun_types.go
Apache-2.0
func (t *ClusterTask) TaskSpec() TaskSpec { return t.Spec }
TaskSpec returns the ClusterTask's Spec
TaskSpec
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/cluster_task_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/cluster_task_types.go
Apache-2.0
func (t *ClusterTask) TaskMetadata() metav1.ObjectMeta { return t.ObjectMeta }
TaskMetadata returns the ObjectMeta for the ClusterTask
TaskMetadata
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/cluster_task_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/cluster_task_types.go
Apache-2.0
func (t *ClusterTask) Copy() TaskObject { return t.DeepCopy() }
Copy returns a DeepCopy of the ClusterTask
Copy
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/cluster_task_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/cluster_task_types.go
Apache-2.0
func (*ClusterTask) GetGroupVersionKind() schema.GroupVersionKind { return SchemeGroupVersion.WithKind(pipeline.ClusterTaskControllerName) }
GetGroupVersionKind implements kmeta.OwnerRefable.
GetGroupVersionKind
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/cluster_task_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/cluster_task_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, Ports: s.DeprecatedPorts, EnvFrom: s.EnvFrom, Env: s.Env, Resources: s.Resources, VolumeMounts: s.VolumeMounts, VolumeDevices: s.VolumeDevices, LivenessProbe: s.DeprecatedLivenessProbe, ReadinessProbe: s.DeprecatedReadinessProbe, StartupProbe: s.DeprecatedStartupProbe, Lifecycle: s.DeprecatedLifecycle, TerminationMessagePath: s.DeprecatedTerminationMessagePath, TerminationMessagePolicy: s.DeprecatedTerminationMessagePolicy, ImagePullPolicy: s.ImagePullPolicy, SecurityContext: s.SecurityContext, Stdin: s.DeprecatedStdin, StdinOnce: s.DeprecatedStdinOnce, TTY: s.DeprecatedTTY, } }
ToK8sContainer converts the Step to a Kubernetes Container struct
ToK8sContainer
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/container_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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.DeprecatedPorts = c.Ports s.EnvFrom = c.EnvFrom s.Env = c.Env s.Resources = c.Resources s.VolumeMounts = c.VolumeMounts s.VolumeDevices = c.VolumeDevices s.DeprecatedLivenessProbe = c.LivenessProbe s.DeprecatedReadinessProbe = c.ReadinessProbe s.DeprecatedStartupProbe = c.StartupProbe s.DeprecatedLifecycle = c.Lifecycle s.DeprecatedTerminationMessagePath = c.TerminationMessagePath s.DeprecatedTerminationMessagePolicy = c.TerminationMessagePolicy s.ImagePullPolicy = c.ImagePullPolicy s.SecurityContext = c.SecurityContext s.DeprecatedStdin = c.Stdin s.DeprecatedStdinOnce = c.StdinOnce s.DeprecatedTTY = c.TTY }
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/v1beta1/container_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/container_types.go
Apache-2.0
func (s *StepTemplate) SetContainerFields(c corev1.Container) { s.DeprecatedName = c.Name s.Image = c.Image s.Command = c.Command s.Args = c.Args s.WorkingDir = c.WorkingDir s.DeprecatedPorts = c.Ports s.EnvFrom = c.EnvFrom s.Env = c.Env s.Resources = c.Resources s.VolumeMounts = c.VolumeMounts s.VolumeDevices = c.VolumeDevices s.DeprecatedLivenessProbe = c.LivenessProbe s.DeprecatedReadinessProbe = c.ReadinessProbe s.DeprecatedStartupProbe = c.StartupProbe s.DeprecatedLifecycle = c.Lifecycle s.DeprecatedTerminationMessagePath = c.TerminationMessagePath s.DeprecatedTerminationMessagePolicy = c.TerminationMessagePolicy s.ImagePullPolicy = c.ImagePullPolicy s.SecurityContext = c.SecurityContext s.DeprecatedStdin = c.Stdin s.DeprecatedStdinOnce = c.StdinOnce s.DeprecatedTTY = c.TTY }
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/v1beta1/container_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/container_types.go
Apache-2.0
func (s *StepTemplate) ToK8sContainer() *corev1.Container { return &corev1.Container{ Name: s.DeprecatedName, Image: s.Image, Command: s.Command, Args: s.Args, WorkingDir: s.WorkingDir, Ports: s.DeprecatedPorts, EnvFrom: s.EnvFrom, Env: s.Env, Resources: s.Resources, VolumeMounts: s.VolumeMounts, VolumeDevices: s.VolumeDevices, LivenessProbe: s.DeprecatedLivenessProbe, ReadinessProbe: s.DeprecatedReadinessProbe, StartupProbe: s.DeprecatedStartupProbe, Lifecycle: s.DeprecatedLifecycle, TerminationMessagePath: s.DeprecatedTerminationMessagePath, TerminationMessagePolicy: s.DeprecatedTerminationMessagePolicy, ImagePullPolicy: s.ImagePullPolicy, SecurityContext: s.SecurityContext, Stdin: s.DeprecatedStdin, StdinOnce: s.DeprecatedStdinOnce, TTY: s.DeprecatedTTY, } }
ToK8sContainer converts the StepTemplate to a Kubernetes Container struct
ToK8sContainer
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/container_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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.Resources, 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.Resources, 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/v1beta1/container_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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.Resources = 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/v1beta1/container_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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 { return apis.ErrMissingField("projected.sources") } // For a CSI to work, you must provide and have installed the driver to use. if b.CSI != nil && 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/v1beta1/workspace_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/workspace_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/workspace_validation.go
Apache-2.0
func (t *ClusterTask) SetDefaults(ctx context.Context) { t.Spec.SetDefaults(ctx) }
SetDefaults sets the default values for the ClusterTask's Spec.
SetDefaults
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/cluster_task_defaults.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/cluster_task_defaults.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/v1beta1/register.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/register.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/register.go
Apache-2.0
func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &Task{}, &TaskList{}, &Pipeline{}, &PipelineList{}, &ClusterTask{}, &ClusterTaskList{}, &TaskRun{}, &TaskRunList{}, &PipelineRun{}, &PipelineRunList{}, &CustomRun{}, &CustomRunList{}, &StepAction{}, &StepActionList{}, ) // &Condition{}, // &ConditionList{}, 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/v1beta1/register.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/task_defaults.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/task_defaults.go
Apache-2.0
func (ts *TaskSpec) SetDefaults(ctx context.Context) { 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/v1beta1/task_defaults.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/container_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/container_validation.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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, // parseExpression 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/v1beta1/resultref.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/resultref.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resultref.go
Apache-2.0
func GetVarSubstitutionExpressionsForParam(param Param) ([]string, bool) { var allExpressions []string switch param.Value.Type { case ParamTypeArray: // array type for _, value := range param.Value.ArrayVal { allExpressions = append(allExpressions, validateString(value)...) } case ParamTypeString: // string type allExpressions = append(allExpressions, validateString(param.Value.StringVal)...) case ParamTypeObject: // object type for _, value := range param.Value.ObjectVal { allExpressions = append(allExpressions, validateString(value)...) } default: return nil, false } return allExpressions, len(allExpressions) != 0 }
GetVarSubstitutionExpressionsForParam extracts all the value between "$(" and ")"" for a parameter
GetVarSubstitutionExpressionsForParam
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resultref.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resultref.go
Apache-2.0
func GetVarSubstitutionExpressionsForPipelineResult(result PipelineResult) ([]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 }
GetVarSubstitutionExpressionsForPipelineResult extracts all the value between "$(" and ")"" for a pipeline result
GetVarSubstitutionExpressionsForPipelineResult
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resultref.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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, "*"
ParseResultName
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resultref.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resultref.go
Apache-2.0
func PipelineTaskResultRefs(pt *PipelineTask) []*ResultRef { refs := []*ResultRef{} for _, p := range pt.extractAllParams() { expressions, _ := GetVarSubstitutionExpressionsForParam(p) refs = append(refs, NewResultRefs(expressions)...) } for _, whenExpression := range pt.WhenExpressions { expressions, _ := whenExpression.GetVarSubstitutionExpressions() refs = append(refs, NewResultRefs(expressions)...) } 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/v1beta1/resultref.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resultref.go
Apache-2.0
func (s *StepAction) ConvertTo(ctx context.Context, to apis.Convertible) error { return nil }
ConvertTo implements apis.Convertible
ConvertTo
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_conversion.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_conversion.go
Apache-2.0
func (ss *StepActionSpec) ConvertTo(ctx context.Context, sink *StepActionSpec) error { return nil }
ConvertTo implements apis.Convertible
ConvertTo
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_conversion.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_conversion.go
Apache-2.0
func (s *StepAction) ConvertFrom(ctx context.Context, from apis.Convertible) error { return nil }
ConvertFrom implements apis.Convertible
ConvertFrom
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_conversion.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_conversion.go
Apache-2.0
func (ss *StepActionSpec) ConvertFrom(ctx context.Context, source *StepActionSpec) error { return nil }
ConvertFrom implements apis.Convertible
ConvertFrom
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_conversion.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/stepaction_conversion.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/v1beta1/pipeline_defaults.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/pipeline_defaults.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/pipeline_defaults.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/pipeline_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/pipeline_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipeline_types.go
Apache-2.0
func (p *Pipeline) Copy() PipelineObject { return p.DeepCopy() }
Copy returns a deep copy of the Pipeline, implementing PipelineObject
Copy
go
tektoncd/cli
vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipeline_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/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/v1beta1/pipeline_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipeline_types.go
Apache-2.0
func (p *Pipeline) Checksum() ([]byte, error) { objectMeta := checksum.PrepareObjectMeta(p) preprocessedPipeline := Pipeline{ TypeMeta: metav1.TypeMeta{ APIVersion: "tekton.dev/v1beta1", 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 task 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/v1beta1/pipeline_types.go
https://github.com/tektoncd/cli/blob/master/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipeline_types.go
Apache-2.0