From e0c67ae2c8d3948d1253a1a1956d4fa28738df94 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Sep 2023 22:18:24 +0100 Subject: [PATCH] Bump the all group with 2 updates (#932) Bumps the all group with 2 updates: [github.com/tektoncd/pipeline](https://github.com/tektoncd/pipeline) and [google.golang.org/grpc](https://github.com/grpc/grpc-go). Updates `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) Updates `google.golang.org/grpc` from 1.58.1 to 1.58.2 - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.58.1...v1.58.2) --- updated-dependencies: - dependency-name: github.com/tektoncd/pipeline dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-patch dependency-group: all ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 +- go.sum | 16 ++-- .../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/google.golang.org/grpc/version.go | 2 +- vendor/modules.txt | 4 +- 27 files changed, 425 insertions(+), 102 deletions(-) create mode 100644 vendor/github.com/tektoncd/pipeline/pkg/apis/config/tracing.go diff --git a/go.mod b/go.mod index c53c6f76e4..d6fd447c62 100644 --- a/go.mod +++ b/go.mod @@ -26,14 +26,14 @@ require ( github.com/sigstore/sigstore/pkg/signature/kms/hashivault v1.7.3 github.com/spiffe/go-spiffe/v2 v2.1.6 github.com/stretchr/testify v1.8.4 - github.com/tektoncd/pipeline v0.51.0 + github.com/tektoncd/pipeline v0.52.0 github.com/tektoncd/plumbing v0.0.0-20230907180608-5625252a2de1 go.uber.org/zap v1.26.0 gocloud.dev v0.34.0 gocloud.dev/docstore/mongodocstore v0.34.0 gocloud.dev/pubsub/kafkapubsub v0.34.0 golang.org/x/crypto v0.13.0 - google.golang.org/grpc v1.58.1 + google.golang.org/grpc v1.58.2 google.golang.org/protobuf v1.31.0 k8s.io/api v0.27.3 k8s.io/apimachinery v0.27.3 diff --git a/go.sum b/go.sum index abfcc4dbeb..70a76f0083 100644 --- a/go.sum +++ b/go.sum @@ -169,6 +169,7 @@ github.com/Microsoft/go-winio v0.5.1/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpz github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/Microsoft/hcsshim v0.11.0 h1:7EFNIY4igHEXUdj1zXgAyU3fLc7QfOKHbkldRVTBdiM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OpenPeeDeeP/depguard/v2 v2.1.0 h1:aQl70G173h/GZYhWf36aE5H0KaujXfVMnn/f1kSDVYY= github.com/OpenPeeDeeP/depguard/v2 v2.1.0/go.mod h1:PUBgk35fX4i7JDmwzlJwJ+GMe6NfO1723wmJMgPThNQ= @@ -370,7 +371,7 @@ github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb h1:EDmT6Q9Zs+SbUo github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb/go.mod h1:ZjrT6AXHbDs86ZSdt/osfBi5qfexBrKUdONk989Wnk4= github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be h1:J5BL2kskAlV9ckgEsNQXscjIaLiOYiZ75d4e94E6dcQ= github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be/go.mod h1:mk5IQ+Y0ZeO87b858TlA645sVcEcbiX6YqP98kt+7+w= -github.com/containerd/containerd v1.7.3 h1:cKwYKkP1eTj54bP3wCdXXBymmKRQMrWjkLSWZZJDa8o= +github.com/containerd/containerd v1.7.6 h1:oNAVsnhPoy4BTPQivLgTzI9Oleml9l/+eYIDYXRCYo8= github.com/containerd/stargz-snapshotter/estargz v0.14.3 h1:OqlDCK3ZVUO6C3B/5FSkDwbkEETK84kQgEeFwDC+62k= github.com/containerd/stargz-snapshotter/estargz v0.14.3/go.mod h1:KY//uOCIkSuNAHhJogcZtrNHdKrA99/FCCRjE3HD36o= github.com/coreos/go-oidc/v3 v3.6.0 h1:AKVxfYw1Gmkn/w96z0DbT/B/xFnzTd3MkZvWLjF4n/o= @@ -873,7 +874,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 h1:HxVbL1MhydKs8R8n/HE5NPvzfaYmQJA3o879lE4+WcM= github.com/jgautheron/goconst v1.5.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= @@ -1265,7 +1266,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/src-d/gcfg v1.4.0 h1:xXbNR5AlLSA315x2UO+fTSSAXCDf+Ar38/6oyGbDKQ4= github.com/src-d/gcfg v1.4.0/go.mod h1:p/UMsR43ujA89BJY9duynAwIpvqEujIH/jFlfL7jWoI= github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= @@ -1302,8 +1303,8 @@ github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplB github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c/go.mod h1:SbErYREK7xXdsRiigaQiQkI9McGRzYMvlKYaP3Nimdk= github.com/tdakkota/asciicheck v0.2.0 h1:o8jvnUANo0qXtnslk2d3nMKTFNlOnJjRrNcj0j9qkHM= github.com/tdakkota/asciicheck v0.2.0/go.mod h1:Qb7Y9EgjCLJGup51gDHFzbI08/gbGhL/UVhYIPWG2rg= -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/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= @@ -1411,6 +1412,7 @@ go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= 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/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo= go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4= go.opentelemetry.io/otel/sdk v1.16.0 h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiMWgE= @@ -2048,8 +2050,8 @@ google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.58.1 h1:OL+Vz23DTtrrldqHK49FUOPHyY75rvFqJfXC84NYW58= -google.golang.org/grpc v1.58.1/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= +google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= 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 7630719693..a46de41141 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 0000000000..d8685b758b --- /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 0d0bff08fa..c688b9ee9c 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 5fceccbf50..19604205b8 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 abb49a962e..c3011075ab 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 b47e45f72b..86fe6ce3e7 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 19f97cbf22..25613f1a41 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 e1a7464c35..71b002d9bc 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 88120472ea..fda0168c09 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 1f56c2050e..dc95f47ccb 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 5a7610e032..14b0de17fd 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 5a71f5f50c..e2f82a6473 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 7fb04691e9..c818a5760c 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 bd2f039f69..484d08a434 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 ce92c8d8ce..71844dd01d 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 eba6cba272..bbe837a94e 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 6411d3f09d..7529c273b4 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 2bbb8926db..47aafa9a09 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 fdd0282578..c158be1779 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 48b94864aa..f5d93a754f 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 cfcec6d256..588592fd14 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 730edf4b7a..76fef3fa93 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 d2d9980a2b..1a9c695cd3 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/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go index 2a910c3ced..d3f5bcbfce 100644 --- a/vendor/google.golang.org/grpc/version.go +++ b/vendor/google.golang.org/grpc/version.go @@ -19,4 +19,4 @@ package grpc // Version is the current grpc version. -const Version = "1.58.1" +const Version = "1.58.2" diff --git a/vendor/modules.txt b/vendor/modules.txt index 13d4a02c72..52c8359aa0 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1790,7 +1790,7 @@ github.com/t-yuki/gocover-cobertura # github.com/tdakkota/asciicheck v0.2.0 ## explicit; go 1.18 github.com/tdakkota/asciicheck -# 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 @@ -2393,7 +2393,7 @@ google.golang.org/genproto/googleapis/api/httpbody google.golang.org/genproto/googleapis/rpc/code google.golang.org/genproto/googleapis/rpc/errdetails google.golang.org/genproto/googleapis/rpc/status -# google.golang.org/grpc v1.58.1 +# google.golang.org/grpc v1.58.2 ## explicit; go 1.19 google.golang.org/grpc google.golang.org/grpc/attributes