From 4d43d6876cd3d029d3e31e6fb8b4aa81037d65e3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Sep 2023 11:39:19 +0000 Subject: [PATCH] Bump github.com/tektoncd/pipeline from 0.51.0 to 0.52.0 Bumps [github.com/tektoncd/pipeline](https://github.com/tektoncd/pipeline) from 0.51.0 to 0.52.0. - [Release notes](https://github.com/tektoncd/pipeline/releases) - [Changelog](https://github.com/tektoncd/pipeline/blob/main/releases.md) - [Commits](https://github.com/tektoncd/pipeline/compare/v0.51.0...v0.52.0) --- updated-dependencies: - dependency-name: github.com/tektoncd/pipeline dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 12 ++- .../pipeline/pkg/apis/config/store.go | 9 ++ .../pipeline/pkg/apis/config/tracing.go | 94 +++++++++++++++++++ .../pkg/apis/config/zz_generated.deepcopy.go | 16 ++++ .../pipeline/pkg/apis/pipeline/constant.go | 2 +- .../pkg/apis/pipeline/v1/openapi_generated.go | 14 ++- .../pkg/apis/pipeline/v1/param_types.go | 23 +++++ .../pkg/apis/pipeline/v1/pipeline_types.go | 22 +++++ .../apis/pipeline/v1/pipeline_validation.go | 67 ++++++++++--- .../pkg/apis/pipeline/v1/pipelinerun_types.go | 56 +++++++++++ .../pipeline/v1/pipelinerun_validation.go | 7 +- .../pkg/apis/pipeline/v1/resultref.go | 37 +------- .../pkg/apis/pipeline/v1/swagger.json | 8 ++ .../apis/pipeline/v1/taskrun_validation.go | 5 + .../apis/pipeline/v1/zz_generated.deepcopy.go | 10 ++ .../pipeline/v1beta1/openapi_generated.go | 14 ++- .../apis/pipeline/v1beta1/pipeline_types.go | 10 ++ .../pipeline/v1beta1/pipeline_validation.go | 49 ++++++++-- .../pkg/apis/pipeline/v1beta1/swagger.json | 8 ++ .../pipeline/v1beta1/zz_generated.deepcopy.go | 10 ++ .../cloudevent/cloud_event_controller.go | 2 +- .../events/cloudevent/cloudevent.go | 6 +- .../tektoncd/pipeline/test/controller.go | 11 ++- .../pipeline/test/trustedresources.go | 21 ----- vendor/modules.txt | 2 +- 26 files changed, 420 insertions(+), 97 deletions(-) create mode 100644 vendor/github.com/tektoncd/pipeline/pkg/apis/config/tracing.go diff --git a/go.mod b/go.mod index 6b0653216..e3e37fb39 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/tektoncd/chains v0.18.0 github.com/tektoncd/hub v1.14.0 - github.com/tektoncd/pipeline v0.51.0 + github.com/tektoncd/pipeline v0.52.0 github.com/tektoncd/plumbing v0.0.0-20230907180608-5625252a2de1 github.com/tektoncd/triggers v0.25.0 github.com/theupdateframework/go-tuf v0.6.1 diff --git a/go.sum b/go.sum index 814bbdec8..18b283f3d 100644 --- a/go.sum +++ b/go.sum @@ -177,6 +177,7 @@ github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2 github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00= github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600= github.com/Microsoft/hcsshim v0.8.23/go.mod h1:4zegtUJth7lAvFyc6cH2gGQ5B3OFQim01nnU2M8jKDg= +github.com/Microsoft/hcsshim v0.11.0 h1:7EFNIY4igHEXUdj1zXgAyU3fLc7QfOKHbkldRVTBdiM= github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU= github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= @@ -478,7 +479,7 @@ github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09Zvgq github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s= github.com/containerd/containerd v1.5.8/go.mod h1:YdFSv5bTFLpG2HIYmfqDpSYYTDX+mc5qtSuYx1YUb/s= github.com/containerd/containerd v1.5.9/go.mod h1:fvQqCfadDGga5HZyn3j4+dx56qj2I9YwBrlSdalvJYQ= -github.com/containerd/containerd v1.7.3 h1:cKwYKkP1eTj54bP3wCdXXBymmKRQMrWjkLSWZZJDa8o= +github.com/containerd/containerd v1.7.6 h1:oNAVsnhPoy4BTPQivLgTzI9Oleml9l/+eYIDYXRCYo8= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= @@ -1209,7 +1210,7 @@ github.com/jedisct1/go-minisign v0.0.0-20211028175153-1c139d1cc84b h1:ZGiXF8sz7P github.com/jedisct1/go-minisign v0.0.0-20211028175153-1c139d1cc84b/go.mod h1:hQmNrgofl+IY/8L+n20H6E6PWBBTokdsv+q49j0QhsU= github.com/jellydator/ttlcache/v3 v3.1.0 h1:0gPFG0IHHP6xyUyXq+JaD8fwkDCqgqwohXNJBcYE71g= github.com/jellydator/ttlcache/v3 v3.1.0/go.mod h1:hi7MGFdMAwZna5n2tuvh63DvFLzVKySzCVW6+0gA2n4= -github.com/jenkins-x/go-scm v1.13.13 h1:QEUDWwaLMMGuf8b82SUR8AZpXETEu9U5J7eC4fU7HSM= +github.com/jenkins-x/go-scm v1.14.14 h1:a4c3z4+FVPMWMl59hgdLZNbnbc0Z0/Ln6fHXS0hLAyY= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jgautheron/goconst v1.5.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= github.com/jhump/protoreflect v1.6.1/go.mod h1:RZQ/lnuN+zqeRVpQigTwO6o0AJUkxbnSnpuG7toUTG4= @@ -1781,7 +1782,7 @@ github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= github.com/spiffe/go-spiffe/v2 v2.1.6 h1:4SdizuQieFyL9eNU+SPiCArH4kynzaKOOj0VvM8R7Xo= github.com/spiffe/go-spiffe/v2 v2.1.6/go.mod h1:eVDqm9xFvyqao6C+eQensb9ZPkyNEeaUbqbBpOhBnNk= -github.com/spiffe/spire-api-sdk v1.7.1 h1:i/X23zWJtk8G6gy1QYXkWBldruAzRdzxH6icgjMJjUs= +github.com/spiffe/spire-api-sdk v1.7.2 h1:F4rdMnEVBHZYxttXAEER5Rhs2Mm9ugn4S5j1tWpDHnQ= github.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518/go.mod h1:CKI4AZ4XmGV240rTHfO0hfE83S6/a3/Q1siZJ/vXf7A= github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= @@ -1827,8 +1828,8 @@ github.com/tektoncd/chains v0.18.0 h1:ObN5b4W8YFSpl2P4MBvxkDtp/atJlfVjBdqBWG4hjW github.com/tektoncd/chains v0.18.0/go.mod h1:9JYn5Ak+1V+unvDDIgIPyswa7Zxm7QyEoeuKxzVZ7YI= github.com/tektoncd/hub v1.14.0 h1:H41drEhEsGTCxpZCskLjkTw2xSQTZZvNitcjCLj2Tjk= github.com/tektoncd/hub v1.14.0/go.mod h1:/usZ9mFUEIzgT4VOoQ7jxT6EOfwLkL+NI2gwPXVAU4w= -github.com/tektoncd/pipeline v0.51.0 h1:n2i/AJPXkTwcv9uc9xRJCtMeAHF1c1NkF7cNQ5zEf+0= -github.com/tektoncd/pipeline v0.51.0/go.mod h1:P9xePA0fqYIhaw4fllmX2LtMneyWqj60EjsZp5qqq9U= +github.com/tektoncd/pipeline v0.52.0 h1:R5SLf4wQYc2eCVQh1UyCNbPTDdIUQz5MisyBRngQ068= +github.com/tektoncd/pipeline v0.52.0/go.mod h1:27wryvb8VIPIZ2u5evUphOPgM8Z7hGgzp00E8/3DCls= github.com/tektoncd/plumbing v0.0.0-20230907180608-5625252a2de1 h1:9paprRIBXQgcvdhGq3wKiSspXP0JIFSY52ru3sIMjKM= github.com/tektoncd/plumbing v0.0.0-20230907180608-5625252a2de1/go.mod h1:7eWs1XNkmReggow7ggRbRyRuHi7646B8b2XipCZ3VOw= github.com/tektoncd/triggers v0.25.0 h1:HaHZ0w8RpeIvB/7DoIZz+KhIOAVzPiFIPZOrDtvEPbM= @@ -1996,6 +1997,7 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0/go.mod h1: go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo= go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4= +go.opentelemetry.io/otel/exporters/jaeger v1.16.0 h1:YhxxmXZ011C0aDZKoNw+juVWAmEfv/0W2XBOv9aHTaA= go.opentelemetry.io/otel/exporters/otlp v0.20.0/go.mod h1:YIieizyaN77rtLJra0buKiNBOm9XQfkPEKBeuhoMwAM= go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU= go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo= diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/config/store.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/config/store.go index 763071969..a46de4114 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/config/store.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/config/store.go @@ -33,6 +33,7 @@ type Config struct { Metrics *Metrics SpireConfig *sc.SpireConfig Events *Events + Tracing *Tracing } // FromContext extracts a Config from the provided context. @@ -57,6 +58,7 @@ func FromContextOrDefaults(ctx context.Context) *Config { Metrics: DefaultMetrics.DeepCopy(), SpireConfig: DefaultSpire.DeepCopy(), Events: DefaultEvents.DeepCopy(), + Tracing: DefaultTracing.DeepCopy(), } } @@ -84,6 +86,7 @@ func NewStore(logger configmap.Logger, onAfterStore ...func(name string, value i GetMetricsConfigName(): NewMetricsFromConfigMap, GetSpireConfigName(): NewSpireConfigFromConfigMap, GetEventsConfigName(): NewEventsFromConfigMap, + GetTracingConfigName(): NewTracingFromConfigMap, }, onAfterStore..., ), @@ -111,6 +114,11 @@ func (s *Store) Load() *Config { if metrics == nil { metrics = DefaultMetrics.DeepCopy() } + tracing := s.UntypedLoad(GetTracingConfigName()) + if tracing == nil { + tracing = DefaultTracing.DeepCopy() + } + spireconfig := s.UntypedLoad(GetSpireConfigName()) if spireconfig == nil { spireconfig = DefaultSpire.DeepCopy() @@ -124,6 +132,7 @@ func (s *Store) Load() *Config { Defaults: defaults.(*Defaults).DeepCopy(), FeatureFlags: featureFlags.(*FeatureFlags).DeepCopy(), Metrics: metrics.(*Metrics).DeepCopy(), + Tracing: tracing.(*Tracing).DeepCopy(), SpireConfig: spireconfig.(*sc.SpireConfig).DeepCopy(), Events: events.(*Events).DeepCopy(), } diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/config/tracing.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/config/tracing.go new file mode 100644 index 000000000..d8685b758 --- /dev/null +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/config/tracing.go @@ -0,0 +1,94 @@ +/* +Copyright 2023 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package config + +import ( + "fmt" + "os" + "strconv" + + corev1 "k8s.io/api/core/v1" +) + +const ( + // tracingEnabledKey is the configmap key which determines if tracing is enabled + tracingEnabledKey = "enabled" + // tracingEndpintKey is the configmap key for tracing api endpoint + tracingEndpointKey = "endpoint" + + // DefaultEndpoint is the default destination for sending traces + DefaultEndpoint = "http://jaeger-collector.jaeger.svc.cluster.local:14268/api/traces" +) + +// DefaultTracing holds all the default configurations for tracing +var DefaultTracing, _ = newTracingFromMap(map[string]string{}) + +// Tracing holds the configurations for tracing +// +k8s:deepcopy-gen=true +type Tracing struct { + Enabled bool + Endpoint string +} + +// Equals returns true if two Configs are identical +func (cfg *Tracing) Equals(other *Tracing) bool { + if cfg == nil && other == nil { + return true + } + + if cfg == nil || other == nil { + return false + } + + return other.Enabled == cfg.Enabled && + other.Endpoint == cfg.Endpoint +} + +// GetTracingConfigName returns the name of the configmap containing all +// customizations for tracing +func GetTracingConfigName() string { + if e := os.Getenv("CONFIG_TRACING_NAME"); e != "" { + return e + } + return "config-tracing" +} + +// newTracingFromMap returns a Config given a map from ConfigMap +func newTracingFromMap(config map[string]string) (*Tracing, error) { + t := Tracing{ + Enabled: false, + Endpoint: DefaultEndpoint, + } + + if endpoint, ok := config[tracingEndpointKey]; ok { + t.Endpoint = endpoint + } + + if enabled, ok := config[tracingEnabledKey]; ok { + e, err := strconv.ParseBool(enabled) + if err != nil { + return nil, fmt.Errorf("failed parsing tracing config %q: %w", enabled, err) + } + t.Enabled = e + } + return &t, nil +} + +// NewTracingFromConfigMap returns a Config given a ConfigMap +func NewTracingFromConfigMap(config *corev1.ConfigMap) (*Tracing, error) { + return newTracingFromMap(config.Data) +} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/config/zz_generated.deepcopy.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/config/zz_generated.deepcopy.go index 0d0bff08f..c688b9ee9 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/config/zz_generated.deepcopy.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/config/zz_generated.deepcopy.go @@ -110,3 +110,19 @@ func (in *Metrics) DeepCopy() *Metrics { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Tracing) DeepCopyInto(out *Tracing) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Tracing. +func (in *Tracing) DeepCopy() *Tracing { + if in == nil { + return nil + } + out := new(Tracing) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/constant.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/constant.go index 5fceccbf5..19604205b 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/constant.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/constant.go @@ -18,5 +18,5 @@ package pipeline const ( // TektonReservedAnnotationExpr is the expression we use to filter out reserved key in annotation - TektonReservedAnnotationExpr = "(results.tekton.dev|chains.tekton.dev)/.*" + TektonReservedAnnotationExpr = "(chains.tekton.dev)/.*" ) diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/openapi_generated.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/openapi_generated.go index abb49a962..c3011075a 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/openapi_generated.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/openapi_generated.go @@ -1879,11 +1879,23 @@ func schema_pkg_apis_pipeline_v1_PipelineTask(ref common.ReferenceCallback) comm Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), }, }, + "pipelineRef": { + SchemaProps: spec.SchemaProps{ + Description: "PipelineRef is a reference to a pipeline definition Note: PipelineRef is in preview mode and not yet supported", + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.PipelineRef"), + }, + }, + "pipelineSpec": { + SchemaProps: spec.SchemaProps{ + Description: "PipelineSpec is a specification of a pipeline Note: PipelineSpec is in preview mode and not yet supported", + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.PipelineSpec"), + }, + }, }, }, }, Dependencies: []string{ - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.EmbeddedTask", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.Matrix", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.Param", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.TaskRef", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.WhenExpression", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.WorkspacePipelineTaskBinding", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.EmbeddedTask", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.Matrix", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.Param", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.PipelineRef", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.PipelineSpec", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.TaskRef", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.WhenExpression", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.WorkspacePipelineTaskBinding", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, } } diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go index b47e45f72..86fe6ce3e 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/param_types.go @@ -154,6 +154,29 @@ type Param struct { Value ParamValue `json:"value"` } +// GetVarSubstitutionExpressions extracts all the value between "$(" and ")"" for a Parameter +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 +} + // ExtractNames returns a set of unique names func (ps Params) ExtractNames() sets.String { names := sets.String{} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go index 19f97cbf2..25613f1a4 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_types.go @@ -228,6 +228,16 @@ type PipelineTask struct { // Refer Go's ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration // +optional Timeout *metav1.Duration `json:"timeout,omitempty"` + + // PipelineRef is a reference to a pipeline definition + // Note: PipelineRef is in preview mode and not yet supported + // +optional + PipelineRef *PipelineRef `json:"pipelineRef,omitempty"` + + // PipelineSpec is a specification of a pipeline + // Note: PipelineSpec is in preview mode and not yet supported + // +optional + PipelineSpec *PipelineSpec `json:"pipelineSpec,omitempty"` } // IsCustomTask checks whether an embedded TaskSpec is a Custom Task @@ -320,3 +330,15 @@ type PipelineList struct { metav1.ListMeta `json:"metadata,omitempty"` Items []Pipeline `json:"items"` } + +// GetVarSubstitutionExpressions extracts all the value between "$(" and ")"" for a PipelineResult +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 +} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_validation.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_validation.go index e1a7464c3..71b002d9b 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_validation.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipeline_validation.go @@ -37,6 +37,13 @@ import ( var _ apis.Validatable = (*Pipeline)(nil) var _ resourcesemantics.VerbLimited = (*Pipeline)(nil) +const ( + taskRef = "taskRef" + taskSpec = "taskSpec" + pipelineRef = "pipelineRef" + pipelineSpec = "pipelineSpec" +) + // SupportedVerbs returns the operations that validation should be called for func (p *Pipeline) SupportedVerbs() []admissionregistrationv1.OperationType { return []admissionregistrationv1.OperationType{admissionregistrationv1.Create, admissionregistrationv1.Update} @@ -195,7 +202,7 @@ func (pt PipelineTask) ValidateName() *apis.FieldError { // Validate classifies whether a task is a custom task or a regular task(dag/final) // calls the validation routine based on the type of the task func (pt PipelineTask) Validate(ctx context.Context) (errs *apis.FieldError) { - errs = errs.Also(pt.validateRefOrSpec()) + errs = errs.Also(pt.validateRefOrSpec(ctx)) errs = errs.Also(pt.validateEmbeddedOrType()) // taskKinds contains the kinds when the apiVersion is not set, they are not custom tasks, @@ -289,15 +296,39 @@ func (pt *PipelineTask) validateWorkspaces(workspaceNames sets.String) (errs *ap return errs } -// validateRefOrSpec validates at least one of taskRef or taskSpec is specified -func (pt PipelineTask) validateRefOrSpec() (errs *apis.FieldError) { - // can't have both taskRef and taskSpec at the same time - if pt.TaskRef != nil && pt.TaskSpec != nil { - errs = errs.Also(apis.ErrMultipleOneOf("taskRef", "taskSpec")) +// validateRefOrSpec validates at least one of taskRef or taskSpec or pipelineRef or pipelineSpec is specified +func (pt PipelineTask) validateRefOrSpec(ctx context.Context) (errs *apis.FieldError) { + // collect all the specified specifications + nonNilFields := []string{} + if pt.TaskRef != nil { + nonNilFields = append(nonNilFields, taskRef) + } + if pt.TaskSpec != nil { + nonNilFields = append(nonNilFields, taskSpec) + } + if pt.PipelineRef != nil { + errs = errs.Also(version.ValidateEnabledAPIFields(ctx, pipelineRef, config.AlphaAPIFields)) + nonNilFields = append(nonNilFields, pipelineRef) } - // Check that one of TaskRef and TaskSpec is present - if pt.TaskRef == nil && pt.TaskSpec == nil { - errs = errs.Also(apis.ErrMissingOneOf("taskRef", "taskSpec")) + if pt.PipelineSpec != nil { + errs = errs.Also(version.ValidateEnabledAPIFields(ctx, pipelineSpec, config.AlphaAPIFields)) + nonNilFields = append(nonNilFields, pipelineSpec) + } + + // check the length of nonNilFields + // if one of taskRef or taskSpec or pipelineRef or pipelineSpec is specified, + // the length of nonNilFields should exactly be 1 + if len(nonNilFields) > 1 { + errs = errs.Also(apis.ErrGeneric("expected exactly one, got multiple", nonNilFields...)) + } else if len(nonNilFields) == 0 { + cfg := config.FromContextOrDefaults(ctx) + // check for TaskRef or TaskSpec or PipelineRef or PipelineSpec with alpha feature flag + if cfg.FeatureFlags.EnableAPIFields == config.AlphaAPIFields { + errs = errs.Also(apis.ErrMissingOneOf(taskRef, taskSpec, pipelineRef, pipelineSpec)) + } else { + // check for taskRef and taskSpec with beta/stable feature flag + errs = errs.Also(apis.ErrMissingOneOf(taskRef, taskSpec)) + } } return errs } @@ -323,10 +354,16 @@ func (pt PipelineTask) validateCustomTask() (errs *apis.FieldError) { func (pt PipelineTask) validateTask(ctx context.Context) (errs *apis.FieldError) { // Validate TaskSpec if it's present if pt.TaskSpec != nil { - errs = errs.Also(pt.TaskSpec.Validate(ctx).ViaField("taskSpec")) + errs = errs.Also(pt.TaskSpec.Validate(ctx).ViaField(taskSpec)) } if pt.TaskRef != nil { - errs = errs.Also(pt.TaskRef.Validate(ctx).ViaField("taskRef")) + errs = errs.Also(pt.TaskRef.Validate(ctx).ViaField(taskRef)) + } + if pt.PipelineRef != nil { + errs = errs.Also(pt.PipelineRef.Validate(ctx).ViaField(pipelineRef)) + } + if pt.PipelineSpec != nil { + errs = errs.Also(pt.PipelineSpec.Validate(ctx).ViaField(pipelineSpec)) } return errs } @@ -493,7 +530,7 @@ func validateExecutionStatusVariablesInFinally(tasksNames sets.String, finally [ func (pt *PipelineTask) validateExecutionStatusVariablesDisallowed() (errs *apis.FieldError) { for _, param := range pt.Params { - if expressions, ok := GetVarSubstitutionExpressionsForParam(param); ok { + if expressions, ok := param.GetVarSubstitutionExpressions(); ok { errs = errs.Also(validateContainsExecutionStatusVariablesDisallowed(expressions, "value"). ViaFieldKey("params", param.Name)) } @@ -509,7 +546,7 @@ func (pt *PipelineTask) validateExecutionStatusVariablesDisallowed() (errs *apis func (pt *PipelineTask) validateExecutionStatusVariablesAllowed(ptNames sets.String) (errs *apis.FieldError) { for _, param := range pt.Params { - if expressions, ok := GetVarSubstitutionExpressionsForParam(param); ok { + if expressions, ok := param.GetVarSubstitutionExpressions(); ok { errs = errs.Also(validateExecutionStatusVariablesExpressions(expressions, ptNames, "value"). ViaFieldKey("params", param.Name)) } @@ -588,7 +625,7 @@ func validatePipelineResults(results []PipelineResult, tasks []PipelineTask, fin pipelineTaskNames := getPipelineTasksNames(tasks) pipelineFinallyTaskNames := getPipelineTasksNames(finally) for idx, result := range results { - expressions, ok := GetVarSubstitutionExpressionsForPipelineResult(result) + expressions, ok := result.GetVarSubstitutionExpressions() if !ok { errs = errs.Also(apis.ErrInvalidValue("expected pipeline results to be task result expressions but no expressions were found", "value").ViaFieldIndex("results", idx)) @@ -676,7 +713,7 @@ func validateFinalTasks(tasks []PipelineTask, finalTasks []PipelineTask) (errs * func validateTaskResultReferenceInFinallyTasks(finalTasks []PipelineTask, ts sets.String, fts sets.String) (errs *apis.FieldError) { for idx, t := range finalTasks { for _, p := range t.Params { - if expressions, ok := GetVarSubstitutionExpressionsForParam(p); ok { + if expressions, ok := p.GetVarSubstitutionExpressions(); ok { errs = errs.Also(validateResultsVariablesExpressionsInFinally(expressions, ts, fts, "value").ViaFieldKey( "params", p.Name).ViaFieldIndex("finally", idx)) } diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipelinerun_types.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipelinerun_types.go index 88120472e..fda0168c0 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipelinerun_types.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipelinerun_types.go @@ -351,6 +351,62 @@ const ( // PipelineRunReasonStoppedRunningFinally indicates that pipeline has been gracefully stopped // and no new Tasks will be scheduled by the controller, but final tasks are now running PipelineRunReasonStoppedRunningFinally PipelineRunReason = "StoppedRunningFinally" + // ReasonCouldntGetPipeline indicates that the reason for the failure status is that the + // associated Pipeline couldn't be retrieved + PipelineRunReasonCouldntGetPipeline PipelineRunReason = "CouldntGetPipeline" + // ReasonInvalidBindings indicates that the reason for the failure status is that the + // PipelineResources bound in the PipelineRun didn't match those declared in the Pipeline + PipelineRunReasonInvalidBindings PipelineRunReason = "InvalidPipelineResourceBindings" + // ReasonInvalidWorkspaceBinding indicates that a Pipeline expects a workspace but a + // PipelineRun has provided an invalid binding. + PipelineRunReasonInvalidWorkspaceBinding PipelineRunReason = "InvalidWorkspaceBindings" + // ReasonInvalidTaskRunSpec indicates that PipelineRun.Spec.TaskRunSpecs[].PipelineTaskName is defined with + // a not exist taskName in pipelineSpec. + PipelineRunReasonInvalidTaskRunSpec PipelineRunReason = "InvalidTaskRunSpecs" + // ReasonParameterTypeMismatch indicates that the reason for the failure status is that + // parameter(s) declared in the PipelineRun do not have the some declared type as the + // parameters(s) declared in the Pipeline that they are supposed to override. + PipelineRunReasonParameterTypeMismatch PipelineRunReason = "ParameterTypeMismatch" + // ReasonObjectParameterMissKeys indicates that the object param value provided from PipelineRun spec + // misses some keys required for the object param declared in Pipeline spec. + PipelineRunReasonObjectParameterMissKeys PipelineRunReason = "ObjectParameterMissKeys" + // ReasonParamArrayIndexingInvalid indicates that the use of param array indexing is not under correct api fields feature gate + // or the array is out of bound. + PipelineRunReasonParamArrayIndexingInvalid PipelineRunReason = "ParamArrayIndexingInvalid" + // ReasonCouldntGetTask indicates that the reason for the failure status is that the + // associated Pipeline's Tasks couldn't all be retrieved + PipelineRunReasonCouldntGetTask PipelineRunReason = "CouldntGetTask" + // ReasonParameterMissing indicates that the reason for the failure status is that the + // associated PipelineRun didn't provide all the required parameters + PipelineRunReasonParameterMissing PipelineRunReason = "ParameterMissing" + // ReasonFailedValidation indicates that the reason for failure status is + // that pipelinerun failed runtime validation + PipelineRunReasonFailedValidation PipelineRunReason = "PipelineValidationFailed" + // ReasonInvalidGraph indicates that the reason for the failure status is that the + // associated Pipeline is an invalid graph (a.k.a wrong order, cycle, …) + PipelineRunReasonInvalidGraph PipelineRunReason = "PipelineInvalidGraph" + // ReasonCouldntCancel indicates that a PipelineRun was cancelled but attempting to update + // all of the running TaskRuns as cancelled failed. + PipelineRunReasonCouldntCancel PipelineRunReason = "PipelineRunCouldntCancel" + // ReasonCouldntTimeOut indicates that a PipelineRun was timed out but attempting to update + // all of the running TaskRuns as timed out failed. + PipelineRunReasonCouldntTimeOut PipelineRunReason = "PipelineRunCouldntTimeOut" + // ReasonInvalidMatrixParameterTypes indicates a matrix contains invalid parameter types + PipelineRunReasonInvalidMatrixParameterTypes PipelineRunReason = "InvalidMatrixParameterTypes" + // ReasonInvalidTaskResultReference indicates a task result was declared + // but was not initialized by that task + PipelineRunReasonInvalidTaskResultReference PipelineRunReason = "InvalidTaskResultReference" + // ReasonRequiredWorkspaceMarkedOptional indicates an optional workspace + // has been passed to a Task that is expecting a non-optional workspace + PipelineRunReasonRequiredWorkspaceMarkedOptional PipelineRunReason = "RequiredWorkspaceMarkedOptional" + // ReasonResolvingPipelineRef indicates that the PipelineRun is waiting for + // its pipelineRef to be asynchronously resolved. + PipelineRunReasonResolvingPipelineRef PipelineRunReason = "ResolvingPipelineRef" + // ReasonResourceVerificationFailed indicates that the pipeline fails the trusted resource verification, + // it could be the content has changed, signature is invalid or public key is invalid + PipelineRunReasonResourceVerificationFailed PipelineRunReason = "ResourceVerificationFailed" + // ReasonCreateRunFailed indicates that the pipeline fails to create the taskrun or other run resources + PipelineRunReasonCreateRunFailed PipelineRunReason = "CreateRunFailed" ) func (t PipelineRunReason) String() string { diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipelinerun_validation.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipelinerun_validation.go index 1f56c2050..dc95f47cc 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipelinerun_validation.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/pipelinerun_validation.go @@ -67,6 +67,11 @@ func (ps *PipelineRunSpec) Validate(ctx context.Context) (errs *apis.FieldError) // Validate PipelineSpec if it's present if ps.PipelineSpec != nil { errs = errs.Also(ps.PipelineSpec.Validate(ctx).ViaField("pipelineSpec")) + // Validate beta fields separately for inline Pipeline definitions. + // This prevents validation from failing in the reconciler when a Pipeline is converted to a different API version. + // See https://github.com/tektoncd/pipeline/issues/6616 for more information. + // TODO(#6592): Decouple API versioning from feature versioning + errs = errs.Also(ps.PipelineSpec.ValidateBetaFields(ctx).ViaField("pipelineSpec")) } // Validate PipelineRun parameters @@ -126,7 +131,7 @@ func (ps *PipelineRunSpec) validatePipelineRunParameters(ctx context.Context) (e // Validate that task results aren't used in param values for _, param := range ps.Params { - expressions, ok := GetVarSubstitutionExpressionsForParam(param) + expressions, ok := param.GetVarSubstitutionExpressions() if ok { if LooksLikeContainsResultRefs(expressions) { expressions = filter(expressions, looksLikeResultRef) diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/resultref.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/resultref.go index 5a7610e03..14b0de17f 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/resultref.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/resultref.go @@ -105,41 +105,6 @@ func looksLikeResultRef(expression string) bool { return len(subExpressions) >= 4 && (subExpressions[0] == ResultTaskPart || subExpressions[0] == ResultFinallyPart) && subExpressions[2] == ResultResultPart } -// GetVarSubstitutionExpressionsForParam extracts all the value between "$(" and ")"" for a parameter -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 -} - -// GetVarSubstitutionExpressionsForPipelineResult extracts all the value between "$(" and ")"" for a pipeline result -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 -} - func validateString(value string) []string { expressions := VariableSubstitutionRegex.FindAllString(value, -1) if expressions == nil { @@ -208,7 +173,7 @@ func ParseResultName(resultName string) (string, string) { func PipelineTaskResultRefs(pt *PipelineTask) []*ResultRef { refs := []*ResultRef{} for _, p := range pt.extractAllParams() { - expressions, _ := GetVarSubstitutionExpressionsForParam(p) + expressions, _ := p.GetVarSubstitutionExpressions() refs = append(refs, NewResultRefs(expressions)...) } for _, whenExpression := range pt.When { diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/swagger.json b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/swagger.json index 5a71f5f50..e2f82a647 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/swagger.json +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/swagger.json @@ -894,6 +894,14 @@ }, "x-kubernetes-list-type": "atomic" }, + "pipelineRef": { + "description": "PipelineRef is a reference to a pipeline definition Note: PipelineRef is in preview mode and not yet supported", + "$ref": "#/definitions/v1.PipelineRef" + }, + "pipelineSpec": { + "description": "PipelineSpec is a specification of a pipeline Note: PipelineSpec is in preview mode and not yet supported", + "$ref": "#/definitions/v1.PipelineSpec" + }, "retries": { "description": "Retries represents how many times this task should be retried in case of task failure: ConditionSucceeded set to False", "type": "integer", diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_validation.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_validation.go index 7fb04691e..c818a5760 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_validation.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_validation.go @@ -63,6 +63,11 @@ func (ts *TaskRunSpec) Validate(ctx context.Context) (errs *apis.FieldError) { // Validate TaskSpec if it's present. if ts.TaskSpec != nil { errs = errs.Also(ts.TaskSpec.Validate(ctx).ViaField("taskSpec")) + // Validate beta fields separately for inline Task definitions. + // This prevents validation from failing in the reconciler when a Task is converted to a different API version. + // See https://github.com/tektoncd/pipeline/issues/6616 for more information. + // TODO(#6592): Decouple API versioning from feature versioning + errs = errs.Also(ts.TaskSpec.ValidateBetaFields(ctx).ViaField("taskSpec")) } errs = errs.Also(ValidateParameters(ctx, ts.Params).ViaField("params")) diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/zz_generated.deepcopy.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/zz_generated.deepcopy.go index bd2f039f6..484d08a43 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/zz_generated.deepcopy.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/zz_generated.deepcopy.go @@ -777,6 +777,16 @@ func (in *PipelineTask) DeepCopyInto(out *PipelineTask) { *out = new(metav1.Duration) **out = **in } + if in.PipelineRef != nil { + in, out := &in.PipelineRef, &out.PipelineRef + *out = new(PipelineRef) + (*in).DeepCopyInto(*out) + } + if in.PipelineSpec != nil { + in, out := &in.PipelineSpec, &out.PipelineSpec + *out = new(PipelineSpec) + (*in).DeepCopyInto(*out) + } return } diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/openapi_generated.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/openapi_generated.go index ce92c8d8c..71844dd01 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/openapi_generated.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/openapi_generated.go @@ -2636,11 +2636,23 @@ func schema_pkg_apis_pipeline_v1beta1_PipelineTask(ref common.ReferenceCallback) Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), }, }, + "pipelineRef": { + SchemaProps: spec.SchemaProps{ + Description: "PipelineRef is a reference to a pipeline definition Note: PipelineRef is in preview mode and not yet supported", + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineRef"), + }, + }, + "pipelineSpec": { + SchemaProps: spec.SchemaProps{ + Description: "PipelineSpec is a specification of a pipeline Note: PipelineSpec is in preview mode and not yet supported", + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineSpec"), + }, + }, }, }, }, Dependencies: []string{ - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.EmbeddedTask", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Matrix", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Param", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskResources", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRef", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.WhenExpression", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.WorkspacePipelineTaskBinding", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.EmbeddedTask", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Matrix", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.Param", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineRef", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineSpec", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineTaskResources", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.TaskRef", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.WhenExpression", "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.WorkspacePipelineTaskBinding", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, } } diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipeline_types.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipeline_types.go index eba6cba27..bbe837a94 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipeline_types.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipeline_types.go @@ -242,6 +242,16 @@ type PipelineTask struct { // Refer Go's ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration // +optional Timeout *metav1.Duration `json:"timeout,omitempty"` + + // PipelineRef is a reference to a pipeline definition + // Note: PipelineRef is in preview mode and not yet supported + // +optional + PipelineRef *PipelineRef `json:"pipelineRef,omitempty"` + + // PipelineSpec is a specification of a pipeline + // Note: PipelineSpec is in preview mode and not yet supported + // +optional + PipelineSpec *PipelineSpec `json:"pipelineSpec,omitempty"` } // IsCustomTask checks whether an embedded TaskSpec is a Custom Task diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipeline_validation.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipeline_validation.go index 6411d3f09..7529c273b 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipeline_validation.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipeline_validation.go @@ -38,6 +38,13 @@ import ( var _ apis.Validatable = (*Pipeline)(nil) var _ resourcesemantics.VerbLimited = (*Pipeline)(nil) +const ( + taskRef = "taskRef" + taskSpec = "taskSpec" + pipelineRef = "pipelineRef" + pipelineSpec = "pipelineSpec" +) + // SupportedVerbs returns the operations that validation should be called for func (p *Pipeline) SupportedVerbs() []admissionregistrationv1.OperationType { return []admissionregistrationv1.OperationType{admissionregistrationv1.Create, admissionregistrationv1.Update} @@ -139,7 +146,7 @@ func (pt PipelineTask) ValidateName() *apis.FieldError { // Validate classifies whether a task is a custom task, bundle, or a regular task(dag/final) // calls the validation routine based on the type of the task func (pt PipelineTask) Validate(ctx context.Context) (errs *apis.FieldError) { - errs = errs.Also(pt.validateRefOrSpec()) + errs = errs.Also(pt.validateRefOrSpec(ctx)) errs = errs.Also(pt.validateEmbeddedOrType()) @@ -241,15 +248,39 @@ func (pt *PipelineTask) validateWorkspaces(workspaceNames sets.String) (errs *ap return errs } -// validateRefOrSpec validates at least one of taskRef or taskSpec is specified -func (pt PipelineTask) validateRefOrSpec() (errs *apis.FieldError) { - // can't have both taskRef and taskSpec at the same time - if pt.TaskRef != nil && pt.TaskSpec != nil { - errs = errs.Also(apis.ErrMultipleOneOf("taskRef", "taskSpec")) +// validateRefOrSpec validates at least one of taskRef or taskSpec or pipelineRef or pipelineSpec is specified +func (pt PipelineTask) validateRefOrSpec(ctx context.Context) (errs *apis.FieldError) { + // collect all the specified specifications + nonNilFields := []string{} + if pt.TaskRef != nil { + nonNilFields = append(nonNilFields, taskRef) } - // Check that one of TaskRef and TaskSpec is present - if pt.TaskRef == nil && pt.TaskSpec == nil { - errs = errs.Also(apis.ErrMissingOneOf("taskRef", "taskSpec")) + if pt.TaskSpec != nil { + nonNilFields = append(nonNilFields, taskSpec) + } + if pt.PipelineRef != nil { + errs = errs.Also(version.ValidateEnabledAPIFields(ctx, pipelineRef, config.AlphaAPIFields)) + nonNilFields = append(nonNilFields, pipelineRef) + } + if pt.PipelineSpec != nil { + errs = errs.Also(version.ValidateEnabledAPIFields(ctx, pipelineSpec, config.AlphaAPIFields)) + nonNilFields = append(nonNilFields, pipelineSpec) + } + + // check the length of nonNilFields + // if one of taskRef or taskSpec or pipelineRef or pipelineSpec is specified, + // the length of nonNilFields should exactly be 1 + if len(nonNilFields) > 1 { + errs = errs.Also(apis.ErrGeneric("expected exactly one, got multiple", nonNilFields...)) + } else if len(nonNilFields) == 0 { + cfg := config.FromContextOrDefaults(ctx) + // check for TaskRef or TaskSpec or PipelineRef or PipelineSpec with alpha feature flag + if cfg.FeatureFlags.EnableAPIFields == config.AlphaAPIFields { + errs = errs.Also(apis.ErrMissingOneOf(taskRef, taskSpec, pipelineRef, pipelineSpec)) + } else { + // check for taskRef and taskSpec with beta/stable feature flag + errs = errs.Also(apis.ErrMissingOneOf(taskRef, taskSpec)) + } } return errs } diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/swagger.json b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/swagger.json index 2bbb8926d..47aafa9a0 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/swagger.json +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/swagger.json @@ -1287,6 +1287,14 @@ }, "x-kubernetes-list-type": "atomic" }, + "pipelineRef": { + "description": "PipelineRef is a reference to a pipeline definition Note: PipelineRef is in preview mode and not yet supported", + "$ref": "#/definitions/v1beta1.PipelineRef" + }, + "pipelineSpec": { + "description": "PipelineSpec is a specification of a pipeline Note: PipelineSpec is in preview mode and not yet supported", + "$ref": "#/definitions/v1beta1.PipelineSpec" + }, "resources": { "description": "Deprecated: Unused, preserved only for backwards compatibility", "$ref": "#/definitions/v1beta1.PipelineTaskResources" diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go index fdd028257..c158be177 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go @@ -1175,6 +1175,16 @@ func (in *PipelineTask) DeepCopyInto(out *PipelineTask) { *out = new(v1.Duration) **out = **in } + if in.PipelineRef != nil { + in, out := &in.PipelineRef, &out.PipelineRef + *out = new(PipelineRef) + (*in).DeepCopyInto(*out) + } + if in.PipelineSpec != nil { + in, out := &in.PipelineSpec, &out.PipelineSpec + *out = new(PipelineSpec) + (*in).DeepCopyInto(*out) + } return } diff --git a/vendor/github.com/tektoncd/pipeline/pkg/reconciler/events/cloudevent/cloud_event_controller.go b/vendor/github.com/tektoncd/pipeline/pkg/reconciler/events/cloudevent/cloud_event_controller.go index 48b94864a..f5d93a754 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/reconciler/events/cloudevent/cloud_event_controller.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/reconciler/events/cloudevent/cloud_event_controller.go @@ -93,7 +93,7 @@ func SendCloudEventWithRetries(ctx context.Context, object runtime.Object) error if ceClient == nil { return errors.New("no cloud events client found in the context") } - event, err := eventForObjectWithCondition(ctx, o) + event, err := EventForObjectWithCondition(ctx, o) if err != nil { return err } diff --git a/vendor/github.com/tektoncd/pipeline/pkg/reconciler/events/cloudevent/cloudevent.go b/vendor/github.com/tektoncd/pipeline/pkg/reconciler/events/cloudevent/cloudevent.go index cfcec6d25..588592fd1 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/reconciler/events/cloudevent/cloudevent.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/reconciler/events/cloudevent/cloudevent.go @@ -121,9 +121,9 @@ func newTektonCloudEventData(ctx context.Context, runObject objectWithCondition) return tektonCloudEventData, nil } -// eventForObjectWithCondition creates a new event based for a objectWithCondition, -// or return an error if not possible. -func eventForObjectWithCondition(ctx context.Context, runObject objectWithCondition) (*cloudevents.Event, error) { +// EventForObjectWithCondition creates a new event based for an objectWithCondition, +// or returns an error if not possible. +func EventForObjectWithCondition(ctx context.Context, runObject objectWithCondition) (*cloudevents.Event, error) { event := cloudevents.NewEvent() event.SetID(uuid.New().String()) event.SetSubject(runObject.GetObjectMeta().GetName()) diff --git a/vendor/github.com/tektoncd/pipeline/test/controller.go b/vendor/github.com/tektoncd/pipeline/test/controller.go index 730edf4b7..76fef3fa9 100644 --- a/vendor/github.com/tektoncd/pipeline/test/controller.go +++ b/vendor/github.com/tektoncd/pipeline/test/controller.go @@ -330,7 +330,7 @@ func PrependResourceVersionReactor(f *ktesting.Fake) { // EnsureConfigurationConfigMapsExist makes sure all the configmaps exists. func EnsureConfigurationConfigMapsExist(d *Data) { - var defaultsExists, featureFlagsExists, metricsExists, spireconfigExists, eventsExists bool + var defaultsExists, featureFlagsExists, metricsExists, spireconfigExists, eventsExists, tracingExists bool for _, cm := range d.ConfigMaps { if cm.Name == config.GetDefaultsConfigName() { defaultsExists = true @@ -347,6 +347,9 @@ func EnsureConfigurationConfigMapsExist(d *Data) { if cm.Name == config.GetEventsConfigName() { eventsExists = true } + if cm.Name == config.GetTracingConfigName() { + tracingExists = true + } } if !defaultsExists { d.ConfigMaps = append(d.ConfigMaps, &corev1.ConfigMap{ @@ -378,4 +381,10 @@ func EnsureConfigurationConfigMapsExist(d *Data) { Data: map[string]string{}, }) } + if !tracingExists { + d.ConfigMaps = append(d.ConfigMaps, &corev1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{Name: config.GetTracingConfigName(), Namespace: system.Namespace()}, + Data: map[string]string{}, + }) + } } diff --git a/vendor/github.com/tektoncd/pipeline/test/trustedresources.go b/vendor/github.com/tektoncd/pipeline/test/trustedresources.go index d2d9980a2..1a9c695cd 100644 --- a/vendor/github.com/tektoncd/pipeline/test/trustedresources.go +++ b/vendor/github.com/tektoncd/pipeline/test/trustedresources.go @@ -74,27 +74,6 @@ func GetUnsignedTask(name string) *v1beta1.Task { } } -// GetUnsignedPipeline returns unsigned pipeline with given name -func GetUnsignedPipeline(name string) *v1beta1.Pipeline { - return &v1beta1.Pipeline{ - TypeMeta: metav1.TypeMeta{ - APIVersion: "tekton.dev/v1beta1", - Kind: "Pipeline"}, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - Annotations: map[string]string{"foo": "bar"}, - }, - Spec: v1beta1.PipelineSpec{ - Tasks: []v1beta1.PipelineTask{ - { - Name: "task", - }, - }, - }, - } -} - // SetupTrustedResourceConfig configures the trusted-resources-verification-no-match-policy feature flag with the given mode for testing func SetupTrustedResourceConfig(ctx context.Context, verificationNoMatchPolicy string) context.Context { store := config.NewStore(logging.FromContext(ctx).Named("config-store")) diff --git a/vendor/modules.txt b/vendor/modules.txt index 3ae8dbe00..7f952efe1 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1366,7 +1366,7 @@ github.com/tektoncd/hub/api/v1/gen/http/catalog/client github.com/tektoncd/hub/api/v1/gen/http/resource/client github.com/tektoncd/hub/api/v1/gen/resource github.com/tektoncd/hub/api/v1/gen/resource/views -# github.com/tektoncd/pipeline v0.51.0 +# github.com/tektoncd/pipeline v0.52.0 ## explicit; go 1.19 github.com/tektoncd/pipeline/pkg/apis/config github.com/tektoncd/pipeline/pkg/apis/config/resolver