From b8d2da7b981d6de7e210f2672eb0c7dce8f07614 Mon Sep 17 00:00:00 2001 From: Piyush Garg Date: Tue, 27 Dec 2022 12:42:21 +0530 Subject: [PATCH] Bump tektoncd/pipeline to v0.43.1 This will bump tektoncd/pipline to v0.43.1 and related changes of knative status bump to v1 --- go.mod | 4 +- go.sum | 32 ++- pkg/cmd/clustertask/delete_test.go | 14 +- pkg/cmd/clustertask/describe_test.go | 14 +- pkg/cmd/clustertask/logs_test.go | 6 +- pkg/cmd/pipeline/delete_test.go | 10 +- pkg/cmd/pipeline/describe_test.go | 30 +- pkg/cmd/pipeline/list_test.go | 14 +- pkg/cmd/pipeline/logs_test.go | 26 +- pkg/cmd/pipeline/start_test.go | 54 ++-- pkg/cmd/pipelinerun/cancel_test.go | 34 +-- pkg/cmd/pipelinerun/delete_test.go | 26 +- pkg/cmd/pipelinerun/describe_test.go | 162 +++++------ pkg/cmd/pipelinerun/list_test.go | 14 +- pkg/cmd/pipelinerun/logs_test.go | 102 +++---- pkg/cmd/task/delete_test.go | 14 +- pkg/cmd/task/describe_test.go | 14 +- pkg/cmd/task/logs_test.go | 18 +- pkg/cmd/taskrun/cancel_test.go | 22 +- pkg/cmd/taskrun/delete_test.go | 86 +++--- pkg/cmd/taskrun/describe_test.go | 58 ++-- pkg/cmd/taskrun/list_test.go | 38 +-- pkg/cmd/taskrun/logs_test.go | 50 ++-- pkg/formatted/k8s.go | 4 +- pkg/formatted/k8s_test.go | 18 +- pkg/log/pipeline_reader.go | 6 +- pkg/pipeline/pipelinelastrun_test.go | 10 +- .../description/description_test.go | 18 +- pkg/pipelinerun/pipelinerun_test.go | 22 +- pkg/pipelinerun/tracker_test.go | 19 +- pkg/task/tasklastrun_test.go | 34 +-- pkg/taskrun/get_test.go | 10 +- pkg/taskrun/list/list_test.go | 10 +- .../pipeline/pkg/apis/config/default.go | 16 +- .../pipeline/pkg/apis/config/feature_flags.go | 98 ++++++- .../pkg/apis/config/zz_generated.deepcopy.go | 5 + .../pipeline/pkg/apis/pipeline/images.go | 3 + .../pkg/apis/pipeline/pod/template.go | 10 + .../pipeline/pod/zz_generated.deepcopy.go | 7 + .../pipeline/pkg/apis/pipeline/sidecarlogs.go | 27 ++ .../pkg/apis/pipeline/v1/container_types.go | 3 - .../pkg/apis/pipeline/v1/openapi_generated.go | 38 ++- .../apis/pipeline/v1/pipeline_validation.go | 1 - .../pkg/apis/pipeline/v1/pipelinerun_types.go | 8 +- .../pipeline/v1/pipelinerun_validation.go | 4 +- .../pipeline/pkg/apis/pipeline/v1/register.go | 7 +- .../pkg/apis/pipeline/v1/swagger.json | 22 +- .../pkg/apis/pipeline/v1/task_types.go | 1 - .../pkg/apis/pipeline/v1/task_validation.go | 16 +- .../pkg/apis/pipeline/v1/taskrun_types.go | 27 +- .../apis/pipeline/v1/taskrun_validation.go | 18 ++ .../apis/pipeline/v1/zz_generated.deepcopy.go | 4 +- .../pkg/apis/pipeline/v1alpha1/register.go | 2 + .../pkg/apis/pipeline/v1alpha1/run_types.go | 5 + .../v1alpha1/verificationpolicy_defaults.go | 30 ++ .../v1alpha1/verificationpolicy_types.go | 117 ++++++++ .../v1alpha1/verificationpolicy_validation.go | 93 +++++++ .../v1alpha1/zz_generated.deepcopy.go | 151 +++++++++- .../apis/pipeline/v1beta1/container_types.go | 3 - .../apis/pipeline/v1beta1/customrun_types.go | 5 + .../pipeline/v1beta1/openapi_generated.go | 46 +++- .../apis/pipeline/v1beta1/pipeline_types.go | 4 +- .../pipeline/v1beta1/pipeline_validation.go | 2 - .../v1beta1/pipelinerun_conversion.go | 257 ++++++++++++++++++ .../pipeline/v1beta1/pipelinerun_types.go | 11 +- .../v1beta1/pipelinerun_validation.go | 7 +- .../pipeline/v1beta1/provenance_conversion.go | 44 +++ .../apis/pipeline/v1beta1/resource_types.go | 1 - .../v1beta1/resource_types_validation.go | 1 - .../pkg/apis/pipeline/v1beta1/resultref.go | 1 - .../apis/pipeline/v1beta1/run_interface.go | 43 +++ .../pkg/apis/pipeline/v1beta1/swagger.json | 30 +- .../apis/pipeline/v1beta1/task_validation.go | 16 +- .../pipeline/v1beta1/taskrun_conversion.go | 205 ++++++++++++++ .../apis/pipeline/v1beta1/taskrun_types.go | 34 ++- .../pipeline/v1beta1/taskrun_validation.go | 19 +- .../pipeline/v1beta1/zz_generated.deepcopy.go | 4 +- .../apis/run/v1beta1/customrunstatus_types.go | 26 ++ .../v1alpha1/fake/fake_pipeline_client.go | 4 + .../v1alpha1/fake/fake_verificationpolicy.go | 130 +++++++++ .../pipeline/v1alpha1/generated_expansion.go | 2 + .../pipeline/v1alpha1/pipeline_client.go | 5 + .../pipeline/v1alpha1/verificationpolicy.go | 178 ++++++++++++ .../informers/externalversions/generic.go | 2 + .../pipeline/v1alpha1/interface.go | 7 + .../pipeline/v1alpha1/verificationpolicy.go | 90 ++++++ .../pkg/client/injection/client/client.go | 131 +++++++++ .../v1alpha1/verificationpolicy/fake/fake.go | 40 +++ .../verificationpolicy/verificationpolicy.go | 116 ++++++++ .../pipeline/v1alpha1/expansion_generated.go | 8 + .../pipeline/v1alpha1/verificationpolicy.go | 99 +++++++ .../cloudevent/cloud_event_controller.go | 40 +++ .../reconciler/events/cloudevent/interface.go | 1 - .../pipeline/pkg/remote/oci/resolver.go | 3 +- .../tektoncd/pipeline/pkg/status/status.go | 59 +++- .../pipeline/pkg/substitution/substitution.go | 3 - .../tektoncd/pipeline/test/README.md | 4 +- .../tektoncd/pipeline/test/build_logs.go | 4 +- .../tektoncd/pipeline/test/clients.go | 29 +- .../tektoncd/pipeline/test/controller.go | 68 +++-- .../tektoncd/pipeline/test/e2e-common.sh | 15 + .../test/e2e-tests-kind-prow-alpha.env | 1 + .../tektoncd/pipeline/test/e2e-tests.sh | 14 + .../tektoncd/pipeline/test/multiarch_utils.go | 63 +---- .../tektoncd/pipeline/test/parse/yaml.go | 61 +++++ .../tektoncd/pipeline/test/presubmit-tests.sh | 2 +- .../tektoncd/pipeline/test/secret.go | 3 +- .../pipeline/test/trustedresources.go | 202 ++++++++++++-- .../github.com/tektoncd/pipeline/test/wait.go | 46 +++- vendor/modules.txt | 6 +- 110 files changed, 3180 insertions(+), 721 deletions(-) create mode 100644 vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/sidecarlogs.go create mode 100644 vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/verificationpolicy_defaults.go create mode 100644 vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/verificationpolicy_types.go create mode 100644 vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/verificationpolicy_validation.go create mode 100644 vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/provenance_conversion.go create mode 100644 vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/run_interface.go create mode 100644 vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/fake/fake_verificationpolicy.go create mode 100644 vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/verificationpolicy.go create mode 100644 vendor/github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha1/verificationpolicy.go create mode 100644 vendor/github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha1/verificationpolicy/fake/fake.go create mode 100644 vendor/github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha1/verificationpolicy/verificationpolicy.go create mode 100644 vendor/github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha1/verificationpolicy.go diff --git a/go.mod b/go.mod index f78d6a29cc..1e0cf5faa8 100644 --- a/go.mod +++ b/go.mod @@ -56,7 +56,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/tektoncd/chains v0.14.0 github.com/tektoncd/hub v1.11.1 - github.com/tektoncd/pipeline v0.42.0 + github.com/tektoncd/pipeline v0.43.1 github.com/tektoncd/plumbing v0.0.0-20221102182345-5dbcfda657d7 github.com/tektoncd/triggers v0.22.0 github.com/theupdateframework/go-tuf v0.5.2-0.20220930112810-3890c1e7ace4 @@ -253,7 +253,7 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.16 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect github.com/miekg/pkcs11 v1.1.1 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect diff --git a/go.sum b/go.sum index 560f275d50..2ac48c8d7a 100644 --- a/go.sum +++ b/go.sum @@ -625,6 +625,7 @@ github.com/Microsoft/hcsshim v0.9.2/go.mod h1:7pLA8lDk46WKDWlVsENo92gC0XFa8rbKfy github.com/Microsoft/hcsshim v0.9.3/go.mod h1:7pLA8lDk46WKDWlVsENo92gC0XFa8rbKfyFRBqxEbCc= github.com/Microsoft/hcsshim v0.9.4/go.mod h1:7pLA8lDk46WKDWlVsENo92gC0XFa8rbKfyFRBqxEbCc= github.com/Microsoft/hcsshim v0.9.5/go.mod h1:7pLA8lDk46WKDWlVsENo92gC0XFa8rbKfyFRBqxEbCc= +github.com/Microsoft/hcsshim v0.9.6/go.mod h1:7pLA8lDk46WKDWlVsENo92gC0XFa8rbKfyFRBqxEbCc= 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= @@ -791,6 +792,7 @@ github.com/aws/aws-sdk-go v1.44.96/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4 github.com/aws/aws-sdk-go v1.44.102/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= github.com/aws/aws-sdk-go v1.44.114/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= github.com/aws/aws-sdk-go v1.44.119/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= +github.com/aws/aws-sdk-go v1.44.144/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go v1.44.155 h1:PMHMuUS0atPD4LhiXuYrLasrlIm4u3lpNQBl9h+Lr2s= github.com/aws/aws-sdk-go v1.44.155/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= @@ -805,6 +807,7 @@ github.com/aws/aws-sdk-go-v2 v1.16.11/go.mod h1:WTACcleLz6VZTp7fak4EO5b9Q4foxbn+ github.com/aws/aws-sdk-go-v2 v1.16.14/go.mod h1:s/G+UV29dECbF5rf+RNj1xhlmvoNurGSr+McVSRj59w= github.com/aws/aws-sdk-go-v2 v1.16.15/go.mod h1:SwiyXi/1zTUZ6KIAmLK5V5ll8SiURNUYOqTerZPaF9k= github.com/aws/aws-sdk-go-v2 v1.16.16/go.mod h1:SwiyXi/1zTUZ6KIAmLK5V5ll8SiURNUYOqTerZPaF9k= +github.com/aws/aws-sdk-go-v2 v1.17.1/go.mod h1:JLnGeGONAyi2lWXI1p0PCIOIy333JMVK1U7Hf0aRFLw= github.com/aws/aws-sdk-go-v2 v1.17.2 h1:r0yRZInwiPBNpQ4aDy/Ssh3ROWsGtKDwar2JS8Lm+N8= github.com/aws/aws-sdk-go-v2 v1.17.2/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.0.0/go.mod h1:Xn6sxgRuIDflLRJFj5Ev7UxABIkNbccFPV/p8itDReM= @@ -818,6 +821,7 @@ github.com/aws/aws-sdk-go-v2/config v1.17.1/go.mod h1:uOxDHjBemNTF2Zos+fgG0NNfE8 github.com/aws/aws-sdk-go-v2/config v1.17.5/go.mod h1:H0cvPNDO3uExWts/9PDhD/0ne2esu1uaIulwn1vkwxM= github.com/aws/aws-sdk-go-v2/config v1.17.7/go.mod h1:dN2gja/QXxFF15hQreyrqYhLBaQo1d9ZKe/v/uplQoI= github.com/aws/aws-sdk-go-v2/config v1.17.8/go.mod h1:UkCI3kb0sCdvtjiXYiU4Zx5h07BOpgBTtkPu/49r+kA= +github.com/aws/aws-sdk-go-v2/config v1.18.3/go.mod h1:BYdrbeCse3ZnOD5+2/VE/nATOK8fEUpBtmPMdKSyhMU= github.com/aws/aws-sdk-go-v2/config v1.18.4 h1:VZKhr3uAADXHStS/Gf9xSYVmmaluTUfkc0dcbPiDsKE= github.com/aws/aws-sdk-go-v2/config v1.18.4/go.mod h1:EZxMPLSdGAZ3eAmkqXfYbRppZJTzFTkv8VyEzJhKko4= github.com/aws/aws-sdk-go-v2/credentials v1.3.1/go.mod h1:r0n73xwsIVagq8RsxmZbGSRQFj9As3je72C2WzUIToc= @@ -829,6 +833,7 @@ github.com/aws/aws-sdk-go-v2/credentials v1.12.14/go.mod h1:opAndTyq+YN7IpVG57z2 github.com/aws/aws-sdk-go-v2/credentials v1.12.18/go.mod h1:O7n/CPagQ33rfG6h7vR/W02ammuc5CrsSM22cNZp9so= github.com/aws/aws-sdk-go-v2/credentials v1.12.20/go.mod h1:UKY5HyIux08bbNA7Blv4PcXQ8cTkGh7ghHMFklaviR4= github.com/aws/aws-sdk-go-v2/credentials v1.12.21/go.mod h1:O+4XyAt4e+oBAoIwNUYkRg3CVMscaIJdmZBOcPgJ8D8= +github.com/aws/aws-sdk-go-v2/credentials v1.13.3/go.mod h1:/rOMmqYBcFfNbRPU0iN9IgGqD5+V2yp3iWNmIlz0wI4= github.com/aws/aws-sdk-go-v2/credentials v1.13.4 h1:nEbHIyJy7mCvQ/kzGG7VWHSBpRB4H6sJy3bWierWUtg= github.com/aws/aws-sdk-go-v2/credentials v1.13.4/go.mod h1:/Cj5w9LRsNTLSwexsohwDME32OzJ6U81Zs33zr2ZWOM= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.3.0/go.mod h1:2LAuqPx1I6jNfaGDucWfA2zqQCYCOMCDHiCOciALyNw= @@ -839,6 +844,7 @@ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.9/go.mod h1:KDCCm4ONIdHtUloD github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12/go.mod h1:aZ4vZnyUuxedC7eD4JyEHpGnCz+O2sHQEx3VvAwklSE= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.15/go.mod h1:Oz2/qWINxIgSmoZT9adpxJy2UhpcOAI3TIyWgYMVSz0= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.17/go.mod h1:yIkQcCDYNsZfXpd5UX2Cy+sWA1jPgIhGTw9cOBzfVnQ= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.19/go.mod h1:VihW95zQpeKQWVPGkwT+2+WJNQV8UXFfMTWdU6VErL8= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.20 h1:tpNOglTZ8kg9T38NpcGBxudqfUAwUzyUnLQ4XSd0CHE= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.20/go.mod h1:d9xFpWd3qYwdIXM0fvu7deD08vvdRXyc/ueV+0SqaWE= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.7.1/go.mod h1:wN/mvkow08GauDwJ70jnzJ1e+hE+Q3Q7TwpYLXOe9oI= @@ -852,6 +858,7 @@ github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.18/go.mod h1:348MLhzV1G github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.21/go.mod h1:XsmHMV9c512xgsW01q7H0ut+UQQQpWX8QsFbdLHDwaU= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.22/go.mod h1:/vNv5Al0bpiF8YdX2Ov6Xy05VTiXsql94yUqJMYaj0w= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.23/go.mod h1:2DFxAQ9pfIRy0imBCJv+vZ2X6RKxves6fbnEuSry6b4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.25/go.mod h1:Zb29PYkf42vVYQY6pvSyJCJcFHlPIiY+YKdPtwnvMkY= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.26 h1:5WU31cY7m0tG+AiaXuXGoMzo2GBQ1IixtWa8Yywsgco= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.26/go.mod h1:2E0LdbJW6lbeU4uxjum99GZzI0ZjDpAb0CoSCM0oeEY= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.0.0/go.mod h1:anlUzBoEWglcUxUQwZA7HQOEVEnQALVZsizAapB2hq8= @@ -863,6 +870,7 @@ github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.12/go.mod h1:ckaCVTEdGAx github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.15/go.mod h1:kjJ4CyD9M3Wq88GYg3IPfj67Rs0Uvz8aXK7MJ8BvE4I= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.16/go.mod h1:62dsXI0BqTIGomDl8Hpm33dv0OntGaVblri3ZRParVQ= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.17/go.mod h1:pRwaTYCJemADaqCbUAxltMoHKata7hmB5PjEXeu0kfg= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.19/go.mod h1:6Q0546uHDp421okhmmGfbxzq2hBqbXFNpi4k+Q1JnQA= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.20 h1:WW0qSzDWoiWU2FS5DbKpxGilFVlCEJPwx4YtjdfI0Jw= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.20/go.mod h1:/+6lSiby8TBFpTVXZgKiN/rCfkYXEGvhlM4zCgPpt7w= github.com/aws/aws-sdk-go-v2/internal/ini v1.1.1/go.mod h1:Zy8smImhTdOETZqfyn01iNOe0CNggVbPjCajyaz6Gvg= @@ -873,6 +881,7 @@ github.com/aws/aws-sdk-go-v2/internal/ini v1.3.16/go.mod h1:CYmI+7x03jjJih8kBEEF github.com/aws/aws-sdk-go-v2/internal/ini v1.3.19/go.mod h1:cVHo8KTuHjShb9V8/VjH3S/8+xPu16qx8fdGwmotJhE= github.com/aws/aws-sdk-go-v2/internal/ini v1.3.22/go.mod h1:tltHVGy977LrSOgRR5aV9+miyno/Gul/uJNPKS7FzP4= github.com/aws/aws-sdk-go-v2/internal/ini v1.3.24/go.mod h1:jULHjqqjDlbyTa7pfM7WICATnOv+iOhjletM3N0Xbu8= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.26/go.mod h1:Y2OJ+P+MC1u1VKnavT+PshiEuGPyh/7DqxoDNij4/bg= github.com/aws/aws-sdk-go-v2/internal/ini v1.3.27 h1:N2eKFw2S+JWRCtTt0IhIX7uoGGQciD4p6ba+SJv4WEU= github.com/aws/aws-sdk-go-v2/internal/ini v1.3.27/go.mod h1:RdwFVc7PBYWY33fa2+8T1mSqQ7ZEK4ILpM0wfioDC3w= github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.5/go.mod h1:aIwFF3dUk95ocCcA3zfk3nhz0oLkpzHFWuMp8l/4nNs= @@ -901,6 +910,7 @@ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.9/go.mod h1:yQo github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12/go.mod h1:1TODGhheLWjpQWSuhYuAUWYTCKwEjx2iblIFKDHjeTc= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.15/go.mod h1:ZVJ7ejRl4+tkWMuCwjXoy0jd8fF5u3RCyWjSVjUIvQE= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.17/go.mod h1:4nYOrY41Lrbk2170/BGkcJKBhws9Pfn8MG3aGqjjeFI= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.19/go.mod h1:02CP6iuYP+IVnBX5HULVdSAku/85eHB2Y9EsFhrkEwU= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.20 h1:jlgyHbkZQAgAc7VIxJDmtouH8eNjOk2REVAQfVhdaiQ= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.20/go.mod h1:Xs52xaLBqDEKRcAfX/hgjmD3YQ7c/W+BEyfamlO/W2E= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.9.0/go.mod h1:xKCZ4YFSF2s4Hnb/J0TLeOsKuGzICzcElaOKNGrVnx4= @@ -912,6 +922,7 @@ github.com/aws/aws-sdk-go-v2/service/kms v1.18.9/go.mod h1:8sR6O18d56mlJf0VkYD7m github.com/aws/aws-sdk-go-v2/service/kms v1.18.10/go.mod h1:45pB2oUV71tilooilIi3dC1KVWWJHHhc7JnyqByuheo= github.com/aws/aws-sdk-go-v2/service/kms v1.18.11/go.mod h1:DZtboupHLNr0p6qHw9r3kR8MUnN/rc4AAVmNpe2ocuU= github.com/aws/aws-sdk-go-v2/service/kms v1.18.12/go.mod h1:DZtboupHLNr0p6qHw9r3kR8MUnN/rc4AAVmNpe2ocuU= +github.com/aws/aws-sdk-go-v2/service/kms v1.18.18/go.mod h1:kZodDPTQjSH/qM6/OvyTfM5mms5JHB/EKYp5dhn/vI4= github.com/aws/aws-sdk-go-v2/service/kms v1.19.2 h1:pgOVfu7E6zBddKGks4TvL4YuFsL/oTpiWDIzs4WPLjY= github.com/aws/aws-sdk-go-v2/service/kms v1.19.2/go.mod h1:XH60PhgtbXDXFBzJ2auE6bpIELxAYTnoVFFwPtG8JwY= github.com/aws/aws-sdk-go-v2/service/s3 v1.19.0/go.mod h1:Gwz3aVctJe6mUY9T//bcALArPUaFmNAy2rTB9qN4No8= @@ -933,11 +944,13 @@ github.com/aws/aws-sdk-go-v2/service/sso v1.11.13/go.mod h1:d7ptRksDDgvXaUvxyHZ9 github.com/aws/aws-sdk-go-v2/service/sso v1.11.17/go.mod h1:mS5xqLZc/6kc06IpXn5vRxdLaED+jEuaSRv5BxtnsiY= github.com/aws/aws-sdk-go-v2/service/sso v1.11.21/go.mod h1:q8nYq51W3gpZempYsAD83fPRlrOTMCwN+Ahg4BKFTXQ= github.com/aws/aws-sdk-go-v2/service/sso v1.11.23/go.mod h1:/w0eg9IhFGjGyyncHIQrXtU8wvNsTJOP0R6PPj0wf80= +github.com/aws/aws-sdk-go-v2/service/sso v1.11.25/go.mod h1:IARHuzTXmj1C0KS35vboR0FeJ89OkEy1M9mWbK2ifCI= github.com/aws/aws-sdk-go-v2/service/sso v1.11.26 h1:ActQgdTNQej/RuUJjB9uxYVLDOvRGtUreXF8L3c8wyg= github.com/aws/aws-sdk-go-v2/service/sso v1.11.26/go.mod h1:uB9tV79ULEZUXc6Ob18A46KSQ0JDlrplPni9XW6Ot60= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.3/go.mod h1:+IF75RMJh0+zqTGXGshyEGRsU2ImqWv6UuHGkHl6kEo= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.5/go.mod h1:csZuQY65DAdFBt1oIjO5hhBR49kQqop4+lcuCjf2arA= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.6/go.mod h1:csZuQY65DAdFBt1oIjO5hhBR49kQqop4+lcuCjf2arA= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.8/go.mod h1:er2JHN+kBY6FcMfcBBKNGCT3CarImmdFzishsqBmSRI= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.9 h1:wihKuqYUlA2T/Rx+yu2s6NDAns8B9DgnRooB1PVhY+Q= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.9/go.mod h1:2E/3D/mB8/r2J7nK42daoKP/ooCwbf0q1PznNc+DZTU= github.com/aws/aws-sdk-go-v2/service/sts v1.6.0/go.mod h1:q7o0j7d7HrJk/vr9uUt3BVRASvcU7gYZB9PUgPiByXg= @@ -948,6 +961,7 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.16.10/go.mod h1:cftkHYN6tCDNfkSasAmc github.com/aws/aws-sdk-go-v2/service/sts v1.16.13/go.mod h1:Ru3QVMLygVs/07UQ3YDur1AQZZp2tUNje8wfloFttC0= github.com/aws/aws-sdk-go-v2/service/sts v1.16.17/go.mod h1:bQujK1n0V1D1Gz5uII1jaB1WDvhj4/T3tElsJnVXCR0= github.com/aws/aws-sdk-go-v2/service/sts v1.16.19/go.mod h1:h4J3oPZQbxLhzGnk+j9dfYHi5qIOVJ5kczZd658/ydM= +github.com/aws/aws-sdk-go-v2/service/sts v1.17.5/go.mod h1:bXcN3koeVYiJcdDU89n3kCYILob7Y34AeLopUbZgLT4= github.com/aws/aws-sdk-go-v2/service/sts v1.17.6 h1:VQFOLQVL3BrKM/NLO/7FiS4vcp5bqK0mGMyk09xLoAY= github.com/aws/aws-sdk-go-v2/service/sts v1.17.6/go.mod h1:Az3OXXYGyfNwQNsK/31L4R75qFYnO641RZGAoV3uH1c= github.com/aws/smithy-go v1.6.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= @@ -960,6 +974,7 @@ github.com/aws/smithy-go v1.12.1/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J github.com/aws/smithy-go v1.13.1/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/aws/smithy-go v1.13.2/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/aws/smithy-go v1.13.3/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/aws/smithy-go v1.13.4/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8= github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20211215200129-69c85dc22db6/go.mod h1:8vJsEZ4iRqG+Vx6pKhWK6U00qcj0KC37IsfszMkY6UE= @@ -1125,6 +1140,7 @@ github.com/containerd/cgroups v0.0.0-20200824123100-0b889c03f102/go.mod h1:s5q4S github.com/containerd/cgroups v0.0.0-20210114181951-8a68de567b68/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= github.com/containerd/cgroups v1.0.1/go.mod h1:0SJrPIenamHDcZhEcJMNBB85rHcUsw4f25ZfBiPYRkU= github.com/containerd/cgroups v1.0.3/go.mod h1:/ofk34relqNjSGyqPrmEULrO4Sc8LJhvJmWbUCUKqj8= +github.com/containerd/cgroups v1.0.4/go.mod h1:nLNQtsF7Sl2HxNebu77i1R0oDlhiTG+kO4JTrUzo6IA= github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= github.com/containerd/console v0.0.0-20181022165439-0650fd9eeb50/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= github.com/containerd/console v0.0.0-20191206165004-02ecf6a7291e/go.mod h1:8Pf4gM6VEbTNRIT26AyyU7hxdQU3MvAvxVI0sc00XBE= @@ -1153,8 +1169,9 @@ github.com/containerd/containerd v1.6.1/go.mod h1:1nJz5xCZPusx6jJU8Frfct988y0Npu github.com/containerd/containerd v1.6.6/go.mod h1:ZoP1geJldzCVY3Tonoz7b1IXk8rIX0Nltt5QE4OMNk0= github.com/containerd/containerd v1.6.8/go.mod h1:By6p5KqPK0/7/CgO/A6t/Gz+CUYUu2zf1hUaaymVXB0= github.com/containerd/containerd v1.6.9/go.mod h1:XVicUvkxOrftE2Q1YWUXgZwkkAxwQYNOFzYWvfVfEfQ= -github.com/containerd/containerd v1.6.10 h1:8aiav7I2ZyQLbTlNMcBXyAU1FtFvp6VuyuW13qSd6Hk= github.com/containerd/containerd v1.6.10/go.mod h1:CVqfxdJ95PDgORwA219AwwLrREZgrTFybXu2HfMKRG0= +github.com/containerd/containerd v1.6.14 h1:W+d0AJKVG3ioTZZyQwcw1Y3vvo6ZDYzAcjDcY4tkgGI= +github.com/containerd/containerd v1.6.14/go.mod h1:U2NnBPIhzJDm59xF7xB2MMHnKtggpZ+phKg8o2TKj2c= 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= @@ -1625,6 +1642,7 @@ github.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48/go.mod h1:dZGr github.com/go-rod/rod v0.109.3/go.mod h1:GZDtmEs6RpF6kBRYpGCZXxXlKNneKVPiKOjaMbmVVjE= github.com/go-rod/rod v0.111.0/go.mod h1:GZDtmEs6RpF6kBRYpGCZXxXlKNneKVPiKOjaMbmVVjE= github.com/go-rod/rod v0.112.0/go.mod h1:GZDtmEs6RpF6kBRYpGCZXxXlKNneKVPiKOjaMbmVVjE= +github.com/go-rod/rod v0.112.1/go.mod h1:fwfpjm+CpFaGn50i+l/ieqATte/FY1cvi8nsrq8DJjA= github.com/go-rod/rod v0.112.2 h1:dwauKYC/H2em8/BcGk3gC0LTzZHf5MIDKf2DVM4z9gU= github.com/go-rod/rod v0.112.2/go.mod h1:ElViL9ABbcshNQw93+11FrYRH92RRhMKleuILo6+5V0= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= @@ -2330,8 +2348,9 @@ github.com/jedisct1/go-minisign v0.0.0-20211028175153-1c139d1cc84b/go.mod h1:hQm github.com/jellydator/ttlcache/v2 v2.11.1 h1:AZGME43Eh2Vv3giG6GeqeLeFXxwxn1/qHItqWZl6U64= github.com/jellydator/ttlcache/v2 v2.11.1/go.mod h1:RtE5Snf0/57e+2cLWFYWCCsLas2Hy3c5Z4n14XmSvTI= github.com/jenkins-x/go-scm v1.11.29/go.mod h1:s5AZIMeNzvDHRnOG1nhD/OLZZ/LOwHTGLXehCsjwGuo= -github.com/jenkins-x/go-scm v1.11.35 h1:DcxonfFMf8jqqSWZHCsj40Cp1++hTAmlFtIf7IEl3vk= github.com/jenkins-x/go-scm v1.11.35/go.mod h1:JyL6p5dNNeJZt41yfysDTBe0Q51cLa5MVK0du7JnXt0= +github.com/jenkins-x/go-scm v1.12.3 h1:9l0IeFnDrmgTsbgUAE1wgzcqdrpYIRWCAlIRm+1LBoI= +github.com/jenkins-x/go-scm v1.12.3/go.mod h1:GyT1710F6sTolj1Aiq5tmWxIzAWMp5rnMUQIYAdmw68= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= github.com/jgautheron/goconst v1.5.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= @@ -2598,8 +2617,9 @@ github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW github.com/mattn/go-zglob v0.0.1/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo= github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY= github.com/maxbrunsfeld/counterfeiter/v6 v6.5.0/go.mod h1:fJ0UAZc1fx3xZhU4eSHQDJ1ApFmTVhp5VTpV9tm2ogg= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= @@ -3111,6 +3131,7 @@ github.com/sigstore/sigstore v1.4.1/go.mod h1:4+s4d6oTDdoQkf5lwpZBoOlWWV+hXhur1m github.com/sigstore/sigstore v1.4.2/go.mod h1:wCv58Fia7u1snVJyPcxdgIh/3uw1XdOLhxPExTwwyt4= github.com/sigstore/sigstore v1.4.4/go.mod h1:wIqu9sN72+pds31MMu89GchxXHy17k+VZWc+HY1ZXMA= github.com/sigstore/sigstore v1.4.5/go.mod h1:mg/+e74CCjEdJpWNjWRAlxMUd39VWh5t1+JI9UcepoY= +github.com/sigstore/sigstore v1.4.6/go.mod h1:jGHEfVTFgpfDpBz7pSY4X+Sd+g36qdAUxGufNk47k7g= github.com/sigstore/sigstore v1.5.0 h1:NqstQ6SwwhQsp6Ll0wgk/d9g5MlfmEppo14aquUjJ/8= github.com/sigstore/sigstore v1.5.0/go.mod h1:fRAaZ9xXh7ZQ0GJqZdpmNJ3pemuHBu2PgIAngmzIFSI= github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= @@ -3265,8 +3286,9 @@ github.com/tektoncd/chains v0.14.0/go.mod h1:Ak0so5jzpntoVtJkD7JedDePkvWG+LPhL6k github.com/tektoncd/hub v1.11.1 h1:ec1Q0twM2VTwKnZT5n1U/x+2JKC8wrESbRPPWHyGLEc= github.com/tektoncd/hub v1.11.1/go.mod h1:6pCq7zMVlQhqVMEmKme9fc9CYnEDxqWr5xIFVTUvRUE= github.com/tektoncd/pipeline v0.41.0/go.mod h1:YY4+PGfdsd6Qxn3PZXmCpKeS3heK8pIIcnUt37vRJ2Q= -github.com/tektoncd/pipeline v0.42.0 h1:K85XkpWw0hJvuGQpbfVfsG8wL/ptYLNP5UuvYDhtH5M= github.com/tektoncd/pipeline v0.42.0/go.mod h1:AsKKcVxseE/VxA28hgXJ/JO/L3yl60jlegDgDUCSNXE= +github.com/tektoncd/pipeline v0.43.1 h1:+ZQLzjDfhTvt5KNwAary3r/DADEcAtbW5HcdIaY4WwQ= +github.com/tektoncd/pipeline v0.43.1/go.mod h1:KEnQsGxxeK7UjVMzVt62CEa7VZ6GUuMJfUHAaEpVP+E= github.com/tektoncd/plumbing v0.0.0-20220817140952-3da8ce01aeeb/go.mod h1:uJBaI0AL/kjPThiMYZcWRujEz7D401v643d6s/21GAg= github.com/tektoncd/plumbing v0.0.0-20221102182345-5dbcfda657d7 h1:YsjQ83UBIIq4k/s2PzQ6pqe4tpPtm1hia3oyNBDDrDU= github.com/tektoncd/plumbing v0.0.0-20221102182345-5dbcfda657d7/go.mod h1:uJBaI0AL/kjPThiMYZcWRujEz7D401v643d6s/21GAg= @@ -3755,6 +3777,7 @@ golang.org/x/crypto v0.0.0-20220919173607-35f4265a4bc0/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.2.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80= golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= @@ -4638,6 +4661,7 @@ google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz google.golang.org/genproto v0.0.0-20221024153911-1573dae28c9c/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c/go.mod h1:CGI5F/G+E5bKwmfYo09AXuVN4dD894kIKUFmVbP2/Fo= +google.golang.org/genproto v0.0.0-20221111202108-142d8a6fa32e/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= google.golang.org/genproto v0.0.0-20221117204609-8f9c96812029/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= google.golang.org/genproto v0.0.0-20221201164419-0e50fba7f41c/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= diff --git a/pkg/cmd/clustertask/delete_test.go b/pkg/cmd/clustertask/delete_test.go index cba421ab5f..610b7d6f1e 100644 --- a/pkg/cmd/clustertask/delete_test.go +++ b/pkg/cmd/clustertask/delete_test.go @@ -29,7 +29,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/dynamic" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestClusterTaskDelete(t *testing.T) { @@ -76,8 +76,8 @@ func TestClusterTaskDelete(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -99,8 +99,8 @@ func TestClusterTaskDelete(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -125,8 +125,8 @@ func TestClusterTaskDelete(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), diff --git a/pkg/cmd/clustertask/describe_test.go b/pkg/cmd/clustertask/describe_test.go index 66d18af36f..7959ab5b10 100644 --- a/pkg/cmd/clustertask/describe_test.go +++ b/pkg/cmd/clustertask/describe_test.go @@ -33,7 +33,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" k8stest "k8s.io/client-go/testing" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func Test_ClusterTaskDescribe(t *testing.T) { @@ -204,8 +204,8 @@ func Test_ClusterTaskDescribe(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -255,8 +255,8 @@ func Test_ClusterTaskDescribe(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -323,8 +323,8 @@ func Test_ClusterTaskDescribe(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Reason: v1beta1.TaskRunReasonRunning.String(), diff --git a/pkg/cmd/clustertask/logs_test.go b/pkg/cmd/clustertask/logs_test.go index 09f8e290a3..9904d2a683 100644 --- a/pkg/cmd/clustertask/logs_test.go +++ b/pkg/cmd/clustertask/logs_test.go @@ -29,7 +29,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/dynamic" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func init() { @@ -152,8 +152,8 @@ func TestLogs_Auto_Select_FirstClusterTask(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), diff --git a/pkg/cmd/pipeline/delete_test.go b/pkg/cmd/pipeline/delete_test.go index b5e345b9e7..764f9cc9cb 100644 --- a/pkg/cmd/pipeline/delete_test.go +++ b/pkg/cmd/pipeline/delete_test.go @@ -29,7 +29,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/dynamic" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestPipelineDelete(t *testing.T) { @@ -69,8 +69,8 @@ func TestPipelineDelete(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -98,8 +98,8 @@ func TestPipelineDelete(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), diff --git a/pkg/cmd/pipeline/describe_test.go b/pkg/cmd/pipeline/describe_test.go index 6523323237..fafcadebf7 100644 --- a/pkg/cmd/pipeline/describe_test.go +++ b/pkg/cmd/pipeline/describe_test.go @@ -29,7 +29,7 @@ import ( "gotest.tools/v3/golden" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestPipelineDescribe_invalid_namespace(t *testing.T) { @@ -143,8 +143,8 @@ func TestPipelineDescribe_with_run(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -240,8 +240,8 @@ func TestPipelineDescribe_with_spec_run(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -353,8 +353,8 @@ func TestPipelineDescribe_with_spec_resource_param_run(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -466,8 +466,8 @@ func TestPipelineDescribe_with_multiple_pipelineruns(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -495,8 +495,8 @@ func TestPipelineDescribe_with_multiple_pipelineruns(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -525,8 +525,8 @@ func TestPipelineDescribe_with_multiple_pipelineruns(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -718,8 +718,8 @@ func TestPipelineDescribe_with_spec_multiple_resource_param_run(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), diff --git a/pkg/cmd/pipeline/list_test.go b/pkg/cmd/pipeline/list_test.go index e51db1ca8a..86731f8084 100644 --- a/pkg/cmd/pipeline/list_test.go +++ b/pkg/cmd/pipeline/list_test.go @@ -28,7 +28,7 @@ import ( "gotest.tools/v3/golden" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestPipelinesList_invalid_namespace(t *testing.T) { @@ -382,8 +382,8 @@ func TestPipelinesList_with_single_run(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -485,8 +485,8 @@ func TestPipelinesList_latest_run(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -512,8 +512,8 @@ func TestPipelinesList_latest_run(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), diff --git a/pkg/cmd/pipeline/logs_test.go b/pkg/cmd/pipeline/logs_test.go index 5dde12e4c2..bc15e8ad24 100644 --- a/pkg/cmd/pipeline/logs_test.go +++ b/pkg/cmd/pipeline/logs_test.go @@ -34,7 +34,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/dynamic" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func init() { @@ -123,8 +123,8 @@ func TestPipelineLog(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -152,8 +152,8 @@ func TestPipelineLog(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -320,8 +320,8 @@ func TestPipelineLog_Interactive(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -349,8 +349,8 @@ func TestPipelineLog_Interactive(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -400,8 +400,8 @@ func TestPipelineLog_Interactive(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -720,8 +720,8 @@ func TestLogs_Auto_Select_FirstPipeline(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), diff --git a/pkg/cmd/pipeline/start_test.go b/pkg/cmd/pipeline/start_test.go index 2931e2812e..07dc983c27 100644 --- a/pkg/cmd/pipeline/start_test.go +++ b/pkg/cmd/pipeline/start_test.go @@ -48,7 +48,7 @@ import ( util "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/watch" k8stest "k8s.io/client-go/testing" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func newPipelineClient(objs ...runtime.Object) (*fakepipelineclientset.Clientset, testDynamic.Options) { @@ -3266,8 +3266,8 @@ func Test_start_pipeline_last(t *testing.T) { Timeout: &metav1.Duration{Duration: timeoutDuration}, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -3469,8 +3469,8 @@ func Test_start_pipeline_last_override_timeout_deprecated(t *testing.T) { Timeout: &metav1.Duration{Duration: timeoutDuration}, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -3643,8 +3643,8 @@ func Test_start_pipeline_last_without_res_param(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -3835,8 +3835,8 @@ func Test_start_pipeline_last_merge(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -4000,8 +4000,8 @@ func Test_start_pipeline_use_pipelinerun(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -4032,8 +4032,8 @@ func Test_start_pipeline_use_pipelinerun(t *testing.T) { Timeout: &metav1.Duration{Duration: timeoutDuration}, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -4183,8 +4183,8 @@ func Test_start_pipeline_use_pipelinerun_cancelled_status(t *testing.T) { Status: v1beta1.PipelineRunSpecStatus(v1beta1.PipelineRunSpecStatusCancelled), }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.PipelineRunReasonCancelled.String(), @@ -4480,8 +4480,8 @@ func Test_start_pipeline_last_generate_name(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -4657,8 +4657,8 @@ func Test_start_pipeline_last_with_prefix_name(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -4833,8 +4833,8 @@ func Test_start_pipeline_with_prefix_name(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -5222,8 +5222,8 @@ func Test_lastPipelineRun(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonRunning.String(), @@ -5245,8 +5245,8 @@ func Test_lastPipelineRun(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.PipelineRunReasonFailed.String(), @@ -5268,8 +5268,8 @@ func Test_lastPipelineRun(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), diff --git a/pkg/cmd/pipelinerun/cancel_test.go b/pkg/cmd/pipelinerun/cancel_test.go index 0f6a910b18..e7100cb7f8 100644 --- a/pkg/cmd/pipelinerun/cancel_test.go +++ b/pkg/cmd/pipelinerun/cancel_test.go @@ -29,7 +29,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" k8stest "k8s.io/client-go/testing" "knative.dev/pkg/apis" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func Test_cancel_invalid_namespace(t *testing.T) { @@ -129,8 +129,8 @@ func Test_cancel_pipelinerun_v1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Type: apis.ConditionReady, @@ -297,8 +297,8 @@ func Test_finished_pipelinerun_success_v1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -382,8 +382,8 @@ func Test_finished_pipelinerun_failure_v1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Type: apis.ConditionSucceeded, @@ -467,8 +467,8 @@ func Test_finished_pipelinerun_cancel_v1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: "PipelineRunCancelled", @@ -552,8 +552,8 @@ func Test_finished_pipelinerun_timeout_v1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.PipelineRunReasonTimedOut.String(), @@ -637,8 +637,8 @@ func Test_finished_pipelinerun_cancelled(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: "Cancelled", @@ -722,8 +722,8 @@ func Test_cancel_pipelinerun_with_grace_stopped(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Type: apis.ConditionReady, @@ -807,8 +807,8 @@ func Test_cancel_pipelinerun_with_grace_cancelled(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Type: apis.ConditionReady, diff --git a/pkg/cmd/pipelinerun/delete_test.go b/pkg/cmd/pipelinerun/delete_test.go index a1220cb268..0c8cc85d8e 100644 --- a/pkg/cmd/pipelinerun/delete_test.go +++ b/pkg/cmd/pipelinerun/delete_test.go @@ -29,7 +29,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/dynamic" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestPipelineRunDelete(t *testing.T) { @@ -68,8 +68,8 @@ func TestPipelineRunDelete(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -97,8 +97,8 @@ func TestPipelineRunDelete(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -126,8 +126,8 @@ func TestPipelineRunDelete(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -170,8 +170,8 @@ func TestPipelineRunDelete(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonPending.String(), @@ -194,8 +194,8 @@ func TestPipelineRunDelete(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonRunning.String(), @@ -221,8 +221,8 @@ func TestPipelineRunDelete(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Reason: v1beta1.PipelineRunReasonPending.String(), diff --git a/pkg/cmd/pipelinerun/describe_test.go b/pkg/cmd/pipelinerun/describe_test.go index 7f17e4635b..49b3a25dd4 100644 --- a/pkg/cmd/pipelinerun/describe_test.go +++ b/pkg/cmd/pipelinerun/describe_test.go @@ -31,7 +31,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/selection" "knative.dev/pkg/apis" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestPipelineRunDescribe_invalid_namespace(t *testing.T) { @@ -96,8 +96,8 @@ func TestPipelineRunDescribe_only_taskrun(t *testing.T) { StartTime: &metav1.Time{Time: clock.Now().Add(2 * time.Minute)}, CompletionTime: &metav1.Time{Time: clock.Now().Add(5 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -130,8 +130,8 @@ func TestPipelineRunDescribe_only_taskrun(t *testing.T) { StartTime: &metav1.Time{Time: clock.Now()}, CompletionTime: &metav1.Time{Time: clock.Now().Add(5 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -188,8 +188,8 @@ func TestPipelineRunDescribe_multiple_taskrun_ordering(t *testing.T) { StartTime: &metav1.Time{Time: clock.Now().Add(2 * time.Minute)}, CompletionTime: &metav1.Time{Time: clock.Now().Add(5 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -208,8 +208,8 @@ func TestPipelineRunDescribe_multiple_taskrun_ordering(t *testing.T) { StartTime: &metav1.Time{Time: clock.Now().Add(5 * time.Minute)}, CompletionTime: &metav1.Time{Time: clock.Now().Add(9 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -243,8 +243,8 @@ func TestPipelineRunDescribe_multiple_taskrun_ordering(t *testing.T) { StartTime: &metav1.Time{Time: clock.Now()}, CompletionTime: &metav1.Time{Time: clock.Now().Add(15 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -303,8 +303,8 @@ func TestPipelineRunDescribe_multiple_taskrun_without_status(t *testing.T) { StartTime: &metav1.Time{Time: clock.Now().Add(2 * time.Minute)}, CompletionTime: &metav1.Time{Time: clock.Now().Add(5 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -338,8 +338,8 @@ func TestPipelineRunDescribe_multiple_taskrun_without_status(t *testing.T) { StartTime: &metav1.Time{Time: clock.Now()}, CompletionTime: &metav1.Time{Time: clock.Now().Add(5 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.PipelineRunReasonFailed.String(), @@ -396,8 +396,8 @@ func TestPipelineRunDescribe_failed(t *testing.T) { StartTime: &metav1.Time{Time: clock.Now().Add(2 * time.Minute)}, CompletionTime: &metav1.Time{Time: clock.Now().Add(5 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.PipelineRunReasonFailed.String(), @@ -432,8 +432,8 @@ func TestPipelineRunDescribe_failed(t *testing.T) { StartTime: &metav1.Time{Time: clock.Now()}, CompletionTime: &metav1.Time{Time: clock.Now().Add(5 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: "Resource not found", @@ -548,8 +548,8 @@ func TestPipelineRunDescribe_failed_withoutTRCondition(t *testing.T) { StartTime: &metav1.Time{Time: clock.Now()}, CompletionTime: &metav1.Time{Time: clock.Now().Add(5 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: "Resource not found", @@ -684,8 +684,8 @@ func TestPipelineRunDescribe_with_resources_taskrun(t *testing.T) { StartTime: &metav1.Time{Time: clock.Now().Add(2 * time.Minute)}, CompletionTime: &metav1.Time{Time: clock.Now().Add(5 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -736,8 +736,8 @@ func TestPipelineRunDescribe_with_resources_taskrun(t *testing.T) { StartTime: &metav1.Time{Time: clock.Now()}, CompletionTime: &metav1.Time{Time: clock.Now().Add(5 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -929,8 +929,8 @@ func TestPipelineRunDescribe_no_resourceref(t *testing.T) { StartTime: &metav1.Time{Time: clock.Now().Add(2 * time.Minute)}, CompletionTime: &metav1.Time{Time: clock.Now().Add(5 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -978,8 +978,8 @@ func TestPipelineRunDescribe_no_resourceref(t *testing.T) { StartTime: &metav1.Time{Time: clock.Now()}, CompletionTime: &metav1.Time{Time: clock.Now().Add(5 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -1036,8 +1036,8 @@ func TestPipelineRunDescribe_cancelled_pipelinerun(t *testing.T) { StartTime: &metav1.Time{Time: clock.Now().Add(2 * time.Minute)}, CompletionTime: &metav1.Time{Time: clock.Now().Add(5 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -1070,8 +1070,8 @@ func TestPipelineRunDescribe_cancelled_pipelinerun(t *testing.T) { StartTime: &metav1.Time{Time: clock.Now()}, CompletionTime: &metav1.Time{Time: clock.Now().Add(5 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: "PipelineRunCancelled", @@ -1125,8 +1125,8 @@ func TestPipelineRunDescribe_without_tr_start_time(t *testing.T) { Namespace: "ns", }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Type: apis.ConditionReady, @@ -1158,8 +1158,8 @@ func TestPipelineRunDescribe_without_tr_start_time(t *testing.T) { }, StartTime: &metav1.Time{Time: clock.Now()}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Reason: v1beta1.PipelineRunReasonRunning.String(), @@ -1306,8 +1306,8 @@ func TestPipelineRunDescribeV1beta1(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.PipelineRunReasonFailed.String(), @@ -1332,8 +1332,8 @@ func TestPipelineRunDescribeV1beta1(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -1390,8 +1390,8 @@ func TestPipelineRunDescribeV1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -1463,8 +1463,8 @@ func TestPipelineRunDescribeV1beta1_taskrun_with_no_status(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.PipelineRunReasonFailed.String(), @@ -1533,8 +1533,8 @@ func TestPipelineRunDescribeV1beta1_taskrun_with_no_status(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -1606,8 +1606,8 @@ func TestPipelineRunDescribe_lastV1beta1(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.PipelineRunReasonFailed.String(), @@ -1632,8 +1632,8 @@ func TestPipelineRunDescribe_lastV1beta1(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -1690,8 +1690,8 @@ func TestPipelineRunDescribe_lastV1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -1756,8 +1756,8 @@ func TestPipelineRunDescribe_lastV1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -1830,8 +1830,8 @@ func TestPipelineRunDescribe_v1beta1_with_results(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.PipelineRunReasonFailed.String(), @@ -1875,8 +1875,8 @@ func TestPipelineRunDescribe_v1beta1_with_results(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -2007,8 +2007,8 @@ func TestPipelineRunDescribe_v1beta1_with_workspaces(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.PipelineRunReasonFailed.String(), @@ -2072,8 +2072,8 @@ func TestPipelineRunDescribe_v1beta1_with_workspaces(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -2195,8 +2195,8 @@ func TestPipelineRunDescribeWithSkippedTasksV1beta1(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.PipelineRunReasonFailed.String(), @@ -2221,8 +2221,8 @@ func TestPipelineRunDescribeWithSkippedTasksV1beta1(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -2279,8 +2279,8 @@ func TestPipelineRunDescribeWithSkippedTasksV1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -2382,8 +2382,8 @@ func TestPipelineRunDescribe_cancelled_pipelinerun_multiple_taskrun(t *testing.T StartTime: &metav1.Time{Time: clock.Now().Add(1 * time.Minute)}, CompletionTime: &metav1.Time{Time: clock.Now().Add(3 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Type: apis.ConditionSucceeded, @@ -2404,8 +2404,8 @@ func TestPipelineRunDescribe_cancelled_pipelinerun_multiple_taskrun(t *testing.T StartTime: &metav1.Time{Time: clock.Now().Add(2 * time.Minute)}, CompletionTime: &metav1.Time{Time: clock.Now().Add(4 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Type: apis.ConditionSucceeded, @@ -2441,8 +2441,8 @@ func TestPipelineRunDescribe_cancelled_pipelinerun_multiple_taskrun(t *testing.T StartTime: &metav1.Time{Time: clock.Now()}, CompletionTime: &metav1.Time{Time: clock.Now().Add(5 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: "PipelineRunCancelled", @@ -2503,8 +2503,8 @@ func TestPipelineRunDescribeWithTimeouts(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.PipelineRunReasonFailed.String(), @@ -2529,8 +2529,8 @@ func TestPipelineRunDescribeWithTimeouts(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -2591,8 +2591,8 @@ func TestPipelineRunDescribeWithTimeouts(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), diff --git a/pkg/cmd/pipelinerun/list_test.go b/pkg/cmd/pipelinerun/list_test.go index f3fc982083..5cabfdd85f 100644 --- a/pkg/cmd/pipelinerun/list_test.go +++ b/pkg/cmd/pipelinerun/list_test.go @@ -31,7 +31,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/dynamic" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestListPipelineRuns_v1beta1(t *testing.T) { @@ -58,8 +58,8 @@ func TestListPipelineRuns_v1beta1(t *testing.T) { Labels: map[string]string{"tekton.dev/pipeline": "pipeline"}, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -79,8 +79,8 @@ func TestListPipelineRuns_v1beta1(t *testing.T) { Labels: map[string]string{"tekton.dev/pipeline": "random"}, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonRunning.String(), @@ -99,8 +99,8 @@ func TestListPipelineRuns_v1beta1(t *testing.T) { Labels: map[string]string{"tekton.dev/pipeline": "random", "viva": "galapagos"}, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.PipelineRunReasonFailed.String(), diff --git a/pkg/cmd/pipelinerun/logs_test.go b/pkg/cmd/pipelinerun/logs_test.go index 2e875ec30e..22441f3456 100644 --- a/pkg/cmd/pipelinerun/logs_test.go +++ b/pkg/cmd/pipelinerun/logs_test.go @@ -36,7 +36,7 @@ import ( "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/dynamic" "knative.dev/pkg/apis" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) const ( @@ -137,8 +137,8 @@ func TestLog_run_found(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -187,8 +187,8 @@ func TestLog_run_not_found(t *testing.T) { Labels: map[string]string{"tekton.dev/pipeline": "output-pipeline-1"}, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -268,8 +268,8 @@ func TestPipelinerunLogs(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -311,8 +311,8 @@ func TestPipelinerunLogs(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -377,8 +377,8 @@ func TestPipelinerunLogs(t *testing.T) { }, }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -609,8 +609,8 @@ func TestPipelinerunLog_completed_taskrun_only_v1beta1(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -693,8 +693,8 @@ func TestPipelinerunLog_completed_taskrun_only_v1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonRunning.String(), @@ -706,7 +706,7 @@ func TestPipelinerunLog_completed_taskrun_only_v1beta1(t *testing.T) { tr1Name: { PipelineTaskName: task1Name, Status: &v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{}, + Status: duckv1.Status{}, TaskRunStatusFields: v1beta1.TaskRunStatusFields{ StartTime: &metav1.Time{Time: tr1StartTime}, CompletionTime: &metav1.Time{Time: tr1CompletionTime}, @@ -788,8 +788,8 @@ func TestPipelinerunLog_completed_taskrun_only_v1beta1(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -835,8 +835,8 @@ func TestPipelinerunLog_completed_taskrun_only_v1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonRunning.String(), @@ -848,7 +848,7 @@ func TestPipelinerunLog_completed_taskrun_only_v1beta1(t *testing.T) { "output-taskrun2": { PipelineTaskName: "output-task2", Status: &v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{}, + Status: duckv1.Status{}, TaskRunStatusFields: v1beta1.TaskRunStatusFields{ StartTime: &metav1.Time{Time: tr1StartTime}, CompletionTime: &metav1.Time{Time: tr1CompletionTime}, @@ -1018,8 +1018,8 @@ func TestPipelinerunLog_follow_mode_v1beta1(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -1066,8 +1066,8 @@ func TestPipelinerunLog_follow_mode_v1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonRunning.String(), @@ -1208,8 +1208,8 @@ func TestLogs_error_log_v1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Message: errMsg, @@ -1287,8 +1287,8 @@ func TestLogs_nologs_v1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Message: "Running", @@ -1366,8 +1366,8 @@ func TestLog_run_failed_with_and_without_follow_v1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Type: apis.ConditionSucceeded, Status: corev1.ConditionFalse, @@ -1454,8 +1454,8 @@ func TestLog_pipelinerun_still_running_v1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Type: apis.ConditionSucceeded, @@ -1479,8 +1479,8 @@ func TestLog_pipelinerun_still_running_v1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Type: apis.ConditionSucceeded, @@ -1501,8 +1501,8 @@ func TestLog_pipelinerun_still_running_v1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -1585,8 +1585,8 @@ func TestLog_pipelinerun_status_done_v1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Type: apis.ConditionSucceeded, Status: corev1.ConditionUnknown, @@ -1706,8 +1706,8 @@ func TestLog_pipelinerun_last_v1beta1(t *testing.T) { PipelineRunStatusFields: v1beta1.PipelineRunStatusFields{ StartTime: &pr2StartTime, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Type: apis.ConditionSucceeded, Status: corev1.ConditionUnknown, @@ -1732,8 +1732,8 @@ func TestLog_pipelinerun_last_v1beta1(t *testing.T) { PipelineRunStatusFields: v1beta1.PipelineRunStatusFields{ StartTime: &pr1StartTime, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Type: apis.ConditionSucceeded, Status: corev1.ConditionUnknown, @@ -1821,8 +1821,8 @@ func TestLog_pipelinerun_only_one_v1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Type: apis.ConditionSucceeded, Status: corev1.ConditionUnknown, @@ -1903,8 +1903,8 @@ func TestPipelinerunLog_finally_v1beta1(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -1939,8 +1939,8 @@ func TestPipelinerunLog_finally_v1beta1(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -1979,8 +1979,8 @@ func TestPipelinerunLog_finally_v1beta1(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonRunning.String(), diff --git a/pkg/cmd/task/delete_test.go b/pkg/cmd/task/delete_test.go index 20f9c6c840..0d5a36ecc0 100644 --- a/pkg/cmd/task/delete_test.go +++ b/pkg/cmd/task/delete_test.go @@ -29,7 +29,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/dynamic" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestTaskDelete(t *testing.T) { @@ -73,8 +73,8 @@ func TestTaskDelete(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -96,8 +96,8 @@ func TestTaskDelete(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -122,8 +122,8 @@ func TestTaskDelete(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), diff --git a/pkg/cmd/task/describe_test.go b/pkg/cmd/task/describe_test.go index 3a1fc52edf..78cff37e6c 100644 --- a/pkg/cmd/task/describe_test.go +++ b/pkg/cmd/task/describe_test.go @@ -32,7 +32,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" k8stest "k8s.io/client-go/testing" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestTaskDescribe_Invalid_Namespace(t *testing.T) { @@ -493,8 +493,8 @@ func TestTaskDescribe_Full(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.TaskRunReasonFailed.String(), @@ -520,8 +520,8 @@ func TestTaskDescribe_Full(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -547,8 +547,8 @@ func TestTaskDescribe_Full(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.TaskRunReasonFailed.String(), diff --git a/pkg/cmd/task/logs_test.go b/pkg/cmd/task/logs_test.go index 1852125a14..fc963d1796 100644 --- a/pkg/cmd/task/logs_test.go +++ b/pkg/cmd/task/logs_test.go @@ -34,7 +34,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/dynamic" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func init() { @@ -212,8 +212,8 @@ func TestTaskLogInteractive(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -248,8 +248,8 @@ func TestTaskLogInteractive(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -328,8 +328,8 @@ func TestTaskLogInteractive(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -682,8 +682,8 @@ func TestLogs_Auto_Select_FirstTask(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), diff --git a/pkg/cmd/taskrun/cancel_test.go b/pkg/cmd/taskrun/cancel_test.go index b1be786a0b..39ab633221 100644 --- a/pkg/cmd/taskrun/cancel_test.go +++ b/pkg/cmd/taskrun/cancel_test.go @@ -28,7 +28,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/dynamic" k8stest "k8s.io/client-go/testing" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestTaskRunCancel(t *testing.T) { @@ -45,8 +45,8 @@ func TestTaskRunCancel(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Reason: v1beta1.TaskRunReasonRunning.String(), @@ -67,8 +67,8 @@ func TestTaskRunCancel(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -89,8 +89,8 @@ func TestTaskRunCancel(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.TaskRunReasonTimedOut.String(), @@ -114,8 +114,8 @@ func TestTaskRunCancel(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Reason: v1beta1.TaskRunReasonFailed.String(), @@ -139,8 +139,8 @@ func TestTaskRunCancel(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.TaskRunReasonCancelled.String(), diff --git a/pkg/cmd/taskrun/delete_test.go b/pkg/cmd/taskrun/delete_test.go index 23522ae7ef..88c2cf7b32 100644 --- a/pkg/cmd/taskrun/delete_test.go +++ b/pkg/cmd/taskrun/delete_test.go @@ -29,7 +29,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/dynamic" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestTaskRunDelete(t *testing.T) { @@ -79,8 +79,8 @@ func TestTaskRunDelete(t *testing.T) { Time: clock.Now().Add(10 * time.Minute), }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -107,8 +107,8 @@ func TestTaskRunDelete(t *testing.T) { Time: clock.Now().Add(10 * time.Minute), }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -135,8 +135,8 @@ func TestTaskRunDelete(t *testing.T) { Time: clock.Now().Add(10 * time.Minute), }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -163,8 +163,8 @@ func TestTaskRunDelete(t *testing.T) { Time: clock.Now().Add(10 * time.Minute), }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -191,8 +191,8 @@ func TestTaskRunDelete(t *testing.T) { Time: clock.Now().Add(10 * time.Minute), }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -219,8 +219,8 @@ func TestTaskRunDelete(t *testing.T) { Time: clock.Now().Add(10 * time.Minute), }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -248,8 +248,8 @@ func TestTaskRunDelete(t *testing.T) { Time: time.Now(), }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -277,8 +277,8 @@ func TestTaskRunDelete(t *testing.T) { Time: time.Now(), }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -306,8 +306,8 @@ func TestTaskRunDelete(t *testing.T) { Time: time.Now(), }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -332,8 +332,8 @@ func TestTaskRunDelete(t *testing.T) { TaskRunStatusFields: v1beta1.TaskRunStatusFields{ CompletionTime: nil, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Reason: v1beta1.TaskRunReasonStarted.String(), @@ -358,8 +358,8 @@ func TestTaskRunDelete(t *testing.T) { TaskRunStatusFields: v1beta1.TaskRunStatusFields{ CompletionTime: nil, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Reason: v1beta1.TaskRunReasonRunning.String(), @@ -384,8 +384,8 @@ func TestTaskRunDelete(t *testing.T) { TaskRunStatusFields: v1beta1.TaskRunStatusFields{ CompletionTime: nil, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Reason: v1beta1.TaskRunReasonStarted.String(), @@ -410,8 +410,8 @@ func TestTaskRunDelete(t *testing.T) { TaskRunStatusFields: v1beta1.TaskRunStatusFields{ CompletionTime: nil, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Reason: v1beta1.TaskRunReasonRunning.String(), @@ -436,8 +436,8 @@ func TestTaskRunDelete(t *testing.T) { TaskRunStatusFields: v1beta1.TaskRunStatusFields{ CompletionTime: nil, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Reason: "ExceededResourceQuota", @@ -934,8 +934,8 @@ func Test_ClusterTask_TaskRuns_Not_Deleted_With_Task_Option(t *testing.T) { Time: time.Now(), }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -968,8 +968,8 @@ func Test_ClusterTask_TaskRuns_Not_Deleted_With_Task_Option(t *testing.T) { Time: time.Now(), }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -1059,8 +1059,8 @@ func Test_Task_TaskRuns_Not_Deleted_With_ClusterTask_Option(t *testing.T) { Time: time.Now(), }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -1093,8 +1093,8 @@ func Test_Task_TaskRuns_Not_Deleted_With_ClusterTask_Option(t *testing.T) { Time: time.Now(), }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -1187,8 +1187,8 @@ func Test_TaskRuns_Delete_With_Running_PipelineRun(t *testing.T) { Time: time.Now(), }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -1226,8 +1226,8 @@ func Test_TaskRuns_Delete_With_Running_PipelineRun(t *testing.T) { Time: time.Now(), }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Reason: v1beta1.TaskRunReasonRunning.String(), @@ -1252,8 +1252,8 @@ func Test_TaskRuns_Delete_With_Running_PipelineRun(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonRunning.String(), diff --git a/pkg/cmd/taskrun/describe_test.go b/pkg/cmd/taskrun/describe_test.go index bf69fe9ce1..a304c9470b 100644 --- a/pkg/cmd/taskrun/describe_test.go +++ b/pkg/cmd/taskrun/describe_test.go @@ -30,7 +30,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "knative.dev/pkg/apis" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) var ( @@ -109,8 +109,8 @@ func TestTaskRunDescribe_empty_taskrun(t *testing.T) { Timeout: &metav1.Duration{Duration: 1 * time.Hour}, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -184,8 +184,8 @@ func TestTaskRunDescribe_only_taskrun(t *testing.T) { }, }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -293,8 +293,8 @@ func TestTaskRunDescribe_failed(t *testing.T) { Namespace: "ns", }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.TaskRunReasonFailed.String(), @@ -363,8 +363,8 @@ func TestTaskRunDescribe_no_taskref(t *testing.T) { StartTime: &metav1.Time{Time: clock.Now().Add(2 * time.Minute)}, CompletionTime: &metav1.Time{Time: clock.Now().Add(5 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.TaskRunReasonFailed.String(), @@ -473,8 +473,8 @@ func TestTaskRunDescribe_no_resourceref(t *testing.T) { }, }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -602,8 +602,8 @@ func TestTaskRunDescribe_step_sidecar_status_defaults_and_failures(t *testing.T) }, }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.TaskRunReasonFailed.String(), @@ -733,8 +733,8 @@ func TestTaskRunDescribe_step_status_pending_one_sidecar(t *testing.T) { }, }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Type: apis.ConditionSucceeded, @@ -873,8 +873,8 @@ func TestTaskRunDescribe_step_status_running_multiple_sidecars(t *testing.T) { }, }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Type: apis.ConditionSucceeded, @@ -978,8 +978,8 @@ func TestTaskRunDescribe_cancel_taskrun(t *testing.T) { StartTime: &metav1.Time{Time: clock.Now().Add(2 * time.Minute)}, CompletionTime: &metav1.Time{Time: clock.Now().Add(5 * time.Minute)}, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: "TaskRunCancelled", @@ -1135,8 +1135,8 @@ func TestTaskRunDescribe_last(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.TaskRunReasonFailed.String(), @@ -1161,8 +1161,8 @@ func TestTaskRunDescribe_last(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -1220,8 +1220,8 @@ func TestTaskRunDescribe_With_Results(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.TaskRunReasonFailed.String(), @@ -1358,8 +1358,8 @@ func TestTaskRunDescribe_With_Workspaces(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.TaskRunReasonFailed.String(), @@ -1433,8 +1433,8 @@ func TestTaskRunDescribe_WithoutNameIfOnlyOneTaskRunPresent(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.TaskRunReasonFailed.String(), diff --git a/pkg/cmd/taskrun/list_test.go b/pkg/cmd/taskrun/list_test.go index 9aa469504c..33603effcf 100644 --- a/pkg/cmd/taskrun/list_test.go +++ b/pkg/cmd/taskrun/list_test.go @@ -31,7 +31,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/dynamic" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestListTaskRuns(t *testing.T) { @@ -53,8 +53,8 @@ func TestListTaskRuns(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -76,8 +76,8 @@ func TestListTaskRuns(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -103,8 +103,8 @@ func TestListTaskRuns(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Reason: v1beta1.TaskRunReasonRunning.String(), @@ -129,8 +129,8 @@ func TestListTaskRuns(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.TaskRunReasonFailed.String(), @@ -156,8 +156,8 @@ func TestListTaskRuns(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.TaskRunReasonFailed.String(), @@ -179,8 +179,8 @@ func TestListTaskRuns(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.TaskRunReasonFailed.String(), @@ -205,8 +205,8 @@ func TestListTaskRuns(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -228,8 +228,8 @@ func TestListTaskRuns(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -251,8 +251,8 @@ func TestListTaskRuns(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), diff --git a/pkg/cmd/taskrun/logs_test.go b/pkg/cmd/taskrun/logs_test.go index 33a3495249..c9636b06dd 100644 --- a/pkg/cmd/taskrun/logs_test.go +++ b/pkg/cmd/taskrun/logs_test.go @@ -37,7 +37,7 @@ import ( "k8s.io/client-go/dynamic" k8stest "k8s.io/client-go/testing" "knative.dev/pkg/apis" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) const ( @@ -115,8 +115,8 @@ func TestLog_no_taskrun_arg(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -317,8 +317,8 @@ func TestLog_taskrun_logs(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Type: apis.ConditionSucceeded, Status: corev1.ConditionTrue, @@ -444,8 +444,8 @@ func TestLog_taskrun_logs_no_pod_name(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Type: apis.ConditionSucceeded, Status: corev1.ConditionTrue, @@ -536,8 +536,8 @@ func TestLog_taskrun_all_steps(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Type: apis.ConditionSucceeded, Status: corev1.ConditionTrue, @@ -680,8 +680,8 @@ func TestLog_taskrun_given_steps(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Type: apis.ConditionSucceeded, Status: corev1.ConditionTrue, @@ -821,8 +821,8 @@ func TestLog_taskrun_follow_mode(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Type: apis.ConditionSucceeded, Status: corev1.ConditionTrue, @@ -964,8 +964,8 @@ func TestLog_taskrun_last(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Type: apis.ConditionSucceeded, Status: corev1.ConditionTrue, @@ -1007,8 +1007,8 @@ func TestLog_taskrun_last(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Type: apis.ConditionSucceeded, Status: corev1.ConditionTrue, @@ -1104,8 +1104,8 @@ func TestLog_taskrun_follow_mode_no_pod_name(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Type: apis.ConditionSucceeded, Status: corev1.ConditionTrue, @@ -1244,8 +1244,8 @@ func TestLog_taskrun_follow_mode_update_pod_name(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Type: apis.ConditionSucceeded, Status: corev1.ConditionUnknown, @@ -1397,8 +1397,8 @@ func TestLog_taskrun_follow_mode_update_timeout(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Type: apis.ConditionSucceeded, Status: corev1.ConditionUnknown, @@ -1545,8 +1545,8 @@ func TestLog_taskrun_follow_mode_no_output_provided(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: v1beta1.TaskRunReasonFailed.String(), diff --git a/pkg/formatted/k8s.go b/pkg/formatted/k8s.go index 57a87c05a4..00cfb0d439 100644 --- a/pkg/formatted/k8s.go +++ b/pkg/formatted/k8s.go @@ -20,7 +20,7 @@ import ( "github.com/fatih/color" corev1 "k8s.io/api/core/v1" - "knative.dev/pkg/apis/duck/v1beta1" + v1 "knative.dev/pkg/apis/duck/v1" ) var ConditionColor = map[string]color.Attribute{ @@ -52,7 +52,7 @@ func AutoStepName(stepName string) string { } // Condition returns a human readable text based on the status of the Condition -func Condition(c v1beta1.Conditions) string { +func Condition(c v1.Conditions) string { var status string if len(c) == 0 { return "---" diff --git a/pkg/formatted/k8s_test.go b/pkg/formatted/k8s_test.go index d3b12feebd..623b2db2a1 100644 --- a/pkg/formatted/k8s_test.go +++ b/pkg/formatted/k8s_test.go @@ -1,3 +1,17 @@ +// Copyright © 2022 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 formatted import ( @@ -7,7 +21,7 @@ import ( "gotest.tools/v3/assert" corev1 "k8s.io/api/core/v1" "knative.dev/pkg/apis" - "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestColor(t *testing.T) { @@ -32,7 +46,7 @@ func TestAutoStepName(t *testing.T) { func TestCondition(t *testing.T) { tests := []struct { name string - condition v1beta1.Conditions + condition duckv1.Conditions want string }{ { diff --git a/pkg/log/pipeline_reader.go b/pkg/log/pipeline_reader.go index 331c302500..4628cbc719 100644 --- a/pkg/log/pipeline_reader.go +++ b/pkg/log/pipeline_reader.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/runtime" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func (r *Reader) readPipelineLog() (<-chan Log, <-chan error, error) { @@ -234,14 +234,14 @@ func empty(status v1beta1.PipelineRunStatus) bool { return len(status.Conditions) == 0 } -func hasPipelineRunFailed(prConditions duckv1beta1.Conditions) error { +func hasPipelineRunFailed(prConditions duckv1.Conditions) error { if len(prConditions) != 0 && prConditions[0].Status == corev1.ConditionFalse { return fmt.Errorf("pipelinerun has failed: %s", prConditions[0].Message) } return nil } -func isPipelineRunRunning(prConditions duckv1beta1.Conditions) bool { +func isPipelineRunRunning(prConditions duckv1.Conditions) bool { if len(prConditions) != 0 && prConditions[0].Status == corev1.ConditionUnknown { return true } diff --git a/pkg/pipeline/pipelinelastrun_test.go b/pkg/pipeline/pipelinelastrun_test.go index 4ccb5d371a..7177c4151f 100644 --- a/pkg/pipeline/pipelinelastrun_test.go +++ b/pkg/pipeline/pipelinelastrun_test.go @@ -26,7 +26,7 @@ import ( pipelinetest "github.com/tektoncd/pipeline/test" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestPipelineRunLast_two_run(t *testing.T) { @@ -78,8 +78,8 @@ func TestPipelineRunLast_two_run(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -105,8 +105,8 @@ func TestPipelineRunLast_two_run(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), diff --git a/pkg/pipelinerun/description/description_test.go b/pkg/pipelinerun/description/description_test.go index ca1f759e8b..65b5b67451 100644 --- a/pkg/pipelinerun/description/description_test.go +++ b/pkg/pipelinerun/description/description_test.go @@ -22,7 +22,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "knative.dev/pkg/apis" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestPipelineRefExists_Present(t *testing.T) { @@ -74,8 +74,8 @@ func TestHasFailed_PipelineAndTaskRunFailedMessage(t *testing.T) { Namespace: "ns", }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Type: apis.ConditionSucceeded, @@ -99,8 +99,8 @@ func TestHasFailed_PipelineAndTaskRunFailedMessage(t *testing.T) { "tr-1": {PipelineTaskName: "t-1", Status: &trs[0].Status}, }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: "PipelineRunCancelled", @@ -125,8 +125,8 @@ func TestHasFailed_PipelineFailedMessage(t *testing.T) { Namespace: "ns", }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Type: apis.ConditionSucceeded, @@ -149,8 +149,8 @@ func TestHasFailed_PipelineFailedMessage(t *testing.T) { "tr-1": {PipelineTaskName: "t-1", Status: &trs[0].Status}, }, }, - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionFalse, Reason: "PipelineRunCancelled", diff --git a/pkg/pipelinerun/pipelinerun_test.go b/pkg/pipelinerun/pipelinerun_test.go index 718af1dc8b..9ff7abd389 100644 --- a/pkg/pipelinerun/pipelinerun_test.go +++ b/pkg/pipelinerun/pipelinerun_test.go @@ -32,7 +32,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "knative.dev/pkg/apis" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestPipelineRunsList_with_single_run(t *testing.T) { @@ -53,8 +53,8 @@ func TestPipelineRunsList_with_single_run(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -79,8 +79,8 @@ func TestPipelineRunsList_with_single_run(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -105,8 +105,8 @@ func TestPipelineRunsList_with_single_run(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -201,8 +201,8 @@ func TestPipelineRunGet(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -227,8 +227,8 @@ func TestPipelineRunGet(t *testing.T) { }, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), diff --git a/pkg/pipelinerun/tracker_test.go b/pkg/pipelinerun/tracker_test.go index 0319f43298..b11b58d530 100644 --- a/pkg/pipelinerun/tracker_test.go +++ b/pkg/pipelinerun/tracker_test.go @@ -26,15 +26,14 @@ import ( cb "github.com/tektoncd/cli/pkg/test/builder" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" - pipelinev1beta1test "github.com/tektoncd/pipeline/test" + pipelinetest "github.com/tektoncd/pipeline/test" "github.com/tektoncd/pipeline/test/diff" corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/runtime" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" k8stest "k8s.io/client-go/testing" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestTracker_pipelinerun_complete(t *testing.T) { @@ -154,8 +153,8 @@ func TestTracker_pipelinerun_complete(t *testing.T) { Labels: map[string]string{"tekton.dev/pipeline": prName}, }, Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionUnknown, Reason: v1beta1.PipelineRunReasonRunning.String(), @@ -183,8 +182,8 @@ func TestTracker_pipelinerun_complete(t *testing.T) { pr := &v1beta1.PipelineRun{ Status: v1beta1.PipelineRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.PipelineRunReasonSuccessful.String(), @@ -222,7 +221,7 @@ func TestTracker_pipelinerun_complete(t *testing.T) { }} } - tc := startPipelineRun(t, pipelinev1beta1test.Data{PipelineRuns: initialPR, TaskRuns: taskruns}, pr.Status) + tc := startPipelineRun(t, pipelinetest.Data{PipelineRuns: initialPR, TaskRuns: taskruns}, pr.Status) tracker := NewTracker(pipelineName, ns, tc) if err := actions.InitializeAPIGroupRes(tracker.Tekton.Discovery()); err != nil { t.Errorf("failed to initialize APIGroup Resource") @@ -244,7 +243,7 @@ func taskRunsFor(onlyTasks []string, tracker *Tracker) []trh.Run { return output } -func startPipelineRun(t *testing.T, data pipelinev1beta1test.Data, prStatus ...v1beta1.PipelineRunStatus) versioned.Interface { +func startPipelineRun(t *testing.T, data pipelinetest.Data, prStatus ...v1beta1.PipelineRunStatus) versioned.Interface { cs, _ := test.SeedV1beta1TestData(t, data) // to keep pushing the taskrun over the period(simulate watch) diff --git a/pkg/task/tasklastrun_test.go b/pkg/task/tasklastrun_test.go index 5334800201..d8479114a4 100644 --- a/pkg/task/tasklastrun_test.go +++ b/pkg/task/tasklastrun_test.go @@ -26,7 +26,7 @@ import ( pipelinetest "github.com/tektoncd/pipeline/test" corev1 "k8s.io/api/core/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) const ( @@ -72,8 +72,8 @@ func TestTaskrunLatest_two_run(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -100,8 +100,8 @@ func TestTaskrunLatest_two_run(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -128,8 +128,8 @@ func TestTaskrunLatest_two_run(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -241,8 +241,8 @@ func TestTaskrunLatestForClusterTask_two_run(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -269,8 +269,8 @@ func TestTaskrunLatestForClusterTask_two_run(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -297,8 +297,8 @@ func TestTaskrunLatestForClusterTask_two_run(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -365,8 +365,8 @@ func TestFilterByRef(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -393,8 +393,8 @@ func TestFilterByRef(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), diff --git a/pkg/taskrun/get_test.go b/pkg/taskrun/get_test.go index 4c7a976f04..4bc254fed9 100644 --- a/pkg/taskrun/get_test.go +++ b/pkg/taskrun/get_test.go @@ -26,7 +26,7 @@ import ( pipelinetest "github.com/tektoncd/pipeline/test" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestTaskRunGet(t *testing.T) { @@ -49,8 +49,8 @@ func TestTaskRunGet(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -76,8 +76,8 @@ func TestTaskRunGet(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), diff --git a/pkg/taskrun/list/list_test.go b/pkg/taskrun/list/list_test.go index fc964b9d13..c2f6acd947 100644 --- a/pkg/taskrun/list/list_test.go +++ b/pkg/taskrun/list/list_test.go @@ -26,7 +26,7 @@ import ( pipelinetest "github.com/tektoncd/pipeline/test" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) func TestPipelinesList_GetAllTaskRuns(t *testing.T) { @@ -48,8 +48,8 @@ func TestPipelinesList_GetAllTaskRuns(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), @@ -74,8 +74,8 @@ func TestPipelinesList_GetAllTaskRuns(t *testing.T) { }, }, Status: v1beta1.TaskRunStatus{ - Status: duckv1beta1.Status{ - Conditions: duckv1beta1.Conditions{ + Status: duckv1.Status{ + Conditions: duckv1.Conditions{ { Status: corev1.ConditionTrue, Reason: v1beta1.TaskRunReasonSuccessful.String(), diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/config/default.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/config/default.go index aa7656a1fb..d17e707dcf 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/config/default.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/config/default.go @@ -20,11 +20,14 @@ import ( "fmt" "log" "os" + "reflect" "strconv" + "strings" "time" "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod" corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/util/sets" "sigs.k8s.io/yaml" ) @@ -50,6 +53,7 @@ const ( defaultCloudEventsSinkKey = "default-cloud-events-sink" defaultTaskRunWorkspaceBinding = "default-task-run-workspace-binding" defaultMaxMatrixCombinationsCountKey = "default-max-matrix-combinations-count" + defaultForbiddenEnv = "default-forbidden-env" ) // Defaults holds the default configurations @@ -63,6 +67,7 @@ type Defaults struct { DefaultCloudEventsSink string DefaultTaskRunWorkspaceBinding string DefaultMaxMatrixCombinationsCount int + DefaultForbiddenEnv []string } // GetDefaultsConfigName returns the name of the configmap containing all @@ -91,7 +96,8 @@ func (cfg *Defaults) Equals(other *Defaults) bool { other.DefaultAAPodTemplate.Equals(cfg.DefaultAAPodTemplate) && other.DefaultCloudEventsSink == cfg.DefaultCloudEventsSink && other.DefaultTaskRunWorkspaceBinding == cfg.DefaultTaskRunWorkspaceBinding && - other.DefaultMaxMatrixCombinationsCount == cfg.DefaultMaxMatrixCombinationsCount + other.DefaultMaxMatrixCombinationsCount == cfg.DefaultMaxMatrixCombinationsCount && + reflect.DeepEqual(other.DefaultForbiddenEnv, cfg.DefaultForbiddenEnv) } // NewDefaultsFromMap returns a Config given a map corresponding to a ConfigMap @@ -151,6 +157,14 @@ func NewDefaultsFromMap(cfgMap map[string]string) (*Defaults, error) { } tc.DefaultMaxMatrixCombinationsCount = int(matrixCombinationsCount) } + if defaultForbiddenEnvString, ok := cfgMap[defaultForbiddenEnv]; ok { + tmpString := sets.NewString() + fEnvs := strings.Split(defaultForbiddenEnvString, ",") + for _, fEnv := range fEnvs { + tmpString.Insert(strings.TrimSpace(fEnv)) + } + tc.DefaultForbiddenEnv = tmpString.List() + } return &tc, nil } diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/config/feature_flags.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/config/feature_flags.go index c3e605662a..c83f70f823 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/config/feature_flags.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/config/feature_flags.go @@ -50,6 +50,16 @@ const ( WarnResourceVerificationMode = "warn" // SkipResourceVerificationMode is the value used for "resource-verification-mode" when verification is skipped SkipResourceVerificationMode = "skip" + // ResultExtractionMethodTerminationMessage is the value used for "results-from" as a way to extract results from tasks using kubernetes termination message. + ResultExtractionMethodTerminationMessage = "termination-message" + // ResultExtractionMethodSidecarLogs is the value used for "results-from" as a way to extract results from tasks using sidecar logs. + ResultExtractionMethodSidecarLogs = "sidecar-logs" + // CustomTaskVersionAlpha is the value used for "custom-task-version" when the PipelineRun reconciler should create + // v1alpha1.Runs. + CustomTaskVersionAlpha = "v1alpha1" + // CustomTaskVersionBeta is the value used for "custom-task-version" when the PipelineRun reconciler should create + // v1beta1.CustomRuns. + CustomTaskVersionBeta = "v1beta1" // DefaultDisableAffinityAssistant is the default value for "disable-affinity-assistant". DefaultDisableAffinityAssistant = false // DefaultDisableCredsInit is the default value for "disable-creds-init". @@ -63,7 +73,7 @@ const ( // DefaultEnableTektonOciBundles is the default value for "enable-tekton-oci-bundles". DefaultEnableTektonOciBundles = false // DefaultEnableCustomTasks is the default value for "enable-custom-tasks". - DefaultEnableCustomTasks = false + DefaultEnableCustomTasks = true // DefaultEnableAPIFields is the default value for "enable-api-fields". DefaultEnableAPIFields = StableAPIFields // DefaultSendCloudEventsForRuns is the default value for "send-cloudevents-for-runs". @@ -76,6 +86,12 @@ const ( DefaultResourceVerificationMode = SkipResourceVerificationMode // DefaultEnableProvenanceInStatus is the default value for "enable-provenance-status". DefaultEnableProvenanceInStatus = false + // DefaultResultExtractionMethod is the default value for ResultExtractionMethod + DefaultResultExtractionMethod = ResultExtractionMethodTerminationMessage + // DefaultMaxResultSize is the default value in bytes for the size of a result + DefaultMaxResultSize = 4096 + // DefaultCustomTaskVersion is the default value for "custom-task-version" + DefaultCustomTaskVersion = CustomTaskVersionAlpha disableAffinityAssistantKey = "disable-affinity-assistant" disableCredsInitKey = "disable-creds-init" @@ -90,6 +106,9 @@ const ( enableSpire = "enable-spire" verificationMode = "resource-verification-mode" enableProvenanceInStatus = "enable-provenance-in-status" + resultExtractionMethod = "results-from" + maxResultSize = "max-result-size" + customTaskVersion = "custom-task-version" ) // FeatureFlags holds the features configurations @@ -109,6 +128,9 @@ type FeatureFlags struct { EnableSpire bool ResourceVerificationMode string EnableProvenanceInStatus bool + ResultExtractionMethod string + MaxResultSize int + CustomTaskVersion string } // GetFeatureFlagsConfigName returns the name of the configmap containing all @@ -166,6 +188,15 @@ func NewFeatureFlagsFromMap(cfgMap map[string]string) (*FeatureFlags, error) { if err := setFeature(enableProvenanceInStatus, DefaultEnableProvenanceInStatus, &tc.EnableProvenanceInStatus); err != nil { return nil, err } + if err := setResultExtractionMethod(cfgMap, DefaultResultExtractionMethod, &tc.ResultExtractionMethod); err != nil { + return nil, err + } + if err := setMaxResultSize(cfgMap, DefaultMaxResultSize, &tc.MaxResultSize); err != nil { + return nil, err + } + if err := setCustomTaskVersion(cfgMap, DefaultCustomTaskVersion, &tc.CustomTaskVersion); err != nil { + return nil, err + } // Given that they are alpha features, Tekton Bundles and Custom Tasks should be switched on if // enable-api-fields is "alpha". If enable-api-fields is not "alpha" then fall back to the value of @@ -223,6 +254,57 @@ func setEmbeddedStatus(cfgMap map[string]string, defaultValue string, feature *s return nil } +// setResultExtractionMethod sets the "results-from" flag based on the content of a given map. +// If the feature gate is invalid or missing then an error is returned. +func setResultExtractionMethod(cfgMap map[string]string, defaultValue string, feature *string) error { + value := defaultValue + if cfg, ok := cfgMap[resultExtractionMethod]; ok { + value = strings.ToLower(cfg) + } + switch value { + case ResultExtractionMethodTerminationMessage, ResultExtractionMethodSidecarLogs: + *feature = value + default: + return fmt.Errorf("invalid value for feature flag %q: %q", resultExtractionMethod, value) + } + return nil +} + +// setCustomTaskVersion sets the "custom-task-version" flag based on the content of a given map. +// If the feature gate is invalid or missing then an error is returned. +func setCustomTaskVersion(cfgMap map[string]string, defaultValue string, feature *string) error { + value := defaultValue + if cfg, ok := cfgMap[customTaskVersion]; ok { + value = strings.ToLower(cfg) + } + switch value { + case CustomTaskVersionAlpha, CustomTaskVersionBeta: + *feature = value + default: + return fmt.Errorf("invalid value for feature flag %q: %q", customTaskVersion, value) + } + return nil +} + +// setMaxResultSize sets the "max-result-size" flag based on the content of a given map. +// If the feature gate is invalid or missing then an error is returned. +func setMaxResultSize(cfgMap map[string]string, defaultValue int, feature *int) error { + value := defaultValue + if cfg, ok := cfgMap[maxResultSize]; ok { + v, err := strconv.Atoi(cfg) + if err != nil { + return err + } + value = v + } + // if max limit is > 1.5 MB (CRD limit). + if value >= 1572864 { + return fmt.Errorf("invalid value for feature flag %q: %q. This is exceeding the CRD limit", resultExtractionMethod, value) + } + *feature = value + return nil +} + // setResourceVerificationMode sets the "resource-verification-mode" flag based on the content of a given map. // If the value is invalid or missing then an error is returned. func setResourceVerificationMode(cfgMap map[string]string, defaultValue string, feature *string) error { @@ -254,6 +336,20 @@ func EnableBetaAPIFields(ctx context.Context) context.Context { return setEnableAPIFields(ctx, "beta") } +// CheckEnforceResourceVerificationMode returns true if the ResourceVerificationMode is EnforceResourceVerificationMode +// else returns false +func CheckEnforceResourceVerificationMode(ctx context.Context) bool { + cfg := FromContextOrDefaults(ctx) + return cfg.FeatureFlags.ResourceVerificationMode == EnforceResourceVerificationMode +} + +// CheckWarnResourceVerificationMode returns true if the ResourceVerificationMode is WarnResourceVerificationMode +// else returns false +func CheckWarnResourceVerificationMode(ctx context.Context) bool { + cfg := FromContextOrDefaults(ctx) + return cfg.FeatureFlags.ResourceVerificationMode == WarnResourceVerificationMode +} + func setEnableAPIFields(ctx context.Context, want string) context.Context { featureFlags, _ := NewFeatureFlagsFromMap(map[string]string{ "enable-api-fields": want, 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 0415be8ae1..b6c8c8febd 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 @@ -71,6 +71,11 @@ func (in *Defaults) DeepCopyInto(out *Defaults) { *out = new(pod.AffinityAssistantTemplate) (*in).DeepCopyInto(*out) } + if in.DefaultForbiddenEnv != nil { + in, out := &in.DefaultForbiddenEnv, &out.DefaultForbiddenEnv + *out = make([]string, len(*in)) + copy(*out, *in) + } return } diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/images.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/images.go index e40ebfe563..8c74410e8b 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/images.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/images.go @@ -26,6 +26,8 @@ import ( type Images struct { // EntrypointImage is container image containing our entrypoint binary. EntrypointImage string + // SidecarLogResultsImage is container image containing the binary that fetches results from the steps and logs it to stdout. + SidecarLogResultsImage string // NopImage is the container image used to kill sidecars. NopImage string // GitImage is the container image with Git that we use to implement the Git source step. @@ -55,6 +57,7 @@ func (i Images) Validate() error { v, name string }{ {i.EntrypointImage, "entrypoint-image"}, + {i.SidecarLogResultsImage, "sidecarlogresults-image"}, {i.NopImage, "nop-image"}, {i.GitImage, "git-image"}, {i.KubeconfigWriterImage, "kubeconfig-writer-image"}, diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/pod/template.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/pod/template.go index 2ebfd462a2..2a9f2d7dcb 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/pod/template.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/pod/template.go @@ -32,6 +32,13 @@ type Template struct { // +optional NodeSelector map[string]string `json:"nodeSelector,omitempty"` + // List of environment variables that can be provided to the containers belonging to the pod. + // +optional + // +patchMergeKey=name + // +patchStrategy=merge + // +listType=atomic + Env []corev1.EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,7,rep,name=env"` + // If specified, the pod's tolerations. // +optional // +listType=atomic @@ -164,6 +171,9 @@ func MergePodTemplateWithDefault(tpl, defaultTpl *PodTemplate) *PodTemplate { return defaultTpl default: // Otherwise, merge fields + if tpl.Env == nil { + tpl.Env = defaultTpl.Env + } if tpl.NodeSelector == nil { tpl.NodeSelector = defaultTpl.NodeSelector } diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/pod/zz_generated.deepcopy.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/pod/zz_generated.deepcopy.go index 000cb713d3..450128e3a9 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/pod/zz_generated.deepcopy.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/pod/zz_generated.deepcopy.go @@ -70,6 +70,13 @@ func (in *Template) DeepCopyInto(out *Template) { (*out)[key] = val } } + if in.Env != nil { + in, out := &in.Env, &out.Env + *out = make([]v1.EnvVar, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } if in.Tolerations != nil { in, out := &in.Tolerations, &out.Tolerations *out = make([]v1.Toleration, len(*in)) diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/sidecarlogs.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/sidecarlogs.go new file mode 100644 index 0000000000..a0c570675e --- /dev/null +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/sidecarlogs.go @@ -0,0 +1,27 @@ +/* +Copyright 2022 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 pipeline + +const ( + // ReservedResultsSidecarName is the name of the results sidecar that outputs the results to stdout + // when the results-from feature-flag is set to "sidecar-logs". + ReservedResultsSidecarName = "tekton-log-results" + + // ReservedResultsSidecarContainerName is the name of the results sidecar container that is injected + // by the reconciler. + ReservedResultsSidecarContainerName = "sidecar-tekton-log-results" +) diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go index c3831ed218..edb7dbe8a8 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/container_types.go @@ -22,7 +22,6 @@ import ( // Step runs a subcomponent of a Task type Step struct { - // Name of the Step specified as a DNS_LABEL. // Each Step in a Task must have a unique name. Name string `json:"name" protobuf:"bytes,1,opt,name=name"` @@ -191,7 +190,6 @@ func (s *Step) SetContainerFields(c corev1.Container) { // StepTemplate is a template for a Step type StepTemplate struct { - // Image reference name. // More info: https://kubernetes.io/docs/concepts/containers/images // This field is optional to allow higher level config management to default or override @@ -308,7 +306,6 @@ func (s *StepTemplate) ToK8sContainer() *corev1.Container { // Sidecar has nearly the same data structure as Step but does not have the ability to timeout. type Sidecar struct { - // Name of the Sidecar specified as a DNS_LABEL. // Each Sidecar in a Task must have a unique name (DNS_LABEL). // Cannot be updated. 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 c586cb3b27..b3b1af35f9 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 @@ -186,6 +186,27 @@ func schema_pkg_apis_pipeline_pod_Template(ref common.ReferenceCallback) common. }, }, }, + "env": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "List of environment variables that can be provided to the containers belonging to the pod.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/core/v1.EnvVar"), + }, + }, + }, + }, + }, "tolerations": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ @@ -354,7 +375,7 @@ func schema_pkg_apis_pipeline_pod_Template(ref common.ReferenceCallback) common. }, }, Dependencies: []string{ - "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.HostAlias", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodDNSConfig", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.TopologySpreadConstraint", "k8s.io/api/core/v1.Volume"}, + "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.HostAlias", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodDNSConfig", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.TopologySpreadConstraint", "k8s.io/api/core/v1.Volume"}, } } @@ -1120,7 +1141,7 @@ func schema_pkg_apis_pipeline_v1_PipelineRunRunStatus(ref common.ReferenceCallba "status": { SchemaProps: spec.SchemaProps{ Description: "Status is the RunStatus for the corresponding Run", - Ref: ref("github.com/tektoncd/pipeline/pkg/apis/run/v1alpha1.RunStatus"), + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/run/v1beta1.CustomRunStatus"), }, }, "whenExpressions": { @@ -1146,7 +1167,7 @@ func schema_pkg_apis_pipeline_v1_PipelineRunRunStatus(ref common.ReferenceCallba }, }, Dependencies: []string{ - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.WhenExpression", "github.com/tektoncd/pipeline/pkg/apis/run/v1alpha1.RunStatus"}, + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.WhenExpression", "github.com/tektoncd/pipeline/pkg/apis/run/v1beta1.CustomRunStatus"}, } } @@ -3465,7 +3486,7 @@ func schema_pkg_apis_pipeline_v1_TaskRunSpec(ref common.ReferenceCallback) commo }, "status": { SchemaProps: spec.SchemaProps{ - Description: "Used for cancelling a taskrun (and maybe more later on)", + Description: "Used for cancelling a TaskRun (and maybe more later on)", Type: []string{"string"}, Format: "", }, @@ -3477,9 +3498,16 @@ func schema_pkg_apis_pipeline_v1_TaskRunSpec(ref common.ReferenceCallback) commo Format: "", }, }, + "retries": { + SchemaProps: spec.SchemaProps{ + Description: "Retries represents how many times this TaskRun should be retried in the event of task failure.", + Type: []string{"integer"}, + Format: "int32", + }, + }, "timeout": { SchemaProps: spec.SchemaProps{ - Description: "Time after which the build times out. Defaults to 1 hour. Specified build timeout should be less than 24h. Refer Go's ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration", + Description: "Time after which one retry attempt times out. Defaults to 1 hour. Specified build timeout should be less than 24h. Refer Go's ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration", Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), }, }, 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 6c6da8cc37..dca3f8631d 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 @@ -309,7 +309,6 @@ func taskContainsResult(resultExpression string, pipelineTaskNames sets.String, if strings.HasPrefix(value, "finally") && !pipelineFinallyTaskNames.Has(pipelineTaskName) { return false } - } } return true 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 11f8296395..6fcd7622cb 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 @@ -27,13 +27,13 @@ import ( apisconfig "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline" pod "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod" - runv1alpha1 "github.com/tektoncd/pipeline/pkg/apis/run/v1alpha1" + runv1beta1 "github.com/tektoncd/pipeline/pkg/apis/run/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" "k8s.io/utils/clock" "knative.dev/pkg/apis" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) // +genclient @@ -285,7 +285,7 @@ const ( // PipelineRunStatus defines the observed state of PipelineRun type PipelineRunStatus struct { - duckv1beta1.Status `json:",inline"` + duckv1.Status `json:",inline"` // PipelineRunStatusFields inlines the status fields. PipelineRunStatusFields `json:",inline"` @@ -500,7 +500,7 @@ type PipelineRunRunStatus struct { PipelineTaskName string `json:"pipelineTaskName,omitempty"` // Status is the RunStatus for the corresponding Run // +optional - Status *runv1alpha1.RunStatus `json:"status,omitempty"` + Status *runv1beta1.CustomRunStatus `json:"status,omitempty"` // WhenExpressions is the list of checks guarding the execution of the PipelineTask // +optional // +listType=atomic 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 701ff7d708..76d3417cc0 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 @@ -227,7 +227,6 @@ func validateSpecStatus(status PipelineRunSpecStatus) *apis.FieldError { PipelineRunSpecStatusCancelledRunFinally, PipelineRunSpecStatusStoppedRunFinally, PipelineRunSpecStatusPending), "status") - } func validateTimeoutDuration(field string, d *metav1.Duration) (errs *apis.FieldError) { @@ -291,5 +290,8 @@ func validateTaskRunSpec(ctx context.Context, trs PipelineTaskRunSpec) (errs *ap errs = errs.Also(version.ValidateEnabledAPIFields(ctx, "computeResources", config.AlphaAPIFields).ViaField("computeResources")) errs = errs.Also(validateTaskRunComputeResources(trs.ComputeResources, trs.StepSpecs)) } + if trs.PodTemplate != nil { + errs = errs.Also(validatePodTemplateEnv(ctx, *trs.PodTemplate)) + } return errs } diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/register.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/register.go index b72b5467b5..df1db014d5 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/register.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/register.go @@ -50,8 +50,11 @@ func addKnownTypes(scheme *runtime.Scheme) error { &TaskList{}, &Pipeline{}, &PipelineList{}, - ) // TODO(#4983): v1 types go here - + &TaskRun{}, + &TaskRunList{}, + &PipelineRun{}, + &PipelineRunList{}, + ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil } 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 0960125b90..e45d6f83bb 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 @@ -63,6 +63,17 @@ "description": "EnableServiceLinks indicates whether information about services should be injected into pod's environment variables, matching the syntax of Docker links. Optional: Defaults to true.", "type": "boolean" }, + "env": { + "description": "List of environment variables that can be provided to the containers belonging to the pod.", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/v1.EnvVar" + }, + "x-kubernetes-list-type": "atomic", + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge" + }, "hostAliases": { "description": "HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. This is only valid for non-hostNetwork pods.", "type": "array", @@ -552,7 +563,7 @@ }, "status": { "description": "Status is the RunStatus for the corresponding Run", - "$ref": "#/definitions/github.com.tektoncd.pipeline.pkg.apis.run.v1alpha1.RunStatus" + "$ref": "#/definitions/github.com.tektoncd.pipeline.pkg.apis.run.v1beta1.CustomRunStatus" }, "whenExpressions": { "description": "WhenExpressions is the list of checks guarding the execution of the PipelineTask", @@ -1787,6 +1798,11 @@ "description": "PodTemplate holds pod specific configuration", "$ref": "#/definitions/pod.Template" }, + "retries": { + "description": "Retries represents how many times this TaskRun should be retried in the event of task failure.", + "type": "integer", + "format": "int32" + }, "serviceAccountName": { "type": "string", "default": "" @@ -1801,7 +1817,7 @@ "x-kubernetes-list-type": "atomic" }, "status": { - "description": "Used for cancelling a taskrun (and maybe more later on)", + "description": "Used for cancelling a TaskRun (and maybe more later on)", "type": "string" }, "statusMessage": { @@ -1825,7 +1841,7 @@ "$ref": "#/definitions/v1.TaskSpec" }, "timeout": { - "description": "Time after which the build times out. Defaults to 1 hour. Specified build timeout should be less than 24h. Refer Go's ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration", + "description": "Time after which one retry attempt times out. Defaults to 1 hour. Specified build timeout should be less than 24h. Refer Go's ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration", "$ref": "#/definitions/v1.Duration" }, "workspaces": { diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/task_types.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/task_types.go index 4283e8119c..eca16b7a7d 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/task_types.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/task_types.go @@ -54,7 +54,6 @@ func (*Task) GetGroupVersionKind() schema.GroupVersionKind { // TaskSpec defines the desired state of Task. type TaskSpec struct { - // Params is a list of input parameters required to run the task. Params // must be supplied as inputs in TaskRuns unless they declare a default // value. diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/task_validation.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/task_validation.go index d2ce8de157..9019aefea7 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/task_validation.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/task_validation.go @@ -25,6 +25,7 @@ import ( "time" "github.com/tektoncd/pipeline/pkg/apis/config" + "github.com/tektoncd/pipeline/pkg/apis/pipeline" "github.com/tektoncd/pipeline/pkg/apis/validate" "github.com/tektoncd/pipeline/pkg/apis/version" "github.com/tektoncd/pipeline/pkg/substitution" @@ -92,6 +93,7 @@ func (ts *TaskSpec) Validate(ctx context.Context) (errs *apis.FieldError) { } errs = errs.Also(validateSteps(ctx, mergedSteps).ViaField("steps")) + errs = errs.Also(validateSidecarNames(ts.Sidecars)) errs = errs.Also(ValidateParameterTypes(ctx, ts.Params).ViaField("params")) errs = errs.Also(ValidateParameterVariables(ctx, ts.Steps, ts.Params)) errs = errs.Also(validateTaskContextVariables(ctx, ts.Steps)) @@ -99,6 +101,18 @@ func (ts *TaskSpec) Validate(ctx context.Context) (errs *apis.FieldError) { return errs } +func validateSidecarNames(sidecars []Sidecar) (errs *apis.FieldError) { + for _, sc := range sidecars { + if sc.Name == pipeline.ReservedResultsSidecarName { + errs = errs.Also(&apis.FieldError{ + Message: fmt.Sprintf("Invalid: cannot use reserved sidecar name %v ", sc.Name), + Paths: []string{"sidecars"}, + }) + } + } + return errs +} + func validateResults(ctx context.Context, results []TaskResult) (errs *apis.FieldError) { for index, result := range results { errs = errs.Also(result.Validate(ctx).ViaIndex(index)) @@ -431,7 +445,6 @@ func validateStepObjectUsageAsWhole(step Step, prefix string, vars sets.String) } for i, arg := range step.Args { errs = errs.Also(validateTaskNoObjectReferenced(arg, prefix, vars).ViaFieldIndex("args", i)) - } for _, env := range step.Env { errs = errs.Also(validateTaskNoObjectReferenced(env.Value, prefix, vars).ViaFieldKey("env", env.Name)) @@ -461,7 +474,6 @@ func validateStepArrayUsage(step Step, prefix string, vars sets.String) *apis.Fi } for i, arg := range step.Args { errs = errs.Also(validateTaskArraysIsolated(arg, prefix, vars).ViaFieldIndex("args", i)) - } for _, env := range step.Env { errs = errs.Also(validateTaskNoArrayReferenced(env.Value, prefix, vars).ViaFieldKey("env", env.Name)) diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go index bf29a83642..060823c6cc 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/taskrun_types.go @@ -1,12 +1,9 @@ /* Copyright 2022 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. @@ -48,13 +45,16 @@ type TaskRunSpec struct { TaskRef *TaskRef `json:"taskRef,omitempty"` // +optional TaskSpec *TaskSpec `json:"taskSpec,omitempty"` - // Used for cancelling a taskrun (and maybe more later on) + // Used for cancelling a TaskRun (and maybe more later on) // +optional Status TaskRunSpecStatus `json:"status,omitempty"` // Status message for cancellation. // +optional StatusMessage TaskRunSpecStatusMessage `json:"statusMessage,omitempty"` - // Time after which the build times out. Defaults to 1 hour. + // Retries represents how many times this TaskRun should be retried in the event of task failure. + // +optional + Retries int `json:"retries,omitempty"` + // Time after which one retry attempt times out. Defaults to 1 hour. // Specified build timeout should be less than 24h. // Refer Go's ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration // +optional @@ -83,7 +83,7 @@ type TaskRunSpec struct { ComputeResources *corev1.ResourceRequirements `json:"computeResources,omitempty"` } -// TaskRunSpecStatus defines the taskrun spec status the user can provide +// TaskRunSpecStatus defines the TaskRun spec status the user can provide type TaskRunSpecStatus string const ( @@ -141,9 +141,11 @@ const ( TaskRunReasonSuccessful TaskRunReason = "Succeeded" // TaskRunReasonFailed is the reason set when the TaskRun completed with a failure TaskRunReasonFailed TaskRunReason = "Failed" - // TaskRunReasonCancelled is the reason set when the Taskrun is cancelled by the user + // TaskRunReasonToBeRetried is the reason set when the last TaskRun execution failed, and will be retried + TaskRunReasonToBeRetried TaskRunReason = "ToBeRetried" + // TaskRunReasonCancelled is the reason set when the TaskRun is cancelled by the user TaskRunReasonCancelled TaskRunReason = "TaskRunCancelled" - // TaskRunReasonTimedOut is the reason set when the Taskrun has timed out + // TaskRunReasonTimedOut is the reason set when one TaskRun execution has timed out TaskRunReasonTimedOut TaskRunReason = "TaskRunTimeout" // TaskRunReasonResolvingTaskRef indicates that the TaskRun is waiting for // its taskRef to be asynchronously resolved. @@ -339,7 +341,7 @@ type TaskRunList struct { Items []TaskRun `json:"items"` } -// GetPipelineRunPVCName for taskrun gets pipelinerun +// GetPipelineRunPVCName for TaskRun gets pipelinerun func (tr *TaskRun) GetPipelineRunPVCName() string { if tr == nil { return "" @@ -368,7 +370,7 @@ func (tr *TaskRun) IsDone() bool { return !tr.Status.GetCondition(apis.ConditionSucceeded).IsUnknown() } -// HasStarted function check whether taskrun has valid start time set in its status +// HasStarted function check whether TaskRun has valid start time set in its status func (tr *TaskRun) HasStarted() bool { return tr.Status.StartTime != nil && !tr.Status.StartTime.IsZero() } @@ -383,6 +385,11 @@ func (tr *TaskRun) IsCancelled() bool { return tr.Spec.Status == TaskRunSpecStatusCancelled } +// IsRetriable returns true if the TaskRun's Retries is not exhausted. +func (tr *TaskRun) IsRetriable() bool { + return len(tr.Status.RetriesStatus) < tr.Spec.Retries +} + // HasTimedOut returns true if the TaskRun runtime is beyond the allowed timeout func (tr *TaskRun) HasTimedOut(ctx context.Context, c clock.PassiveClock) bool { if tr.Status.StartTime.IsZero() { 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 21139341e8..cc2e54054d 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 @@ -22,11 +22,13 @@ import ( "strings" "github.com/tektoncd/pipeline/pkg/apis/config" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod" "github.com/tektoncd/pipeline/pkg/apis/validate" "github.com/tektoncd/pipeline/pkg/apis/version" admissionregistrationv1 "k8s.io/api/admissionregistration/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/utils/strings/slices" "knative.dev/pkg/apis" "knative.dev/pkg/webhook/resourcesemantics" ) @@ -105,6 +107,9 @@ func (ts *TaskRunSpec) Validate(ctx context.Context) (errs *apis.FieldError) { } } + if ts.PodTemplate != nil { + errs = errs.Also(validatePodTemplateEnv(ctx, *ts.PodTemplate)) + } return errs } @@ -141,6 +146,19 @@ func (ts *TaskRunSpec) validateInlineParameters(ctx context.Context) (errs *apis return errs } +func validatePodTemplateEnv(ctx context.Context, podTemplate pod.Template) (errs *apis.FieldError) { + forbiddenEnvsConfigured := config.FromContextOrDefaults(ctx).Defaults.DefaultForbiddenEnv + if len(forbiddenEnvsConfigured) == 0 { + return errs + } + for _, pEnv := range podTemplate.Env { + if slices.Contains(forbiddenEnvsConfigured, pEnv.Name) { + errs = errs.Also(apis.ErrInvalidValue("PodTemplate cannot update a forbidden env: "+pEnv.Name, "PodTemplate.Env")) + } + } + return errs +} + func createParamSpecFromParam(p Param, paramSpecForValidation map[string]ParamSpec) map[string]ParamSpec { value := p.Value pSpec := ParamSpec{ 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 ef03a3bb5a..6bf6b61d46 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 @@ -23,7 +23,7 @@ package v1 import ( pod "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod" - v1alpha1 "github.com/tektoncd/pipeline/pkg/apis/run/v1alpha1" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/run/v1beta1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -369,7 +369,7 @@ func (in *PipelineRunRunStatus) DeepCopyInto(out *PipelineRunRunStatus) { *out = *in if in.Status != nil { in, out := &in.Status, &out.Status - *out = new(v1alpha1.RunStatus) + *out = new(v1beta1.CustomRunStatus) (*in).DeepCopyInto(*out) } if in.WhenExpressions != nil { diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/register.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/register.go index 42b5e4b18e..fe5e76f459 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/register.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/register.go @@ -48,6 +48,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &Run{}, &RunList{}, + &VerificationPolicy{}, + &VerificationPolicyList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/run_types.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/run_types.go index d10e2dc3d1..0806ef6cb1 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/run_types.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/run_types.go @@ -263,3 +263,8 @@ func (r *Run) GetTimeout() time.Duration { } return r.Spec.Timeout.Duration } + +// GetRetryCount returns the number of times this Run has already been retried +func (r *Run) GetRetryCount() int { + return len(r.Status.RetriesStatus) +} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/verificationpolicy_defaults.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/verificationpolicy_defaults.go new file mode 100644 index 0000000000..6b18c31866 --- /dev/null +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/verificationpolicy_defaults.go @@ -0,0 +1,30 @@ +/* +Copyright 2020 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 v1alpha1 + +import ( + "context" + + "knative.dev/pkg/apis" +) + +var _ apis.Defaultable = (*VerificationPolicy)(nil) + +// SetDefaults implements apis.Defaultable +func (v *VerificationPolicy) SetDefaults(ctx context.Context) { + +} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/verificationpolicy_types.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/verificationpolicy_types.go new file mode 100644 index 0000000000..8df3774b4b --- /dev/null +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/verificationpolicy_types.go @@ -0,0 +1,117 @@ +/* +Copyright 2022 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 v1alpha1 + +import ( + "crypto" + + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +genclient +// +genclient:noStatus +// +genreconciler:krshapedlogic=false +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VerificationPolicy defines the rules to verify Tekton resources. +// VerificationPolicy can config the mapping from resources to a list of public +// keys, so when verifying the resources we can use the corresponding public keys. +// +k8s:openapi-gen=true +type VerificationPolicy struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata"` + + // Spec holds the desired state of the VerificationPolicy. + Spec VerificationPolicySpec `json:"spec"` +} + +// VerificationPolicyList contains a list of VerificationPolicy +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type VerificationPolicyList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []VerificationPolicy `json:"items"` +} + +// GetGroupVersionKind implements kmeta.OwnerRefable. +func (*VerificationPolicy) GetGroupVersionKind() schema.GroupVersionKind { + return SchemeGroupVersion.WithKind("VerificationPolicy") +} + +// VerificationPolicySpec defines the patterns and authorities. +type VerificationPolicySpec struct { + // Resources defines the patterns of resources sources that should be subject to this policy. + // For example, we may want to apply this Policy from a certain GitHub repo. + // Then the ResourcesPattern should be valid regex. E.g. If using gitresolver, and we want to config keys from a certain git repo. + // `ResourcesPattern` can be `https://github.com/tektoncd/catalog.git`, we will use regex to filter out those resources. + Resources []ResourcePattern `json:"resources"` + // Authorities defines the rules for validating signatures. + Authorities []Authority `json:"authorities"` +} + +// ResourcePattern defines the pattern of the resource source +type ResourcePattern struct { + // Pattern defines a resource pattern. Regex is created to filter resources based on `Pattern` + // Example patterns: + // GitHub resource: https://github.com/tektoncd/catalog.git, https://github.com/tektoncd/* + // Bundle resource: gcr.io/tekton-releases/catalog/upstream/git-clone, gcr.io/tekton-releases/catalog/upstream/* + // Hub resource: https://artifacthub.io/*, + Pattern string `json:"pattern"` +} + +// The Authority block defines the keys for validating signatures. +type Authority struct { + // Name is the name for this authority. + Name string `json:"name"` + // Key contains the public key to validate the resource. + Key *KeyRef `json:"key,omitempty"` +} + +// KeyRef defines the reference to a public key +type KeyRef struct { + // SecretRef sets a reference to a secret with the key. + // +optional + SecretRef *v1.SecretReference `json:"secretRef,omitempty"` + // Data contains the inline public key. + // +optional + Data string `json:"data,omitempty"` + // HashAlgorithm always defaults to sha256 if the algorithm hasn't been explicitly set + // +optional + HashAlgorithm HashAlgorithm `json:"hashAlgorithm,omitempty"` +} + +// HashAlgorithm defines the hash algorithm used for the public key +type HashAlgorithm string + +const ( + sha224 HashAlgorithm = "sha224" + sha256 HashAlgorithm = "sha256" + sha384 HashAlgorithm = "sha384" + sha512 HashAlgorithm = "sha512" + empty HashAlgorithm = "" +) + +// SupportedSignatureAlgorithms sets a list of support signature algorithms that is similar to the list supported by cosign. +// empty HashAlgorithm is allowed and will be set to SHA256. +var SupportedSignatureAlgorithms = map[HashAlgorithm]crypto.Hash{ + sha224: crypto.SHA224, + sha256: crypto.SHA256, + sha384: crypto.SHA384, + sha512: crypto.SHA512, + empty: crypto.SHA256, +} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/verificationpolicy_validation.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/verificationpolicy_validation.go new file mode 100644 index 0000000000..002228a3db --- /dev/null +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/verificationpolicy_validation.go @@ -0,0 +1,93 @@ +/* +Copyright 2022 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 v1alpha1 + +import ( + "context" + "fmt" + "regexp" + "strings" + + "github.com/tektoncd/pipeline/pkg/apis/validate" + "knative.dev/pkg/apis" +) + +var _ apis.Validatable = (*VerificationPolicy)(nil) + +var ( + // InvalidResourcePatternErr is returned when the pattern is not valid regex expression + InvalidResourcePatternErr = "resourcePattern cannot be compiled by regex" +) + +// Validate VerificationPolicy +func (v *VerificationPolicy) Validate(ctx context.Context) (errs *apis.FieldError) { + errs = errs.Also(validate.ObjectMetadata(v.GetObjectMeta()).ViaField("metadata")) + errs = errs.Also(v.Spec.Validate(ctx)) + return errs +} + +// Validate VerificationPolicySpec, the validation requires Resources is not empty, for each +// resource it must be able to be regex expression and can be compiled with no error. The Authorities +// shouldn't be empty and each Authority should be valid. +func (vs *VerificationPolicySpec) Validate(ctx context.Context) (errs *apis.FieldError) { + if len(vs.Resources) == 0 { + errs = errs.Also(apis.ErrMissingField("resources")) + } + for _, r := range vs.Resources { + errs = errs.Also(r.Validate(ctx)) + } + if len(vs.Authorities) == 0 { + errs = errs.Also(apis.ErrMissingField("authorities")) + } + for i, a := range vs.Authorities { + if a.Key != nil { + errs = errs.Also(a.Key.Validate(ctx).ViaFieldIndex("key", i)) + } + } + return errs +} + +// Validate KeyRef will check if one of KeyRef's Data or SecretRef exists, and the +// Supported HashAlgorithm is in supportedSignatureAlgorithms. +func (key *KeyRef) Validate(ctx context.Context) (errs *apis.FieldError) { + if key.Data == "" && key.SecretRef == nil { + errs = errs.Also(apis.ErrMissingOneOf("data", "secretref")) + } + + if key.Data != "" && key.SecretRef != nil { + errs = errs.Also(apis.ErrMultipleOneOf("data", "secretref")) + } + errs = errs.Also(validateHashAlgorithm(key.HashAlgorithm)) + + return errs +} + +// Validate ResourcePattern and make sure the Pattern is valid regex expression +func (r *ResourcePattern) Validate(ctx context.Context) (errs *apis.FieldError) { + if _, err := regexp.Compile(r.Pattern); err != nil { + errs = errs.Also(apis.ErrInvalidValue(r.Pattern, "ResourcePattern", fmt.Sprintf("%v: %v", InvalidResourcePatternErr, err))) + return errs + } + return nil +} + +// validateHashAlgorithm checks if the algorithm is supported +func validateHashAlgorithm(algorithmName HashAlgorithm) (errs *apis.FieldError) { + normalizedAlgo := strings.ToLower(string(algorithmName)) + _, exists := SupportedSignatureAlgorithms[HashAlgorithm(normalizedAlgo)] + if !exists { + return apis.ErrInvalidValue(algorithmName, "HashAlgorithm") + } + return nil +} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go index 47123e63dd..9c0c525459 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go @@ -24,10 +24,32 @@ package v1alpha1 import ( pod "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod" v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Authority) DeepCopyInto(out *Authority) { + *out = *in + if in.Key != nil { + in, out := &in.Key, &out.Key + *out = new(KeyRef) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Authority. +func (in *Authority) DeepCopy() *Authority { + if in == nil { + return nil + } + out := new(Authority) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EmbeddedRunSpec) DeepCopyInto(out *EmbeddedRunSpec) { *out = *in @@ -47,6 +69,43 @@ func (in *EmbeddedRunSpec) DeepCopy() *EmbeddedRunSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeyRef) DeepCopyInto(out *KeyRef) { + *out = *in + if in.SecretRef != nil { + in, out := &in.SecretRef, &out.SecretRef + *out = new(v1.SecretReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeyRef. +func (in *KeyRef) DeepCopy() *KeyRef { + if in == nil { + return nil + } + out := new(KeyRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourcePattern) DeepCopyInto(out *ResourcePattern) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePattern. +func (in *ResourcePattern) DeepCopy() *ResourcePattern { + if in == nil { + return nil + } + out := new(ResourcePattern) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Run) DeepCopyInto(out *Run) { *out = *in @@ -135,7 +194,7 @@ func (in *RunSpec) DeepCopyInto(out *RunSpec) { } if in.Timeout != nil { in, out := &in.Timeout, &out.Timeout - *out = new(v1.Duration) + *out = new(metav1.Duration) **out = **in } if in.Workspaces != nil { @@ -157,3 +216,91 @@ func (in *RunSpec) DeepCopy() *RunSpec { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VerificationPolicy) DeepCopyInto(out *VerificationPolicy) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VerificationPolicy. +func (in *VerificationPolicy) DeepCopy() *VerificationPolicy { + if in == nil { + return nil + } + out := new(VerificationPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VerificationPolicy) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VerificationPolicyList) DeepCopyInto(out *VerificationPolicyList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VerificationPolicy, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VerificationPolicyList. +func (in *VerificationPolicyList) DeepCopy() *VerificationPolicyList { + if in == nil { + return nil + } + out := new(VerificationPolicyList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VerificationPolicyList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VerificationPolicySpec) DeepCopyInto(out *VerificationPolicySpec) { + *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]ResourcePattern, len(*in)) + copy(*out, *in) + } + if in.Authorities != nil { + in, out := &in.Authorities, &out.Authorities + *out = make([]Authority, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VerificationPolicySpec. +func (in *VerificationPolicySpec) DeepCopy() *VerificationPolicySpec { + if in == nil { + return nil + } + out := new(VerificationPolicySpec) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/container_types.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/container_types.go index 624a1c373f..72d738c378 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/container_types.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/container_types.go @@ -7,7 +7,6 @@ import ( // Step runs a subcomponent of a Task type Step struct { - // Name of the Step specified as a DNS_LABEL. // Each Step in a Task must have a unique name. Name string `json:"name" protobuf:"bytes,1,opt,name=name"` @@ -271,7 +270,6 @@ func (s *Step) SetContainerFields(c corev1.Container) { // StepTemplate is a template for a Step type StepTemplate struct { - // Deprecated. This field will be removed in a future release. // Default name for each Step specified as a DNS_LABEL. // Each Step in a Task must have a unique name. @@ -489,7 +487,6 @@ func (s *StepTemplate) ToK8sContainer() *corev1.Container { // Sidecar has nearly the same data structure as Step but does not have the ability to timeout. type Sidecar struct { - // Name of the Sidecar specified as a DNS_LABEL. // Each Sidecar in a Task must have a unique name (DNS_LABEL). // Cannot be updated. diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/customrun_types.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/customrun_types.go index a24f57a1e0..960602003e 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/customrun_types.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/customrun_types.go @@ -256,3 +256,8 @@ func (r *CustomRun) GetTimeout() time.Duration { } return r.Spec.Timeout.Duration } + +// GetRetryCount returns the number of times this CustomRun has already been retried +func (r *CustomRun) GetRetryCount() int { + return len(r.Status.RetriesStatus) +} 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 10ee016640..b0af076e13 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 @@ -218,6 +218,27 @@ func schema_pkg_apis_pipeline_pod_Template(ref common.ReferenceCallback) common. }, }, }, + "env": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "List of environment variables that can be provided to the containers belonging to the pod.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/core/v1.EnvVar"), + }, + }, + }, + }, + }, "tolerations": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ @@ -386,7 +407,7 @@ func schema_pkg_apis_pipeline_pod_Template(ref common.ReferenceCallback) common. }, }, Dependencies: []string{ - "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.HostAlias", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodDNSConfig", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.TopologySpreadConstraint", "k8s.io/api/core/v1.Volume"}, + "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.HostAlias", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodDNSConfig", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.TopologySpreadConstraint", "k8s.io/api/core/v1.Volume"}, } } @@ -1757,7 +1778,7 @@ func schema_pkg_apis_pipeline_v1beta1_PipelineRunRunStatus(ref common.ReferenceC return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "PipelineRunRunStatus contains the name of the PipelineTask for this Run and the Run's Status", + Description: "PipelineRunRunStatus contains the name of the PipelineTask for this CustomRun or Run and the CustomRun or Run's Status", Type: []string{"object"}, Properties: map[string]spec.Schema{ "pipelineTaskName": { @@ -1769,8 +1790,8 @@ func schema_pkg_apis_pipeline_v1beta1_PipelineRunRunStatus(ref common.ReferenceC }, "status": { SchemaProps: spec.SchemaProps{ - Description: "Status is the RunStatus for the corresponding Run", - Ref: ref("github.com/tektoncd/pipeline/pkg/apis/run/v1alpha1.RunStatus"), + Description: "Status is the CustomRunStatus for the corresponding CustomRun or Run", + Ref: ref("github.com/tektoncd/pipeline/pkg/apis/run/v1beta1.CustomRunStatus"), }, }, "whenExpressions": { @@ -1796,7 +1817,7 @@ func schema_pkg_apis_pipeline_v1beta1_PipelineRunRunStatus(ref common.ReferenceC }, }, Dependencies: []string{ - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.WhenExpression", "github.com/tektoncd/pipeline/pkg/apis/run/v1alpha1.RunStatus"}, + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.WhenExpression", "github.com/tektoncd/pipeline/pkg/apis/run/v1beta1.CustomRunStatus"}, } } @@ -4784,7 +4805,7 @@ func schema_pkg_apis_pipeline_v1beta1_TaskRunSpec(ref common.ReferenceCallback) }, "status": { SchemaProps: spec.SchemaProps{ - Description: "Used for cancelling a taskrun (and maybe more later on)", + Description: "Used for cancelling a TaskRun (and maybe more later on)", Type: []string{"string"}, Format: "", }, @@ -4796,9 +4817,16 @@ func schema_pkg_apis_pipeline_v1beta1_TaskRunSpec(ref common.ReferenceCallback) Format: "", }, }, + "retries": { + SchemaProps: spec.SchemaProps{ + Description: "Retries represents how many times this TaskRun should be retried in the event of Task failure.", + Type: []string{"integer"}, + Format: "int32", + }, + }, "timeout": { SchemaProps: spec.SchemaProps{ - Description: "Time after which the build times out. Defaults to 1 hour. Specified build timeout should be less than 24h. Refer Go's ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration", + Description: "Time after which one retry attempt times out. Defaults to 1 hour. Specified build timeout should be less than 24h. Refer Go's ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration", Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), }, }, @@ -5013,7 +5041,7 @@ func schema_pkg_apis_pipeline_v1beta1_TaskRunStatus(ref common.ReferenceCallback }, }, SchemaProps: spec.SchemaProps{ - Description: "Results from Resources built during the taskRun. currently includes the digest of build container images", + Description: "Results from Resources built during the TaskRun. currently includes the digest of build container images", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ @@ -5175,7 +5203,7 @@ func schema_pkg_apis_pipeline_v1beta1_TaskRunStatusFields(ref common.ReferenceCa }, }, SchemaProps: spec.SchemaProps{ - Description: "Results from Resources built during the taskRun. currently includes the digest of build container images", + Description: "Results from Resources built during the TaskRun. currently includes the digest of build container images", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ 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 dc2bdf6de3..412780aa87 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 @@ -290,14 +290,14 @@ func (pt PipelineTask) validateTask(ctx context.Context) (errs *apis.FieldError) if pt.TaskRef.Name != "" { // TaskRef name must be a valid k8s name if errSlice := validation.IsQualifiedName(pt.TaskRef.Name); len(errSlice) != 0 { - errs = errs.Also(apis.ErrInvalidValue(strings.Join(errSlice, ","), "name")) + errs = errs.Also(apis.ErrInvalidValue(strings.Join(errSlice, ","), "taskRef.name")) } } else if pt.TaskRef.Resolver == "" { errs = errs.Also(apis.ErrInvalidValue("taskRef must specify name", "taskRef.name")) } // fail if bundle is present when EnableTektonOCIBundles feature flag is off (as it won't be allowed nor used) if !cfg.FeatureFlags.EnableTektonOCIBundles && pt.TaskRef.Bundle != "" { - errs = errs.Also(apis.ErrDisallowedFields("taskref.bundle")) + errs = errs.Also(apis.ErrDisallowedFields("taskRef.bundle")) } } return errs 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 c3d9cd1cd7..5051656021 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 @@ -315,7 +315,6 @@ func taskContainsResult(resultExpression string, pipelineTaskNames sets.String, if strings.HasPrefix(value, "finally") && !pipelineFinallyTaskNames.Has(pipelineTaskName) { return false } - } } return true @@ -425,7 +424,6 @@ func validateDeclaredResources(resources []PipelineDeclaredResource, tasks []Pip required = append(required, output.Resource) } } - } for _, t := range finalTasks { if t.Resources != nil { diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go index 85f538e914..cd32266238 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go @@ -28,6 +28,15 @@ import ( var _ apis.Convertible = (*PipelineRun)(nil) +const ( + // taskRunsAnnotationKey is used to restore PipelineRunStatus.Status.TaskRuns when converting + // down from v1 to v1beta1 as `status.taskRuns` is deprecated in v1 PipelineRunStatus. + taskRunsAnnotationKey = "tekton.dev/v1beta1TaskRuns" + // runsAnnotationKey is used to restore PipelineRunStatus.Status.Run when converting + // down from v1 to v1beta1 as `status.runs` is deprecated in v1 PipelineRunStatus. + runsAnnotationKey = "tekton.dev/v1beta1Runs" +) + // ConvertTo implements apis.Convertible func (pr *PipelineRun) ConvertTo(ctx context.Context, to apis.Convertible) error { if apis.IsInDelete(ctx) { @@ -39,6 +48,15 @@ func (pr *PipelineRun) ConvertTo(ctx context.Context, to apis.Convertible) error if err := serializePipelineRunResources(&sink.ObjectMeta, &pr.Spec); err != nil { return err } + if err := serializePipelineRunStatusTaskRuns(&sink.ObjectMeta, &pr.Status); err != nil { + return err + } + if err := serializePipelineRunStatusRuns(&sink.ObjectMeta, &pr.Status); err != nil { + return err + } + if err := pr.Status.ConvertTo(ctx, &sink.Status); err != nil { + return err + } return pr.Spec.ConvertTo(ctx, &sink.Spec) default: return fmt.Errorf("unknown version, got: %T", sink) @@ -99,6 +117,15 @@ func (pr *PipelineRun) ConvertFrom(ctx context.Context, from apis.Convertible) e if err := deserializePipelineRunResources(&pr.ObjectMeta, &pr.Spec); err != nil { return err } + if err := deserializePipelineRunStatusTaskRuns(&pr.ObjectMeta, &pr.Status); err != nil { + return err + } + if err := deserializePipelineRunStatusRuns(&pr.ObjectMeta, &pr.Status); err != nil { + return err + } + if err := pr.Status.ConvertFrom(ctx, &source.Status); err != nil { + return err + } return pr.Spec.ConvertFrom(ctx, &source.Spec) default: return fmt.Errorf("unknown version, got: %T", pr) @@ -208,6 +235,155 @@ func (ptrs *PipelineTaskRunSpec) convertFrom(ctx context.Context, source v1.Pipe ptrs.ComputeResources = source.ComputeResources } +// ConvertTo implements apis.Convertible +func (prs *PipelineRunStatus) ConvertTo(ctx context.Context, sink *v1.PipelineRunStatus) error { + sink.Status = prs.Status + sink.StartTime = prs.StartTime + sink.CompletionTime = prs.CompletionTime + sink.Results = nil + for _, pr := range prs.PipelineResults { + new := v1.PipelineRunResult{} + pr.convertTo(ctx, &new) + sink.Results = append(sink.Results, new) + } + if prs.PipelineSpec != nil { + sink.PipelineSpec = &v1.PipelineSpec{} + err := prs.PipelineSpec.ConvertTo(ctx, sink.PipelineSpec) + if err != nil { + return err + } + } + sink.SkippedTasks = nil + for _, st := range prs.SkippedTasks { + new := v1.SkippedTask{} + st.convertTo(ctx, &new) + sink.SkippedTasks = append(sink.SkippedTasks, new) + } + sink.ChildReferences = nil + for _, cr := range prs.ChildReferences { + new := v1.ChildStatusReference{} + cr.convertTo(ctx, &new) + sink.ChildReferences = append(sink.ChildReferences, new) + } + sink.FinallyStartTime = prs.FinallyStartTime + if prs.Provenance != nil { + new := v1.Provenance{} + prs.Provenance.convertTo(ctx, &new) + sink.Provenance = &new + } + // If embedded-status is set to "both", both ChildReferences and TaskRuns/Runs + // will be populated. In this case, use the value from ChildReferences. + if sink.ChildReferences == nil { + if prs.TaskRuns != nil { + sink.ChildReferences = append(sink.ChildReferences, convertTaskRunsToChildReference(ctx, prs.TaskRuns)...) + } + if prs.Runs != nil { + sink.ChildReferences = append(sink.ChildReferences, convertRunsToChildReference(ctx, prs.Runs)...) + } + } + return nil +} + +// ConvertFrom implements apis.Convertible +func (prs *PipelineRunStatus) ConvertFrom(ctx context.Context, source *v1.PipelineRunStatus) error { + prs.Status = source.Status + prs.StartTime = source.StartTime + prs.CompletionTime = source.CompletionTime + prs.PipelineResults = nil + for _, pr := range source.Results { + new := PipelineRunResult{} + new.convertFrom(ctx, pr) + prs.PipelineResults = append(prs.PipelineResults, new) + } + if source.PipelineSpec != nil { + newPipelineSpec := PipelineSpec{} + err := newPipelineSpec.ConvertFrom(ctx, source.PipelineSpec) + if err != nil { + return err + } + prs.PipelineSpec = &newPipelineSpec + } + prs.SkippedTasks = nil + for _, st := range source.SkippedTasks { + new := SkippedTask{} + new.convertFrom(ctx, st) + prs.SkippedTasks = append(prs.SkippedTasks, new) + } + prs.ChildReferences = nil + for _, cr := range source.ChildReferences { + new := ChildStatusReference{} + new.convertFrom(ctx, cr) + prs.ChildReferences = append(prs.ChildReferences, new) + } + prs.FinallyStartTime = source.FinallyStartTime + if source.Provenance != nil { + new := Provenance{} + new.convertFrom(ctx, *source.Provenance) + prs.Provenance = &new + } + return nil +} + +func (prr PipelineRunResult) convertTo(ctx context.Context, sink *v1.PipelineRunResult) { + sink.Name = prr.Name + newValue := v1.ParamValue{} + prr.Value.convertTo(ctx, &newValue) + sink.Value = newValue +} + +func (prr *PipelineRunResult) convertFrom(ctx context.Context, source v1.PipelineRunResult) { + prr.Name = source.Name + newValue := ParamValue{} + newValue.convertFrom(ctx, source.Value) + prr.Value = newValue +} + +func (st SkippedTask) convertTo(ctx context.Context, sink *v1.SkippedTask) { + sink.Name = st.Name + sink.Reason = v1.SkippingReason(st.Reason) + sink.WhenExpressions = nil + for _, we := range st.WhenExpressions { + new := v1.WhenExpression{} + we.convertTo(ctx, &new) + sink.WhenExpressions = append(sink.WhenExpressions, new) + } +} + +func (st *SkippedTask) convertFrom(ctx context.Context, source v1.SkippedTask) { + st.Name = source.Name + st.Reason = SkippingReason(source.Reason) + st.WhenExpressions = nil + for _, we := range source.WhenExpressions { + new := WhenExpression{} + new.convertFrom(ctx, we) + st.WhenExpressions = append(st.WhenExpressions, new) + } +} + +func (csr ChildStatusReference) convertTo(ctx context.Context, sink *v1.ChildStatusReference) { + sink.TypeMeta = csr.TypeMeta + sink.Name = csr.Name + sink.PipelineTaskName = csr.PipelineTaskName + sink.WhenExpressions = nil + for _, we := range csr.WhenExpressions { + new := v1.WhenExpression{} + we.convertTo(ctx, &new) + sink.WhenExpressions = append(sink.WhenExpressions, new) + } +} + +func (csr *ChildStatusReference) convertFrom(ctx context.Context, source v1.ChildStatusReference) { + csr.TypeMeta = source.TypeMeta + csr.Name = source.Name + csr.PipelineTaskName = source.PipelineTaskName + csr.WhenExpressions = nil + for _, we := range source.WhenExpressions { + new := WhenExpression{} + new.convertFrom(ctx, we) + csr.WhenExpressions = append(csr.WhenExpressions, new) + } +} + func serializePipelineRunResources(meta *metav1.ObjectMeta, spec *PipelineRunSpec) error { if spec.Resources == nil { return nil @@ -226,3 +402,84 @@ func deserializePipelineRunResources(meta *metav1.ObjectMeta, spec *PipelineRunS } return nil } + +// convertTaskRunsToChildReference handles the deprecated `status.taskRuns` field PipelineRunTaskRunStatus. +func convertTaskRunsToChildReference(ctx context.Context, taskRuns map[string]*PipelineRunTaskRunStatus) []v1.ChildStatusReference { + csrs := []v1.ChildStatusReference{} + for name, status := range taskRuns { + csr := v1.ChildStatusReference{} + // The apiVersion is defaulted to 'v1beta1' all taskRuns are populated by v1beta1 + // PipelineRunStatus reconcilers when `embedded-status` is `Full` or `Both`. + csr.TypeMeta.APIVersion = "tekton.dev/v1beta1" + csr.TypeMeta.Kind = "TaskRun" + csr.Name = name + csr.PipelineTaskName = status.PipelineTaskName + csr.WhenExpressions = nil + for _, we := range status.WhenExpressions { + new := v1.WhenExpression{} + we.convertTo(ctx, &new) + csr.WhenExpressions = append(csr.WhenExpressions, new) + } + csrs = append(csrs, csr) + } + return csrs +} + +// convertRunsToChildReference handles the deprecated `status.runs` field PipelineRunRunStatus. +func convertRunsToChildReference(ctx context.Context, runs map[string]*PipelineRunRunStatus) []v1.ChildStatusReference { + csrs := []v1.ChildStatusReference{} + for name, status := range runs { + csr := v1.ChildStatusReference{} + // The apiViersion is set to 'v1alpha1' as Run is only in `v1alpha1`. + csr.TypeMeta.APIVersion = "tekton.dev/v1alpha1" + csr.TypeMeta.Kind = "Run" + csr.Name = name + csr.PipelineTaskName = status.PipelineTaskName + csr.WhenExpressions = nil + for _, we := range status.WhenExpressions { + new := v1.WhenExpression{} + we.convertTo(ctx, &new) + csr.WhenExpressions = append(csr.WhenExpressions, new) + } + csrs = append(csrs, csr) + } + return csrs +} + +func serializePipelineRunStatusTaskRuns(meta *metav1.ObjectMeta, status *PipelineRunStatus) error { + if status.TaskRuns == nil { + return nil + } + return version.SerializeToMetadata(meta, status.TaskRuns, taskRunsAnnotationKey) +} + +func deserializePipelineRunStatusTaskRuns(meta *metav1.ObjectMeta, status *PipelineRunStatus) error { + taskRuns := make(map[string]*PipelineRunTaskRunStatus) + err := version.DeserializeFromMetadata(meta, &taskRuns, taskRunsAnnotationKey) + if err != nil { + return err + } + if len(taskRuns) != 0 { + status.TaskRuns = taskRuns + } + return nil +} + +func serializePipelineRunStatusRuns(meta *metav1.ObjectMeta, status *PipelineRunStatus) error { + if status.Runs == nil { + return nil + } + return version.SerializeToMetadata(meta, status.Runs, runsAnnotationKey) +} + +func deserializePipelineRunStatusRuns(meta *metav1.ObjectMeta, status *PipelineRunStatus) error { + runs := make(map[string]*PipelineRunRunStatus) + err := version.DeserializeFromMetadata(meta, &runs, runsAnnotationKey) + if err != nil { + return err + } + if len(runs) != 0 { + status.Runs = runs + } + return nil +} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipelinerun_types.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipelinerun_types.go index 6e81abd7be..442f65fefe 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipelinerun_types.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipelinerun_types.go @@ -27,13 +27,12 @@ import ( apisconfig "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline" pod "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod" - runv1alpha1 "github.com/tektoncd/pipeline/pkg/apis/run/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" "k8s.io/utils/clock" "knative.dev/pkg/apis" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) // +genclient @@ -298,7 +297,7 @@ const ( // PipelineRunStatus defines the observed state of PipelineRun type PipelineRunStatus struct { - duckv1beta1.Status `json:",inline"` + duckv1.Status `json:",inline"` // PipelineRunStatusFields inlines the status fields. PipelineRunStatusFields `json:",inline"` @@ -523,13 +522,13 @@ type PipelineRunTaskRunStatus struct { WhenExpressions []WhenExpression `json:"whenExpressions,omitempty"` } -// PipelineRunRunStatus contains the name of the PipelineTask for this Run and the Run's Status +// PipelineRunRunStatus contains the name of the PipelineTask for this CustomRun or Run and the CustomRun or Run's Status type PipelineRunRunStatus struct { // PipelineTaskName is the name of the PipelineTask. PipelineTaskName string `json:"pipelineTaskName,omitempty"` - // Status is the RunStatus for the corresponding Run + // Status is the CustomRunStatus for the corresponding CustomRun or Run // +optional - Status *runv1alpha1.RunStatus `json:"status,omitempty"` + Status *CustomRunStatus `json:"status,omitempty"` // WhenExpressions is the list of checks guarding the execution of the PipelineTask // +optional // +listType=atomic diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipelinerun_validation.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipelinerun_validation.go index 4e874f12c6..4469f902a8 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipelinerun_validation.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipelinerun_validation.go @@ -128,6 +128,9 @@ func (ps *PipelineRunSpec) Validate(ctx context.Context) (errs *apis.FieldError) for idx, trs := range ps.TaskRunSpecs { errs = errs.Also(validateTaskRunSpec(ctx, trs).ViaIndex(idx).ViaField("taskRunSpecs")) } + if ps.PodTemplate != nil { + errs = errs.Also(validatePodTemplateEnv(ctx, *ps.PodTemplate)) + } return errs } @@ -270,7 +273,6 @@ func validateSpecStatus(status PipelineRunSpecStatus) *apis.FieldError { PipelineRunSpecStatusCancelledRunFinally, PipelineRunSpecStatusStoppedRunFinally, PipelineRunSpecStatusPending), "status") - } func validateTimeoutDuration(field string, d *metav1.Duration) (errs *apis.FieldError) { @@ -334,5 +336,8 @@ func validateTaskRunSpec(ctx context.Context, trs PipelineTaskRunSpec) (errs *ap errs = errs.Also(version.ValidateEnabledAPIFields(ctx, "computeResources", config.AlphaAPIFields).ViaField("computeResources")) errs = errs.Also(validateTaskRunComputeResources(trs.ComputeResources, trs.StepOverrides)) } + if trs.TaskPodTemplate != nil { + errs = errs.Also(validatePodTemplateEnv(ctx, *trs.TaskPodTemplate)) + } return errs } diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/provenance_conversion.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/provenance_conversion.go new file mode 100644 index 0000000000..db4594889c --- /dev/null +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/provenance_conversion.go @@ -0,0 +1,44 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + "context" + + v1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1" +) + +func (p Provenance) convertTo(ctx context.Context, sink *v1.Provenance) { + new := v1.ConfigSource{} + p.ConfigSource.convertTo(ctx, &new) + sink.ConfigSource = &new +} + +func (p *Provenance) convertFrom(ctx context.Context, source v1.Provenance) { + new := ConfigSource{} + new.convertFrom(ctx, *source.ConfigSource) + p.ConfigSource = &new +} + +func (cs ConfigSource) convertTo(ctx context.Context, sink *v1.ConfigSource) { + sink.URI = cs.URI + sink.Digest = cs.Digest + sink.EntryPoint = cs.EntryPoint +} + +func (cs *ConfigSource) convertFrom(ctx context.Context, source v1.ConfigSource) { + cs.URI = source.URI + cs.Digest = source.Digest + cs.EntryPoint = source.EntryPoint +} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resource_types.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resource_types.go index 203a87c40a..9a1602c27f 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resource_types.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resource_types.go @@ -147,7 +147,6 @@ type ResultType int // of string, and then fail the running TaskRun because it doesn't know how to interpret // the string value that the TaskRun's entrypoint will emit when it completes. func (r *ResultType) UnmarshalJSON(data []byte) error { - var asInt int var intErr error diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resource_types_validation.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resource_types_validation.go index 2898fd9dfc..da79c2086d 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resource_types_validation.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resource_types_validation.go @@ -96,7 +96,6 @@ func validateTaskRunResources(ctx context.Context, resources []TaskResourceBindi if r.ResourceSpec != nil && r.ResourceSpec.Validate(ctx) != nil { return r.ResourceSpec.Validate(ctx) } - } return nil } diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resultref.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resultref.go index c6d2526fc3..8e1a4bf47d 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resultref.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/resultref.go @@ -171,7 +171,6 @@ func stripVarSubExpression(expression string) string { // - Output: "", "", 0, "", error // TODO: may use regex for each type to handle possible reference formats func parseExpression(substitutionExpression string) (string, string, int, string, error) { - if looksLikeResultRef(substitutionExpression) { subExpressions := strings.Split(substitutionExpression, ".") // For string result: tasks..results. diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/run_interface.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/run_interface.go new file mode 100644 index 0000000000..2a0ada19d6 --- /dev/null +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/run_interface.go @@ -0,0 +1,43 @@ +/* + Copyright 2022 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 v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "knative.dev/pkg/apis" +) + +// RunObject is implemented by CustomRun and Run +type RunObject interface { + // Object requires GetObjectKind() and DeepCopyObject() + runtime.Object + + // ObjectMetaAccessor requires a GetObjectMeta that returns the ObjectMeta + metav1.ObjectMetaAccessor + + // GetStatusCondition returns a ConditionAccessor for the status of the objectWithCondition + GetStatusCondition() apis.ConditionAccessor + + IsSuccessful() bool + IsCancelled() bool + HasStarted() bool + IsDone() bool + + GetRetryCount() int +} 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 1f45183282..ca7274cdee 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 @@ -63,6 +63,17 @@ "description": "EnableServiceLinks indicates whether information about services should be injected into pod's environment variables, matching the syntax of Docker links. Optional: Defaults to true.", "type": "boolean" }, + "env": { + "description": "List of environment variables that can be provided to the containers belonging to the pod.", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/v1.EnvVar" + }, + "x-kubernetes-list-type": "atomic", + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge" + }, "hostAliases": { "description": "HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. This is only valid for non-hostNetwork pods.", "type": "array", @@ -1054,7 +1065,7 @@ } }, "v1beta1.PipelineRunRunStatus": { - "description": "PipelineRunRunStatus contains the name of the PipelineTask for this Run and the Run's Status", + "description": "PipelineRunRunStatus contains the name of the PipelineTask for this CustomRun or Run and the CustomRun or Run's Status", "type": "object", "properties": { "pipelineTaskName": { @@ -1062,8 +1073,8 @@ "type": "string" }, "status": { - "description": "Status is the RunStatus for the corresponding Run", - "$ref": "#/definitions/github.com.tektoncd.pipeline.pkg.apis.run.v1alpha1.RunStatus" + "description": "Status is the CustomRunStatus for the corresponding CustomRun or Run", + "$ref": "#/definitions/github.com.tektoncd.pipeline.pkg.apis.run.v1beta1.CustomRunStatus" }, "whenExpressions": { "description": "WhenExpressions is the list of checks guarding the execution of the PipelineTask", @@ -2793,6 +2804,11 @@ "resources": { "$ref": "#/definitions/v1beta1.TaskRunResources" }, + "retries": { + "description": "Retries represents how many times this TaskRun should be retried in the event of Task failure.", + "type": "integer", + "format": "int32" + }, "serviceAccountName": { "type": "string", "default": "" @@ -2807,7 +2823,7 @@ "x-kubernetes-list-type": "atomic" }, "status": { - "description": "Used for cancelling a taskrun (and maybe more later on)", + "description": "Used for cancelling a TaskRun (and maybe more later on)", "type": "string" }, "statusMessage": { @@ -2831,7 +2847,7 @@ "$ref": "#/definitions/v1beta1.TaskSpec" }, "timeout": { - "description": "Time after which the build times out. Defaults to 1 hour. Specified build timeout should be less than 24h. Refer Go's ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration", + "description": "Time after which one retry attempt times out. Defaults to 1 hour. Specified build timeout should be less than 24h. Refer Go's ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration", "$ref": "#/definitions/v1.Duration" }, "workspaces": { @@ -2898,7 +2914,7 @@ "$ref": "#/definitions/v1beta1.Provenance" }, "resourcesResult": { - "description": "Results from Resources built during the taskRun. currently includes the digest of build container images", + "description": "Results from Resources built during the TaskRun. currently includes the digest of build container images", "type": "array", "items": { "default": {}, @@ -2982,7 +2998,7 @@ "$ref": "#/definitions/v1beta1.Provenance" }, "resourcesResult": { - "description": "Results from Resources built during the taskRun. currently includes the digest of build container images", + "description": "Results from Resources built during the TaskRun. currently includes the digest of build container images", "type": "array", "items": { "default": {}, diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/task_validation.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/task_validation.go index a64d5bdb81..3dfd66dd6c 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/task_validation.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/task_validation.go @@ -25,6 +25,7 @@ import ( "time" "github.com/tektoncd/pipeline/pkg/apis/config" + "github.com/tektoncd/pipeline/pkg/apis/pipeline" "github.com/tektoncd/pipeline/pkg/apis/validate" "github.com/tektoncd/pipeline/pkg/apis/version" "github.com/tektoncd/pipeline/pkg/substitution" @@ -92,6 +93,7 @@ func (ts *TaskSpec) Validate(ctx context.Context) (errs *apis.FieldError) { } errs = errs.Also(validateSteps(ctx, mergedSteps).ViaField("steps")) + errs = errs.Also(validateSidecarNames(ts.Sidecars)) errs = errs.Also(ts.Resources.Validate(ctx).ViaField("resources")) errs = errs.Also(ValidateParameterTypes(ctx, ts.Params).ViaField("params")) errs = errs.Also(ValidateParameterVariables(ctx, ts.Steps, ts.Params)) @@ -101,6 +103,18 @@ func (ts *TaskSpec) Validate(ctx context.Context) (errs *apis.FieldError) { return errs } +func validateSidecarNames(sidecars []Sidecar) (errs *apis.FieldError) { + for _, sc := range sidecars { + if sc.Name == pipeline.ReservedResultsSidecarName { + errs = errs.Also(&apis.FieldError{ + Message: fmt.Sprintf("Invalid: cannot use reserved sidecar name %v ", sc.Name), + Paths: []string{"sidecars"}, + }) + } + } + return errs +} + func validateResults(ctx context.Context, results []TaskResult) (errs *apis.FieldError) { for index, result := range results { errs = errs.Also(result.Validate(ctx).ViaIndex(index)) @@ -452,7 +466,6 @@ func validateStepObjectUsageAsWhole(step Step, prefix string, vars sets.String) } for i, arg := range step.Args { errs = errs.Also(validateTaskNoObjectReferenced(arg, prefix, vars).ViaFieldIndex("args", i)) - } for _, env := range step.Env { errs = errs.Also(validateTaskNoObjectReferenced(env.Value, prefix, vars).ViaFieldKey("env", env.Name)) @@ -482,7 +495,6 @@ func validateStepArrayUsage(step Step, prefix string, vars sets.String) *apis.Fi } for i, arg := range step.Args { errs = errs.Also(validateTaskArraysIsolated(arg, prefix, vars).ViaFieldIndex("args", i)) - } for _, env := range step.Env { errs = errs.Also(validateTaskNoArrayReferenced(env.Value, prefix, vars).ViaFieldKey("env", env.Name)) diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/taskrun_conversion.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/taskrun_conversion.go index d6d5cd09a4..bb081314b4 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/taskrun_conversion.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/taskrun_conversion.go @@ -26,6 +26,11 @@ import ( "knative.dev/pkg/apis" ) +const ( + cloudEventsAnnotationKey = "tekton.dev/v1beta1CloudEvents" + resourcesResultAnnotationKey = "tekton.dev/v1beta1ResourcesResult" +) + var _ apis.Convertible = (*TaskRun)(nil) // ConvertTo implements apis.Convertible @@ -39,6 +44,15 @@ func (tr *TaskRun) ConvertTo(ctx context.Context, to apis.Convertible) error { if err := serializeTaskRunResources(&sink.ObjectMeta, &tr.Spec); err != nil { return err } + if err := serializeTaskRunCloudEvents(&sink.ObjectMeta, &tr.Status); err != nil { + return err + } + if err := serializeTaskRunResourcesResult(&sink.ObjectMeta, &tr.Status); err != nil { + return err + } + if err := tr.Status.ConvertTo(ctx, &sink.Status); err != nil { + return err + } return tr.Spec.ConvertTo(ctx, &sink.Spec) default: return fmt.Errorf("unknown version, got: %T", sink) @@ -71,6 +85,7 @@ func (trs *TaskRunSpec) ConvertTo(ctx context.Context, sink *v1.TaskRunSpec) err } sink.Status = v1.TaskRunSpecStatus(trs.Status) sink.StatusMessage = v1.TaskRunSpecStatusMessage(trs.StatusMessage) + sink.Retries = trs.Retries sink.Timeout = trs.Timeout sink.PodTemplate = trs.PodTemplate sink.Workspaces = nil @@ -106,6 +121,15 @@ func (tr *TaskRun) ConvertFrom(ctx context.Context, from apis.Convertible) error if err := deserializeTaskRunResources(&tr.ObjectMeta, &tr.Spec); err != nil { return err } + if err := deserializeTaskRunCloudEvents(&tr.ObjectMeta, &tr.Status); err != nil { + return err + } + if err := deserializeTaskRunResourcesResult(&tr.ObjectMeta, &tr.Status); err != nil { + return err + } + if err := tr.Status.ConvertFrom(ctx, source.Status); err != nil { + return err + } return tr.Spec.ConvertFrom(ctx, &source.Spec) default: return fmt.Errorf("unknown version, got: %T", tr) @@ -141,6 +165,7 @@ func (trs *TaskRunSpec) ConvertFrom(ctx context.Context, source *v1.TaskRunSpec) } trs.Status = TaskRunSpecStatus(source.Status) trs.StatusMessage = TaskRunSpecStatusMessage(source.StatusMessage) + trs.Retries = source.Retries trs.Timeout = source.Timeout trs.PodTemplate = source.PodTemplate trs.Workspaces = nil @@ -193,6 +218,148 @@ func (trso *TaskRunSidecarOverride) convertFrom(ctx context.Context, source v1.T trso.Resources = source.ComputeResources } +// ConvertTo implements apis.Convertible +func (trs *TaskRunStatus) ConvertTo(ctx context.Context, sink *v1.TaskRunStatus) error { + sink.Status = trs.Status + sink.PodName = trs.PodName + sink.StartTime = trs.StartTime + sink.CompletionTime = trs.CompletionTime + sink.Steps = nil + for _, ss := range trs.Steps { + new := v1.StepState{} + ss.convertTo(ctx, &new) + sink.Steps = append(sink.Steps, new) + } + sink.RetriesStatus = nil + for _, rr := range trs.RetriesStatus { + new := v1.TaskRunStatus{} + err := rr.ConvertTo(ctx, &new) + if err != nil { + return err + } + sink.RetriesStatus = append(sink.RetriesStatus, new) + } + sink.Results = nil + for _, trr := range trs.TaskRunResults { + new := v1.TaskRunResult{} + trr.convertTo(ctx, &new) + sink.Results = append(sink.Results, new) + } + sink.Sidecars = nil + for _, sc := range trs.Sidecars { + new := v1.SidecarState{} + sc.convertTo(ctx, &new) + sink.Sidecars = append(sink.Sidecars, new) + } + + if trs.TaskSpec != nil { + sink.TaskSpec = &v1.TaskSpec{} + err := trs.TaskSpec.ConvertTo(ctx, sink.TaskSpec) + if err != nil { + return err + } + } + if trs.Provenance != nil { + new := v1.Provenance{} + trs.Provenance.convertTo(ctx, &new) + sink.Provenance = &new + } + return nil +} + +// ConvertFrom implements apis.Convertible +func (trs *TaskRunStatus) ConvertFrom(ctx context.Context, source v1.TaskRunStatus) error { + trs.Status = source.Status + trs.PodName = source.PodName + trs.StartTime = source.StartTime + trs.CompletionTime = source.CompletionTime + trs.Steps = nil + for _, ss := range source.Steps { + new := StepState{} + new.convertFrom(ctx, ss) + trs.Steps = append(trs.Steps, new) + } + trs.RetriesStatus = nil + for _, rr := range source.RetriesStatus { + new := TaskRunStatus{} + err := new.ConvertFrom(ctx, rr) + if err != nil { + return err + } + trs.RetriesStatus = append(trs.RetriesStatus, new) + } + trs.TaskRunResults = nil + for _, trr := range source.Results { + new := TaskRunResult{} + new.convertFrom(ctx, trr) + trs.TaskRunResults = append(trs.TaskRunResults, new) + } + trs.Sidecars = nil + for _, sc := range source.Sidecars { + new := SidecarState{} + new.convertFrom(ctx, sc) + trs.Sidecars = append(trs.Sidecars, new) + } + + if source.TaskSpec != nil { + trs.TaskSpec = &TaskSpec{} + err := trs.TaskSpec.ConvertFrom(ctx, source.TaskSpec) + if err != nil { + return err + } + } + if source.Provenance != nil { + new := Provenance{} + new.convertFrom(ctx, *source.Provenance) + trs.Provenance = &new + } + return nil +} + +func (ss StepState) convertTo(ctx context.Context, sink *v1.StepState) { + sink.ContainerState = ss.ContainerState + sink.Name = ss.Name + sink.Container = ss.ContainerName + sink.ImageID = ss.ImageID +} + +func (ss *StepState) convertFrom(ctx context.Context, source v1.StepState) { + ss.ContainerState = source.ContainerState + ss.Name = source.Name + ss.ContainerName = source.Container + ss.ImageID = source.ImageID +} + +func (trr TaskRunResult) convertTo(ctx context.Context, sink *v1.TaskRunResult) { + sink.Name = trr.Name + sink.Type = v1.ResultsType(trr.Type) + newValue := v1.ParamValue{} + trr.Value.convertTo(ctx, &newValue) + sink.Value = newValue +} + +func (trr *TaskRunResult) convertFrom(ctx context.Context, source v1.TaskRunResult) { + trr.Name = source.Name + trr.Type = ResultsType(source.Type) + newValue := ParamValue{} + newValue.convertFrom(ctx, source.Value) + trr.Value = newValue +} + +func (ss SidecarState) convertTo(ctx context.Context, sink *v1.SidecarState) { + sink.ContainerState = ss.ContainerState + sink.Name = ss.Name + sink.Container = ss.ContainerName + sink.ImageID = ss.ImageID +} + +func (ss *SidecarState) convertFrom(ctx context.Context, source v1.SidecarState) { + ss.ContainerState = source.ContainerState + ss.Name = source.Name + ss.ContainerName = source.Container + ss.ImageID = source.ImageID +} + func serializeTaskRunResources(meta *metav1.ObjectMeta, spec *TaskRunSpec) error { if spec.Resources == nil { return nil @@ -211,3 +378,41 @@ func deserializeTaskRunResources(meta *metav1.ObjectMeta, spec *TaskRunSpec) err } return nil } + +func serializeTaskRunCloudEvents(meta *metav1.ObjectMeta, status *TaskRunStatus) error { + if status.CloudEvents == nil { + return nil + } + return version.SerializeToMetadata(meta, status.CloudEvents, cloudEventsAnnotationKey) +} + +func deserializeTaskRunCloudEvents(meta *metav1.ObjectMeta, status *TaskRunStatus) error { + cloudEvents := []CloudEventDelivery{} + err := version.DeserializeFromMetadata(meta, &cloudEvents, cloudEventsAnnotationKey) + if err != nil { + return err + } + if len(cloudEvents) != 0 { + status.CloudEvents = cloudEvents + } + return nil +} + +func serializeTaskRunResourcesResult(meta *metav1.ObjectMeta, status *TaskRunStatus) error { + if status.ResourcesResult == nil { + return nil + } + return version.SerializeToMetadata(meta, status.ResourcesResult, resourcesResultAnnotationKey) +} + +func deserializeTaskRunResourcesResult(meta *metav1.ObjectMeta, status *TaskRunStatus) error { + resourcesResult := []PipelineResourceResult{} + err := version.DeserializeFromMetadata(meta, &resourcesResult, resourcesResultAnnotationKey) + if err != nil { + return err + } + if len(resourcesResult) != 0 { + status.ResourcesResult = resourcesResult + } + return nil +} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/taskrun_types.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/taskrun_types.go index 76b3dee647..5253c65167 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/taskrun_types.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/taskrun_types.go @@ -31,7 +31,7 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/utils/clock" "knative.dev/pkg/apis" - duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + duckv1 "knative.dev/pkg/apis/duck/v1" ) // TaskRunSpec defines the desired state of TaskRun @@ -50,13 +50,16 @@ type TaskRunSpec struct { TaskRef *TaskRef `json:"taskRef,omitempty"` // +optional TaskSpec *TaskSpec `json:"taskSpec,omitempty"` - // Used for cancelling a taskrun (and maybe more later on) + // Used for cancelling a TaskRun (and maybe more later on) // +optional Status TaskRunSpecStatus `json:"status,omitempty"` // Status message for cancellation. // +optional StatusMessage TaskRunSpecStatusMessage `json:"statusMessage,omitempty"` - // Time after which the build times out. Defaults to 1 hour. + // Retries represents how many times this TaskRun should be retried in the event of Task failure. + // +optional + Retries int `json:"retries,omitempty"` + // Time after which one retry attempt times out. Defaults to 1 hour. // Specified build timeout should be less than 24h. // Refer Go's ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration // +optional @@ -85,7 +88,7 @@ type TaskRunSpec struct { ComputeResources *corev1.ResourceRequirements `json:"computeResources,omitempty"` } -// TaskRunSpecStatus defines the taskrun spec status the user can provide +// TaskRunSpecStatus defines the TaskRun spec status the user can provide type TaskRunSpecStatus string const ( @@ -133,7 +136,7 @@ var taskRunCondSet = apis.NewBatchConditionSet() // TaskRunStatus defines the observed state of TaskRun type TaskRunStatus struct { - duckv1beta1.Status `json:",inline"` + duckv1.Status `json:",inline"` // TaskRunStatusFields inlines the status fields. TaskRunStatusFields `json:",inline"` @@ -166,9 +169,11 @@ const ( TaskRunReasonSuccessful TaskRunReason = "Succeeded" // TaskRunReasonFailed is the reason set when the TaskRun completed with a failure TaskRunReasonFailed TaskRunReason = "Failed" - // TaskRunReasonCancelled is the reason set when the Taskrun is cancelled by the user + // TaskRunReasonToBeRetried is the reason set when the last TaskRun execution failed, and will be retried + TaskRunReasonToBeRetried TaskRunReason = "ToBeRetried" + // TaskRunReasonCancelled is the reason set when the TaskRun is cancelled by the user TaskRunReasonCancelled TaskRunReason = "TaskRunCancelled" - // TaskRunReasonTimedOut is the reason set when the Taskrun has timed out + // TaskRunReasonTimedOut is the reason set when one TaskRun execution has timed out TaskRunReasonTimedOut TaskRunReason = "TaskRunTimeout" // TaskRunReasonResolvingTaskRef indicates that the TaskRun is waiting for // its taskRef to be asynchronously resolved. @@ -181,6 +186,10 @@ const ( TaskRunReasonsResultsVerificationFailed TaskRunReason = "TaskRunResultsVerificationFailed" // AwaitingTaskRunResults is the reason set when waiting upon `TaskRun` results and signatures to verify AwaitingTaskRunResults TaskRunReason = "AwaitingTaskRunResults" + // TaskRunReasonResultLargerThanAllowedLimit is the reason set when one of the results exceeds its maximum allowed limit of 1 KB + TaskRunReasonResultLargerThanAllowedLimit TaskRunReason = "TaskRunResultLargerThanAllowedLimit" + // TaskRunReasonStopSidecarFailed indicates that the sidecar is not properly stopped. + TaskRunReasonStopSidecarFailed = "TaskRunStopSidecarFailed" ) func (t TaskRunReason) String() string { @@ -256,7 +265,7 @@ type TaskRunStatusFields struct { // +listType=atomic RetriesStatus []TaskRunStatus `json:"retriesStatus,omitempty"` - // Results from Resources built during the taskRun. currently includes + // Results from Resources built during the TaskRun. currently includes // the digest of build container images // +optional // +listType=atomic @@ -417,7 +426,7 @@ type TaskRunList struct { Items []TaskRun `json:"items"` } -// GetPipelineRunPVCName for taskrun gets pipelinerun +// GetPipelineRunPVCName for TaskRun gets pipelinerun func (tr *TaskRun) GetPipelineRunPVCName() string { if tr == nil { return "" @@ -446,7 +455,7 @@ func (tr *TaskRun) IsDone() bool { return !tr.Status.GetCondition(apis.ConditionSucceeded).IsUnknown() } -// HasStarted function check whether taskrun has valid start time set in its status +// HasStarted function check whether TaskRun has valid start time set in its status func (tr *TaskRun) HasStarted() bool { return tr.Status.StartTime != nil && !tr.Status.StartTime.IsZero() } @@ -471,6 +480,11 @@ func (tr *TaskRun) IsTaskRunResultDone() bool { return !tr.Status.GetCondition(apis.ConditionType(TaskRunConditionResultsVerified.String())).IsUnknown() } +// IsRetriable returns true if the TaskRun's Retries is not exhausted. +func (tr *TaskRun) IsRetriable() bool { + return len(tr.Status.RetriesStatus) < tr.Spec.Retries +} + // HasTimedOut returns true if the TaskRun runtime is beyond the allowed timeout func (tr *TaskRun) HasTimedOut(ctx context.Context, c clock.PassiveClock) bool { if tr.Status.StartTime.IsZero() { diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/taskrun_validation.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/taskrun_validation.go index 94b639c4cb..f8d379c6df 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/taskrun_validation.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/taskrun_validation.go @@ -22,11 +22,13 @@ import ( "strings" "github.com/tektoncd/pipeline/pkg/apis/config" + pod "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod" "github.com/tektoncd/pipeline/pkg/apis/validate" "github.com/tektoncd/pipeline/pkg/apis/version" admissionregistrationv1 "k8s.io/api/admissionregistration/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/utils/strings/slices" "knative.dev/pkg/apis" "knative.dev/pkg/webhook/resourcesemantics" ) @@ -105,7 +107,9 @@ func (ts *TaskRunSpec) Validate(ctx context.Context) (errs *apis.FieldError) { errs = errs.Also(apis.ErrInvalidValue(fmt.Sprintf("%s should be >= 0", ts.Timeout.Duration.String()), "timeout")) } } - + if ts.PodTemplate != nil { + errs = errs.Also(validatePodTemplateEnv(ctx, *ts.PodTemplate)) + } return errs } @@ -142,6 +146,19 @@ func (ts *TaskRunSpec) validateInlineParameters(ctx context.Context) (errs *apis return errs } +func validatePodTemplateEnv(ctx context.Context, podTemplate pod.Template) (errs *apis.FieldError) { + forbiddenEnvsConfigured := config.FromContextOrDefaults(ctx).Defaults.DefaultForbiddenEnv + if len(forbiddenEnvsConfigured) == 0 { + return errs + } + for _, pEnv := range podTemplate.Env { + if slices.Contains(forbiddenEnvsConfigured, pEnv.Name) { + errs = errs.Also(apis.ErrInvalidValue("PodTemplate cannot update a forbidden env: "+pEnv.Name, "PodTemplate.Env")) + } + } + return errs +} + func createParamSpecFromParam(p Param, paramSpecForValidation map[string]ParamSpec) map[string]ParamSpec { value := p.Value pSpec := ParamSpec{ 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 2706537bef..1dbc5e43ab 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 @@ -24,7 +24,7 @@ package v1beta1 import ( pod "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod" v1alpha1 "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" - runv1alpha1 "github.com/tektoncd/pipeline/pkg/apis/run/v1alpha1" + runv1beta1 "github.com/tektoncd/pipeline/pkg/apis/run/v1beta1" corev1 "k8s.io/api/core/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -703,7 +703,7 @@ func (in *PipelineRunRunStatus) DeepCopyInto(out *PipelineRunRunStatus) { *out = *in if in.Status != nil { in, out := &in.Status, &out.Status - *out = new(runv1alpha1.RunStatus) + *out = new(runv1beta1.CustomRunStatus) (*in).DeepCopyInto(*out) } if in.WhenExpressions != nil { diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/run/v1beta1/customrunstatus_types.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/run/v1beta1/customrunstatus_types.go index ff41f0e4c8..2f8d9847c0 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/run/v1beta1/customrunstatus_types.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/run/v1beta1/customrunstatus_types.go @@ -20,6 +20,7 @@ import ( "encoding/json" "time" + "github.com/tektoncd/pipeline/pkg/apis/run/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "knative.dev/pkg/apis" @@ -145,3 +146,28 @@ func (r *CustomRunStatus) EncodeExtraFields(from interface{}) error { } return nil } + +// FromRunStatus converts a v1alpha1.RunStatus into a corresponding v1beta1.CustomRunStatus +func FromRunStatus(orig v1alpha1.RunStatus) CustomRunStatus { + crs := CustomRunStatus{ + Status: orig.Status, + CustomRunStatusFields: CustomRunStatusFields{ + StartTime: orig.StartTime, + CompletionTime: orig.CompletionTime, + ExtraFields: orig.ExtraFields, + }, + } + + for _, origRes := range orig.Results { + crs.Results = append(crs.Results, CustomRunResult{ + Name: origRes.Name, + Value: origRes.Value, + }) + } + + for _, origRetryStatus := range orig.RetriesStatus { + crs.RetriesStatus = append(crs.RetriesStatus, FromRunStatus(origRetryStatus)) + } + + return crs +} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/fake/fake_pipeline_client.go b/vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/fake/fake_pipeline_client.go index 7ef7a75e92..b6966151af 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/fake/fake_pipeline_client.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/fake/fake_pipeline_client.go @@ -32,6 +32,10 @@ func (c *FakeTektonV1alpha1) Runs(namespace string) v1alpha1.RunInterface { return &FakeRuns{c, namespace} } +func (c *FakeTektonV1alpha1) VerificationPolicies(namespace string) v1alpha1.VerificationPolicyInterface { + return &FakeVerificationPolicies{c, namespace} +} + // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeTektonV1alpha1) RESTClient() rest.Interface { diff --git a/vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/fake/fake_verificationpolicy.go b/vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/fake/fake_verificationpolicy.go new file mode 100644 index 0000000000..f03f866176 --- /dev/null +++ b/vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/fake/fake_verificationpolicy.go @@ -0,0 +1,130 @@ +/* +Copyright 2020 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeVerificationPolicies implements VerificationPolicyInterface +type FakeVerificationPolicies struct { + Fake *FakeTektonV1alpha1 + ns string +} + +var verificationpoliciesResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1alpha1", Resource: "verificationpolicies"} + +var verificationpoliciesKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1alpha1", Kind: "VerificationPolicy"} + +// Get takes name of the verificationPolicy, and returns the corresponding verificationPolicy object, and an error if there is any. +func (c *FakeVerificationPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VerificationPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(verificationpoliciesResource, c.ns, name), &v1alpha1.VerificationPolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VerificationPolicy), err +} + +// List takes label and field selectors, and returns the list of VerificationPolicies that match those selectors. +func (c *FakeVerificationPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VerificationPolicyList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(verificationpoliciesResource, verificationpoliciesKind, c.ns, opts), &v1alpha1.VerificationPolicyList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.VerificationPolicyList{ListMeta: obj.(*v1alpha1.VerificationPolicyList).ListMeta} + for _, item := range obj.(*v1alpha1.VerificationPolicyList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested verificationPolicies. +func (c *FakeVerificationPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(verificationpoliciesResource, c.ns, opts)) + +} + +// Create takes the representation of a verificationPolicy and creates it. Returns the server's representation of the verificationPolicy, and an error, if there is any. +func (c *FakeVerificationPolicies) Create(ctx context.Context, verificationPolicy *v1alpha1.VerificationPolicy, opts v1.CreateOptions) (result *v1alpha1.VerificationPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(verificationpoliciesResource, c.ns, verificationPolicy), &v1alpha1.VerificationPolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VerificationPolicy), err +} + +// Update takes the representation of a verificationPolicy and updates it. Returns the server's representation of the verificationPolicy, and an error, if there is any. +func (c *FakeVerificationPolicies) Update(ctx context.Context, verificationPolicy *v1alpha1.VerificationPolicy, opts v1.UpdateOptions) (result *v1alpha1.VerificationPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(verificationpoliciesResource, c.ns, verificationPolicy), &v1alpha1.VerificationPolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VerificationPolicy), err +} + +// Delete takes name of the verificationPolicy and deletes it. Returns an error if one occurs. +func (c *FakeVerificationPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(verificationpoliciesResource, c.ns, name, opts), &v1alpha1.VerificationPolicy{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeVerificationPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(verificationpoliciesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.VerificationPolicyList{}) + return err +} + +// Patch applies the patch and returns the patched verificationPolicy. +func (c *FakeVerificationPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VerificationPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(verificationpoliciesResource, c.ns, name, pt, data, subresources...), &v1alpha1.VerificationPolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VerificationPolicy), err +} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/generated_expansion.go b/vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/generated_expansion.go index 40814697cf..490c227c6d 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/generated_expansion.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/generated_expansion.go @@ -19,3 +19,5 @@ limitations under the License. package v1alpha1 type RunExpansion interface{} + +type VerificationPolicyExpansion interface{} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/pipeline_client.go b/vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/pipeline_client.go index 28d39482a6..19d91e935d 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/pipeline_client.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/pipeline_client.go @@ -29,6 +29,7 @@ import ( type TektonV1alpha1Interface interface { RESTClient() rest.Interface RunsGetter + VerificationPoliciesGetter } // TektonV1alpha1Client is used to interact with features provided by the tekton.dev group. @@ -40,6 +41,10 @@ func (c *TektonV1alpha1Client) Runs(namespace string) RunInterface { return newRuns(c, namespace) } +func (c *TektonV1alpha1Client) VerificationPolicies(namespace string) VerificationPolicyInterface { + return newVerificationPolicies(c, namespace) +} + // NewForConfig creates a new TektonV1alpha1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). diff --git a/vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/verificationpolicy.go b/vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/verificationpolicy.go new file mode 100644 index 0000000000..92f534093f --- /dev/null +++ b/vendor/github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/verificationpolicy.go @@ -0,0 +1,178 @@ +/* +Copyright 2020 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + scheme "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// VerificationPoliciesGetter has a method to return a VerificationPolicyInterface. +// A group's client should implement this interface. +type VerificationPoliciesGetter interface { + VerificationPolicies(namespace string) VerificationPolicyInterface +} + +// VerificationPolicyInterface has methods to work with VerificationPolicy resources. +type VerificationPolicyInterface interface { + Create(ctx context.Context, verificationPolicy *v1alpha1.VerificationPolicy, opts v1.CreateOptions) (*v1alpha1.VerificationPolicy, error) + Update(ctx context.Context, verificationPolicy *v1alpha1.VerificationPolicy, opts v1.UpdateOptions) (*v1alpha1.VerificationPolicy, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VerificationPolicy, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VerificationPolicyList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VerificationPolicy, err error) + VerificationPolicyExpansion +} + +// verificationPolicies implements VerificationPolicyInterface +type verificationPolicies struct { + client rest.Interface + ns string +} + +// newVerificationPolicies returns a VerificationPolicies +func newVerificationPolicies(c *TektonV1alpha1Client, namespace string) *verificationPolicies { + return &verificationPolicies{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the verificationPolicy, and returns the corresponding verificationPolicy object, and an error if there is any. +func (c *verificationPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VerificationPolicy, err error) { + result = &v1alpha1.VerificationPolicy{} + err = c.client.Get(). + Namespace(c.ns). + Resource("verificationpolicies"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of VerificationPolicies that match those selectors. +func (c *verificationPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VerificationPolicyList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.VerificationPolicyList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("verificationpolicies"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested verificationPolicies. +func (c *verificationPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("verificationpolicies"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a verificationPolicy and creates it. Returns the server's representation of the verificationPolicy, and an error, if there is any. +func (c *verificationPolicies) Create(ctx context.Context, verificationPolicy *v1alpha1.VerificationPolicy, opts v1.CreateOptions) (result *v1alpha1.VerificationPolicy, err error) { + result = &v1alpha1.VerificationPolicy{} + err = c.client.Post(). + Namespace(c.ns). + Resource("verificationpolicies"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(verificationPolicy). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a verificationPolicy and updates it. Returns the server's representation of the verificationPolicy, and an error, if there is any. +func (c *verificationPolicies) Update(ctx context.Context, verificationPolicy *v1alpha1.VerificationPolicy, opts v1.UpdateOptions) (result *v1alpha1.VerificationPolicy, err error) { + result = &v1alpha1.VerificationPolicy{} + err = c.client.Put(). + Namespace(c.ns). + Resource("verificationpolicies"). + Name(verificationPolicy.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(verificationPolicy). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the verificationPolicy and deletes it. Returns an error if one occurs. +func (c *verificationPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("verificationpolicies"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *verificationPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("verificationpolicies"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched verificationPolicy. +func (c *verificationPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VerificationPolicy, err error) { + result = &v1alpha1.VerificationPolicy{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("verificationpolicies"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/client/informers/externalversions/generic.go b/vendor/github.com/tektoncd/pipeline/pkg/client/informers/externalversions/generic.go index 3f3c58d271..50110a1fd2 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/client/informers/externalversions/generic.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/client/informers/externalversions/generic.go @@ -67,6 +67,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // Group=tekton.dev, Version=v1alpha1 case v1alpha1.SchemeGroupVersion.WithResource("runs"): return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1alpha1().Runs().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("verificationpolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1alpha1().VerificationPolicies().Informer()}, nil // Group=tekton.dev, Version=v1beta1 case v1beta1.SchemeGroupVersion.WithResource("clustertasks"): diff --git a/vendor/github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha1/interface.go b/vendor/github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha1/interface.go index 25a56f8134..c9b783d319 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha1/interface.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha1/interface.go @@ -26,6 +26,8 @@ import ( type Interface interface { // Runs returns a RunInformer. Runs() RunInformer + // VerificationPolicies returns a VerificationPolicyInformer. + VerificationPolicies() VerificationPolicyInformer } type version struct { @@ -43,3 +45,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (v *version) Runs() RunInformer { return &runInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } + +// VerificationPolicies returns a VerificationPolicyInformer. +func (v *version) VerificationPolicies() VerificationPolicyInformer { + return &verificationPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha1/verificationpolicy.go b/vendor/github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha1/verificationpolicy.go new file mode 100644 index 0000000000..622a6a030d --- /dev/null +++ b/vendor/github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha1/verificationpolicy.go @@ -0,0 +1,90 @@ +/* +Copyright 2020 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + pipelinev1alpha1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + versioned "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" + internalinterfaces "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// VerificationPolicyInformer provides access to a shared informer and lister for +// VerificationPolicies. +type VerificationPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.VerificationPolicyLister +} + +type verificationPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewVerificationPolicyInformer constructs a new informer for VerificationPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVerificationPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVerificationPolicyInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredVerificationPolicyInformer constructs a new informer for VerificationPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredVerificationPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TektonV1alpha1().VerificationPolicies(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TektonV1alpha1().VerificationPolicies(namespace).Watch(context.TODO(), options) + }, + }, + &pipelinev1alpha1.VerificationPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *verificationPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVerificationPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *verificationPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&pipelinev1alpha1.VerificationPolicy{}, f.defaultInformer) +} + +func (f *verificationPolicyInformer) Lister() v1alpha1.VerificationPolicyLister { + return v1alpha1.NewVerificationPolicyLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/client/injection/client/client.go b/vendor/github.com/tektoncd/pipeline/pkg/client/injection/client/client.go index 3104910cf6..67cd130ad4 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/client/injection/client/client.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/client/injection/client/client.go @@ -246,6 +246,137 @@ func (w *wrapTektonV1alpha1RunImpl) Watch(ctx context.Context, opts v1.ListOptio return nil, errors.New("NYI: Watch") } +func (w *wrapTektonV1alpha1) VerificationPolicies(namespace string) typedtektonv1alpha1.VerificationPolicyInterface { + return &wrapTektonV1alpha1VerificationPolicyImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "tekton.dev", + Version: "v1alpha1", + Resource: "verificationpolicies", + }), + + namespace: namespace, + } +} + +type wrapTektonV1alpha1VerificationPolicyImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedtektonv1alpha1.VerificationPolicyInterface = (*wrapTektonV1alpha1VerificationPolicyImpl)(nil) + +func (w *wrapTektonV1alpha1VerificationPolicyImpl) Create(ctx context.Context, in *v1alpha1.VerificationPolicy, opts v1.CreateOptions) (*v1alpha1.VerificationPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "tekton.dev", + Version: "v1alpha1", + Kind: "VerificationPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1alpha1.VerificationPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapTektonV1alpha1VerificationPolicyImpl) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapTektonV1alpha1VerificationPolicyImpl) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapTektonV1alpha1VerificationPolicyImpl) Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VerificationPolicy, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &v1alpha1.VerificationPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapTektonV1alpha1VerificationPolicyImpl) List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VerificationPolicyList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &v1alpha1.VerificationPolicyList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapTektonV1alpha1VerificationPolicyImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VerificationPolicy, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &v1alpha1.VerificationPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapTektonV1alpha1VerificationPolicyImpl) Update(ctx context.Context, in *v1alpha1.VerificationPolicy, opts v1.UpdateOptions) (*v1alpha1.VerificationPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "tekton.dev", + Version: "v1alpha1", + Kind: "VerificationPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1alpha1.VerificationPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapTektonV1alpha1VerificationPolicyImpl) UpdateStatus(ctx context.Context, in *v1alpha1.VerificationPolicy, opts v1.UpdateOptions) (*v1alpha1.VerificationPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "tekton.dev", + Version: "v1alpha1", + Kind: "VerificationPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &v1alpha1.VerificationPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapTektonV1alpha1VerificationPolicyImpl) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + // TektonV1beta1 retrieves the TektonV1beta1Client func (w *wrapClient) TektonV1beta1() typedtektonv1beta1.TektonV1beta1Interface { return &wrapTektonV1beta1{ diff --git a/vendor/github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha1/verificationpolicy/fake/fake.go b/vendor/github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha1/verificationpolicy/fake/fake.go new file mode 100644 index 0000000000..e64a59090b --- /dev/null +++ b/vendor/github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha1/verificationpolicy/fake/fake.go @@ -0,0 +1,40 @@ +/* +Copyright 2020 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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + context "context" + + fake "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory/fake" + verificationpolicy "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha1/verificationpolicy" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = verificationpolicy.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Tekton().V1alpha1().VerificationPolicies() + return context.WithValue(ctx, verificationpolicy.Key{}, inf), inf.Informer() +} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha1/verificationpolicy/verificationpolicy.go b/vendor/github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha1/verificationpolicy/verificationpolicy.go new file mode 100644 index 0000000000..04480ee8ea --- /dev/null +++ b/vendor/github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha1/verificationpolicy/verificationpolicy.go @@ -0,0 +1,116 @@ +/* +Copyright 2020 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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package verificationpolicy + +import ( + context "context" + + apispipelinev1alpha1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + versioned "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" + v1alpha1 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha1" + client "github.com/tektoncd/pipeline/pkg/client/injection/client" + factory "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory" + pipelinev1alpha1 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + cache "k8s.io/client-go/tools/cache" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) + injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Tekton().V1alpha1().VerificationPolicies() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +func withDynamicInformer(ctx context.Context) context.Context { + inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)} + return context.WithValue(ctx, Key{}, inf) +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha1.VerificationPolicyInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha1.VerificationPolicyInformer from context.") + } + return untyped.(v1alpha1.VerificationPolicyInformer) +} + +type wrapper struct { + client versioned.Interface + + namespace string + + resourceVersion string +} + +var _ v1alpha1.VerificationPolicyInformer = (*wrapper)(nil) +var _ pipelinev1alpha1.VerificationPolicyLister = (*wrapper)(nil) + +func (w *wrapper) Informer() cache.SharedIndexInformer { + return cache.NewSharedIndexInformer(nil, &apispipelinev1alpha1.VerificationPolicy{}, 0, nil) +} + +func (w *wrapper) Lister() pipelinev1alpha1.VerificationPolicyLister { + return w +} + +func (w *wrapper) VerificationPolicies(namespace string) pipelinev1alpha1.VerificationPolicyNamespaceLister { + return &wrapper{client: w.client, namespace: namespace, resourceVersion: w.resourceVersion} +} + +// SetResourceVersion allows consumers to adjust the minimum resourceVersion +// used by the underlying client. It is not accessible via the standard +// lister interface, but can be accessed through a user-defined interface and +// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter) +func (w *wrapper) SetResourceVersion(resourceVersion string) { + w.resourceVersion = resourceVersion +} + +func (w *wrapper) List(selector labels.Selector) (ret []*apispipelinev1alpha1.VerificationPolicy, err error) { + lo, err := w.client.TektonV1alpha1().VerificationPolicies(w.namespace).List(context.TODO(), v1.ListOptions{ + LabelSelector: selector.String(), + ResourceVersion: w.resourceVersion, + }) + if err != nil { + return nil, err + } + for idx := range lo.Items { + ret = append(ret, &lo.Items[idx]) + } + return ret, nil +} + +func (w *wrapper) Get(name string) (*apispipelinev1alpha1.VerificationPolicy, error) { + return w.client.TektonV1alpha1().VerificationPolicies(w.namespace).Get(context.TODO(), name, v1.GetOptions{ + ResourceVersion: w.resourceVersion, + }) +} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha1/expansion_generated.go b/vendor/github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha1/expansion_generated.go index ef742ea349..459ebc6ce5 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha1/expansion_generated.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha1/expansion_generated.go @@ -25,3 +25,11 @@ type RunListerExpansion interface{} // RunNamespaceListerExpansion allows custom methods to be added to // RunNamespaceLister. type RunNamespaceListerExpansion interface{} + +// VerificationPolicyListerExpansion allows custom methods to be added to +// VerificationPolicyLister. +type VerificationPolicyListerExpansion interface{} + +// VerificationPolicyNamespaceListerExpansion allows custom methods to be added to +// VerificationPolicyNamespaceLister. +type VerificationPolicyNamespaceListerExpansion interface{} diff --git a/vendor/github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha1/verificationpolicy.go b/vendor/github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha1/verificationpolicy.go new file mode 100644 index 0000000000..7682fa51ba --- /dev/null +++ b/vendor/github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha1/verificationpolicy.go @@ -0,0 +1,99 @@ +/* +Copyright 2020 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// VerificationPolicyLister helps list VerificationPolicies. +// All objects returned here must be treated as read-only. +type VerificationPolicyLister interface { + // List lists all VerificationPolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VerificationPolicy, err error) + // VerificationPolicies returns an object that can list and get VerificationPolicies. + VerificationPolicies(namespace string) VerificationPolicyNamespaceLister + VerificationPolicyListerExpansion +} + +// verificationPolicyLister implements the VerificationPolicyLister interface. +type verificationPolicyLister struct { + indexer cache.Indexer +} + +// NewVerificationPolicyLister returns a new VerificationPolicyLister. +func NewVerificationPolicyLister(indexer cache.Indexer) VerificationPolicyLister { + return &verificationPolicyLister{indexer: indexer} +} + +// List lists all VerificationPolicies in the indexer. +func (s *verificationPolicyLister) List(selector labels.Selector) (ret []*v1alpha1.VerificationPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.VerificationPolicy)) + }) + return ret, err +} + +// VerificationPolicies returns an object that can list and get VerificationPolicies. +func (s *verificationPolicyLister) VerificationPolicies(namespace string) VerificationPolicyNamespaceLister { + return verificationPolicyNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// VerificationPolicyNamespaceLister helps list and get VerificationPolicies. +// All objects returned here must be treated as read-only. +type VerificationPolicyNamespaceLister interface { + // List lists all VerificationPolicies in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VerificationPolicy, err error) + // Get retrieves the VerificationPolicy from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.VerificationPolicy, error) + VerificationPolicyNamespaceListerExpansion +} + +// verificationPolicyNamespaceLister implements the VerificationPolicyNamespaceLister +// interface. +type verificationPolicyNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all VerificationPolicies in the indexer for a given namespace. +func (s verificationPolicyNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.VerificationPolicy, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.VerificationPolicy)) + }) + return ret, err +} + +// Get retrieves the VerificationPolicy from the indexer for a given namespace and name. +func (s verificationPolicyNamespaceLister) Get(name string) (*v1alpha1.VerificationPolicy, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("verificationpolicy"), name) + } + return obj.(*v1alpha1.VerificationPolicy), nil +} 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 0a3d3b27ef..85087f8430 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 @@ -23,6 +23,7 @@ import ( cloudevents "github.com/cloudevents/sdk-go/v2" "github.com/hashicorp/go-multierror" + "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" resource "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" @@ -30,9 +31,11 @@ import ( "github.com/tektoncd/pipeline/pkg/reconciler/events/cache" "go.uber.org/zap" corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/equality" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/utils/clock" + "knative.dev/pkg/apis" controller "knative.dev/pkg/controller" "knative.dev/pkg/logging" ) @@ -73,6 +76,43 @@ func cloudEventDeliveryFromTargets(targets []string) []v1beta1.CloudEventDeliver return nil } +// EmitCloudEvents emits CloudEvents (only) for object +func EmitCloudEvents(ctx context.Context, object runtime.Object) { + logger := logging.FromContext(ctx) + configs := config.FromContextOrDefaults(ctx) + sendCloudEvents := (configs.Defaults.DefaultCloudEventsSink != "") + if sendCloudEvents { + ctx = cloudevents.ContextWithTarget(ctx, configs.Defaults.DefaultCloudEventsSink) + } + + if sendCloudEvents { + err := SendCloudEventWithRetries(ctx, object) + if err != nil { + logger.Warnf("Failed to emit cloud events %v", err.Error()) + } + } +} + +// EmitCloudEventsWhenConditionChange emits CloudEvents when there is a change in condition +func EmitCloudEventsWhenConditionChange(ctx context.Context, beforeCondition *apis.Condition, afterCondition *apis.Condition, object runtime.Object) { + logger := logging.FromContext(ctx) + configs := config.FromContextOrDefaults(ctx) + sendCloudEvents := (configs.Defaults.DefaultCloudEventsSink != "") + if sendCloudEvents { + ctx = cloudevents.ContextWithTarget(ctx, configs.Defaults.DefaultCloudEventsSink) + } + + if sendCloudEvents { + // Only send events if the new condition represents a change + if !equality.Semantic.DeepEqual(beforeCondition, afterCondition) { + err := SendCloudEventWithRetries(ctx, object) + if err != nil { + logger.Warnf("Failed to emit cloud events %v", err.Error()) + } + } + } +} + // SendCloudEvents is used by the TaskRun controller to send cloud events once // the TaskRun is complete. `tr` is used to obtain the list of targets func SendCloudEvents(tr *v1beta1.TaskRun, ceclient CEClient, logger *zap.SugaredLogger, c clock.PassiveClock) error { diff --git a/vendor/github.com/tektoncd/pipeline/pkg/reconciler/events/cloudevent/interface.go b/vendor/github.com/tektoncd/pipeline/pkg/reconciler/events/cloudevent/interface.go index c060c52239..cd02c72c57 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/reconciler/events/cloudevent/interface.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/reconciler/events/cloudevent/interface.go @@ -24,7 +24,6 @@ import ( // objectWithCondition is implemented by TaskRun, PipelineRun and Run type objectWithCondition interface { - // Object requires GetObjectKind() and DeepCopyObject() runtime.Object diff --git a/vendor/github.com/tektoncd/pipeline/pkg/remote/oci/resolver.go b/vendor/github.com/tektoncd/pipeline/pkg/remote/oci/resolver.go index af49f4bd70..d55f4a88d1 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/remote/oci/resolver.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/remote/oci/resolver.go @@ -21,7 +21,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "strings" "time" @@ -210,7 +209,7 @@ func readRawLayer(layer v1.Layer) (runtime.Object, error) { } defer rc.Close() - contents, err := ioutil.ReadAll(rc) + contents, err := io.ReadAll(rc) if err != nil { return nil, fmt.Errorf("could not read contents of image layer: %w", err) } diff --git a/vendor/github.com/tektoncd/pipeline/pkg/status/status.go b/vendor/github.com/tektoncd/pipeline/pkg/status/status.go index 4952ab2763..72ed048cc4 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/status/status.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/status/status.go @@ -20,8 +20,8 @@ import ( "context" "fmt" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" + runv1beta1 "github.com/tektoncd/pipeline/pkg/apis/run/v1beta1" "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -45,22 +45,36 @@ func GetTaskRunStatusForPipelineTask(ctx context.Context, client versioned.Inter return &tr.Status, nil } -// GetRunStatusForPipelineTask takes a minimal embedded status child reference and returns the actual RunStatus for the -// PipelineTask. It returns an error if the child reference's kind isn't Run. -func GetRunStatusForPipelineTask(ctx context.Context, client versioned.Interface, ns string, childRef v1beta1.ChildStatusReference) (*v1alpha1.RunStatus, error) { - if childRef.Kind != "Run" { - return nil, fmt.Errorf("could not fetch status for PipelineTask %s: should have kind Run, but is %s", childRef.PipelineTaskName, childRef.Kind) - } +// GetRunStatusForPipelineTask takes a minimal embedded status child reference and returns the actual CustomRunStatus for the +// PipelineTask. It returns an error if the child reference's kind isn't CustomRun. +func GetRunStatusForPipelineTask(ctx context.Context, client versioned.Interface, ns string, childRef v1beta1.ChildStatusReference) (*v1beta1.CustomRunStatus, error) { + var runStatus *v1beta1.CustomRunStatus - r, err := client.TektonV1alpha1().Runs(ns).Get(ctx, childRef.Name, metav1.GetOptions{}) - if err != nil && !errors.IsNotFound(err) { - return nil, err - } - if r == nil { - return nil, nil + switch childRef.Kind { + case "CustomRun": + r, err := client.TektonV1beta1().CustomRuns(ns).Get(ctx, childRef.Name, metav1.GetOptions{}) + if err != nil && !errors.IsNotFound(err) { + return nil, err + } + if r == nil { + return nil, nil + } + runStatus = &r.Status + case "Run": + r, err := client.TektonV1alpha1().Runs(ns).Get(ctx, childRef.Name, metav1.GetOptions{}) + if err != nil && !errors.IsNotFound(err) { + return nil, err + } + if r == nil { + return nil, nil + } + asCustomRunStatus := runv1beta1.FromRunStatus(r.Status) + runStatus = &asCustomRunStatus + default: + return nil, fmt.Errorf("could not fetch status for PipelineTask %s: should have kind Run or CustomRun, but is %s", childRef.PipelineTaskName, childRef.Kind) } - return &r.Status, nil + return runStatus, nil } // GetFullPipelineTaskStatuses returns populated TaskRun and Run status maps for a PipelineRun from its ChildReferences. @@ -96,6 +110,20 @@ func GetFullPipelineTaskStatuses(ctx context.Context, client versioned.Interface if tr != nil { trStatuses[cr.Name].Status = &tr.Status } + case "CustomRun": + r, err := client.TektonV1beta1().CustomRuns(ns).Get(ctx, cr.Name, metav1.GetOptions{}) + if err != nil && !errors.IsNotFound(err) { + return nil, nil, err + } + + runStatuses[cr.Name] = &v1beta1.PipelineRunRunStatus{ + PipelineTaskName: cr.PipelineTaskName, + WhenExpressions: cr.WhenExpressions, + } + + if r != nil { + runStatuses[cr.Name].Status = &r.Status + } case "Run": r, err := client.TektonV1alpha1().Runs(ns).Get(ctx, cr.Name, metav1.GetOptions{}) if err != nil && !errors.IsNotFound(err) { @@ -108,7 +136,8 @@ func GetFullPipelineTaskStatuses(ctx context.Context, client versioned.Interface } if r != nil { - runStatuses[cr.Name].Status = &r.Status + asCustomRunStatus := runv1beta1.FromRunStatus(r.Status) + runStatuses[cr.Name].Status = &asCustomRunStatus } default: // Don't do anything for unknown types. diff --git a/vendor/github.com/tektoncd/pipeline/pkg/substitution/substitution.go b/vendor/github.com/tektoncd/pipeline/pkg/substitution/substitution.go index 78807fc33a..a2611061c0 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/substitution/substitution.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/substitution/substitution.go @@ -72,7 +72,6 @@ func ValidateVariableP(value, prefix string, vars sets.String) *apis.FieldError Message: errString, Paths: []string{""}, } - } for _, v := range vs { v = TrimArrayIndex(v) @@ -112,7 +111,6 @@ func ValidateVariableProhibitedP(value, prefix string, vars sets.String) *apis.F Message: errString, Paths: []string{""}, } - } for _, v := range vs { v = strings.TrimSuffix(v, "[*]") @@ -180,7 +178,6 @@ func ValidateVariableIsolatedP(value, prefix string, vars sets.String) *apis.Fie Message: errString, Paths: []string{""}, } - } firstMatch, _ := extractExpressionFromString(value, prefix) for _, v := range vs { diff --git a/vendor/github.com/tektoncd/pipeline/test/README.md b/vendor/github.com/tektoncd/pipeline/test/README.md index b3990a7ca9..f184c095d6 100644 --- a/vendor/github.com/tektoncd/pipeline/test/README.md +++ b/vendor/github.com/tektoncd/pipeline/test/README.md @@ -316,7 +316,7 @@ The `Clients` struct contains initialized clients for accessing: For example, to create a `Pipeline`: ```bash -_, err = clients.PipelineClient.Pipelines.Create(test.Route(namespaceName, pipelineName)) +_, err = clients.V1beta1PipelineClient.Pipelines.Create(test.Route(namespaceName, pipelineName)) ``` And you can use the client to clean up resources created by your test (e.g. in @@ -366,7 +366,7 @@ err = WaitForTaskRunState(c, hwTaskRunName, func(tr *v1alpha1.TaskRun) (bool, er return true, nil } return false, nil -}, "TaskRunHasCondition") +}, "TaskRunHasCondition", v1beta1Version) ``` _[Metrics will be emitted](https://github.com/knative/pkg/tree/master/test#emit-metrics) diff --git a/vendor/github.com/tektoncd/pipeline/test/build_logs.go b/vendor/github.com/tektoncd/pipeline/test/build_logs.go index 74b1905409..018f8a190b 100644 --- a/vendor/github.com/tektoncd/pipeline/test/build_logs.go +++ b/vendor/github.com/tektoncd/pipeline/test/build_logs.go @@ -19,7 +19,7 @@ package test import ( "context" "fmt" - "io/ioutil" + "io" "strings" corev1 "k8s.io/api/core/v1" @@ -65,7 +65,7 @@ func getContainerLogsFromPod(ctx context.Context, c kubernetes.Interface, pod, c if err != nil { return "", err } - bs, err := ioutil.ReadAll(rc) + bs, err := io.ReadAll(rc) if err != nil { return "", err } diff --git a/vendor/github.com/tektoncd/pipeline/test/clients.go b/vendor/github.com/tektoncd/pipeline/test/clients.go index 984c957474..39a5c561da 100644 --- a/vendor/github.com/tektoncd/pipeline/test/clients.go +++ b/vendor/github.com/tektoncd/pipeline/test/clients.go @@ -43,6 +43,7 @@ import ( "testing" "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" + v1 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1" "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1" "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1beta1" resolutionversioned "github.com/tektoncd/pipeline/pkg/client/resolution/clientset/versioned" @@ -57,14 +58,20 @@ import ( type clients struct { KubeClient kubernetes.Interface - V1beta1PipelineClient v1beta1.PipelineInterface - V1beta1ClusterTaskClient v1beta1.ClusterTaskInterface - V1beta1TaskClient v1beta1.TaskInterface - V1beta1TaskRunClient v1beta1.TaskRunInterface - V1beta1PipelineRunClient v1beta1.PipelineRunInterface - V1alpha1PipelineResourceClient resourcev1alpha1.PipelineResourceInterface - V1alpha1RunClient v1alpha1.RunInterface - V1alpha1ResolutionRequestclient resolutionv1alpha1.ResolutionRequestInterface + V1beta1PipelineClient v1beta1.PipelineInterface + V1beta1ClusterTaskClient v1beta1.ClusterTaskInterface + V1beta1TaskClient v1beta1.TaskInterface + V1beta1TaskRunClient v1beta1.TaskRunInterface + V1beta1PipelineRunClient v1beta1.PipelineRunInterface + V1beta1CustomRunClient v1beta1.CustomRunInterface + V1alpha1PipelineResourceClient resourcev1alpha1.PipelineResourceInterface + V1alpha1RunClient v1alpha1.RunInterface + V1alpha1ResolutionRequestclient resolutionv1alpha1.ResolutionRequestInterface + V1alpha1VerificationPolicyClient v1alpha1.VerificationPolicyInterface + V1PipelineClient v1.PipelineInterface + V1TaskClient v1.TaskInterface + V1TaskRunClient v1.TaskRunInterface + V1PipelineRunClient v1.PipelineRunInterface } // newClients instantiates and returns several clientsets required for making requests to the @@ -103,8 +110,14 @@ func newClients(t *testing.T, configPath, clusterName, namespace string) *client c.V1beta1TaskClient = cs.TektonV1beta1().Tasks(namespace) c.V1beta1TaskRunClient = cs.TektonV1beta1().TaskRuns(namespace) c.V1beta1PipelineRunClient = cs.TektonV1beta1().PipelineRuns(namespace) + c.V1beta1CustomRunClient = cs.TektonV1beta1().CustomRuns(namespace) c.V1alpha1PipelineResourceClient = rcs.TektonV1alpha1().PipelineResources(namespace) c.V1alpha1RunClient = cs.TektonV1alpha1().Runs(namespace) c.V1alpha1ResolutionRequestclient = rrcs.ResolutionV1alpha1().ResolutionRequests(namespace) + c.V1alpha1VerificationPolicyClient = cs.TektonV1alpha1().VerificationPolicies(namespace) + c.V1PipelineClient = cs.TektonV1().Pipelines(namespace) + c.V1TaskClient = cs.TektonV1().Tasks(namespace) + c.V1TaskRunClient = cs.TektonV1().TaskRuns(namespace) + c.V1PipelineRunClient = cs.TektonV1().PipelineRuns(namespace) return c } diff --git a/vendor/github.com/tektoncd/pipeline/test/controller.go b/vendor/github.com/tektoncd/pipeline/test/controller.go index ff3f3f7a20..bcea1ed5e4 100644 --- a/vendor/github.com/tektoncd/pipeline/test/controller.go +++ b/vendor/github.com/tektoncd/pipeline/test/controller.go @@ -33,6 +33,7 @@ import ( informersv1beta1 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1beta1" fakepipelineclient "github.com/tektoncd/pipeline/pkg/client/injection/client/fake" fakeruninformer "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha1/run/fake" + fakeverificationpolicyinformer "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha1/verificationpolicy/fake" fakeclustertaskinformer "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1beta1/clustertask/fake" fakecustomruninformer "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1beta1/customrun/fake" fakepipelineinformer "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1beta1/pipeline/fake" @@ -86,6 +87,7 @@ type Data struct { LimitRange []*corev1.LimitRange ResolutionRequests []*resolutionv1alpha1.ResolutionRequest ExpectedCloudEventCount int + VerificationPolicies []*v1alpha1.VerificationPolicy } // Clients holds references to clients which are useful for reconciler tests. @@ -99,19 +101,20 @@ type Clients struct { // Informers holds references to informers which are useful for reconciler tests. type Informers struct { - PipelineRun informersv1beta1.PipelineRunInformer - Pipeline informersv1beta1.PipelineInformer - TaskRun informersv1beta1.TaskRunInformer - Run informersv1alpha1.RunInformer - CustomRun informersv1beta1.CustomRunInformer - Task informersv1beta1.TaskInformer - ClusterTask informersv1beta1.ClusterTaskInformer - PipelineResource resourceinformersv1alpha1.PipelineResourceInformer - Pod coreinformers.PodInformer - ConfigMap coreinformers.ConfigMapInformer - ServiceAccount coreinformers.ServiceAccountInformer - LimitRange coreinformers.LimitRangeInformer - ResolutionRequest resolutioninformersv1alpha1.ResolutionRequestInformer + PipelineRun informersv1beta1.PipelineRunInformer + Pipeline informersv1beta1.PipelineInformer + TaskRun informersv1beta1.TaskRunInformer + Run informersv1alpha1.RunInformer + CustomRun informersv1beta1.CustomRunInformer + Task informersv1beta1.TaskInformer + ClusterTask informersv1beta1.ClusterTaskInformer + PipelineResource resourceinformersv1alpha1.PipelineResourceInformer + Pod coreinformers.PodInformer + ConfigMap coreinformers.ConfigMapInformer + ServiceAccount coreinformers.ServiceAccountInformer + LimitRange coreinformers.LimitRangeInformer + ResolutionRequest resolutioninformersv1alpha1.ResolutionRequestInformer + VerificationPolicy informersv1alpha1.VerificationPolicyInformer } // Assets holds references to the controller, logs, clients, and informers. @@ -183,19 +186,20 @@ func SeedTestData(t *testing.T, ctx context.Context, d Data) (Clients, Informers PrependResourceVersionReactor(&c.Pipeline.Fake) i := Informers{ - PipelineRun: fakepipelineruninformer.Get(ctx), - Pipeline: fakepipelineinformer.Get(ctx), - TaskRun: faketaskruninformer.Get(ctx), - Run: fakeruninformer.Get(ctx), - CustomRun: fakecustomruninformer.Get(ctx), - Task: faketaskinformer.Get(ctx), - ClusterTask: fakeclustertaskinformer.Get(ctx), - PipelineResource: fakeresourceinformer.Get(ctx), - Pod: fakefilteredpodinformer.Get(ctx, v1beta1.ManagedByLabelKey), - ConfigMap: fakeconfigmapinformer.Get(ctx), - ServiceAccount: fakeserviceaccountinformer.Get(ctx), - LimitRange: fakelimitrangeinformer.Get(ctx), - ResolutionRequest: fakeresolutionrequestinformer.Get(ctx), + PipelineRun: fakepipelineruninformer.Get(ctx), + Pipeline: fakepipelineinformer.Get(ctx), + TaskRun: faketaskruninformer.Get(ctx), + Run: fakeruninformer.Get(ctx), + CustomRun: fakecustomruninformer.Get(ctx), + Task: faketaskinformer.Get(ctx), + ClusterTask: fakeclustertaskinformer.Get(ctx), + PipelineResource: fakeresourceinformer.Get(ctx), + Pod: fakefilteredpodinformer.Get(ctx, v1beta1.ManagedByLabelKey), + ConfigMap: fakeconfigmapinformer.Get(ctx), + ServiceAccount: fakeserviceaccountinformer.Get(ctx), + LimitRange: fakelimitrangeinformer.Get(ctx), + ResolutionRequest: fakeresolutionrequestinformer.Get(ctx), + VerificationPolicy: fakeverificationpolicyinformer.Get(ctx), } // Attach reactors that add resource mutations to the appropriate @@ -252,8 +256,8 @@ func SeedTestData(t *testing.T, ctx context.Context, d Data) (Clients, Informers } c.Pipeline.PrependReactor("*", "customruns", AddToInformer(t, i.CustomRun.Informer().GetIndexer())) for _, customRun := range d.CustomRuns { - run := customRun.DeepCopy() // Avoid assumptions that the informer's copy is modified. - if _, err := c.Pipeline.TektonV1beta1().CustomRuns(run.Namespace).Create(ctx, run, metav1.CreateOptions{}); err != nil { + customRun := customRun.DeepCopy() // Avoid assumptions that the informer's copy is modified. + if _, err := c.Pipeline.TektonV1beta1().CustomRuns(customRun.Namespace).Create(ctx, customRun, metav1.CreateOptions{}); err != nil { t.Fatal(err) } } @@ -291,6 +295,14 @@ func SeedTestData(t *testing.T, ctx context.Context, d Data) (Clients, Informers t.Fatal(err) } } + + c.Pipeline.PrependReactor("*", "verificationpolicies", AddToInformer(t, i.VerificationPolicy.Informer().GetIndexer())) + for _, vp := range d.VerificationPolicies { + vp := vp.DeepCopy() // Avoid assumptions that the informer's copy is modified. + if _, err := c.Pipeline.TektonV1alpha1().VerificationPolicies(vp.Namespace).Create(ctx, vp, metav1.CreateOptions{}); err != nil { + t.Fatal(err) + } + } c.Pipeline.ClearActions() c.Kube.ClearActions() c.ResolutionRequests.ClearActions() diff --git a/vendor/github.com/tektoncd/pipeline/test/e2e-common.sh b/vendor/github.com/tektoncd/pipeline/test/e2e-common.sh index 5ef47f77e8..66a4167e01 100644 --- a/vendor/github.com/tektoncd/pipeline/test/e2e-common.sh +++ b/vendor/github.com/tektoncd/pipeline/test/e2e-common.sh @@ -22,6 +22,7 @@ function install_pipeline_crd() { echo ">> Deploying Tekton Pipelines" local ko_target="$(mktemp)" ko resolve -R -f config/ > "${ko_target}" || fail_test "Pipeline image resolve failed" + ko resolve -R -f optional_config/ >> "${ko_target}" || fail_test "Pod log access resolve failed" cat "${ko_target}" | sed -e 's%"level": "info"%"level": "debug"%' \ | sed -e 's%loglevel.controller: "info"%loglevel.controller: "debug"%' \ | sed -e 's%loglevel.webhook: "info"%loglevel.webhook: "debug"%' \ @@ -29,6 +30,7 @@ function install_pipeline_crd() { verify_pipeline_installation verify_resolvers_installation + verify_log_access_enabled export SYSTEM_NAMESPACE=tekton-pipelines } @@ -62,6 +64,19 @@ function verify_resolvers_installation() { wait_until_pods_running tekton-pipelines-resolvers || fail_test "Tekton Pipeline Resolvers did not come up" } +function verify_log_access_enabled() { + var=$(kubectl get clusterroles | grep tekton-pipelines-controller-pod-log-access) + if [ -z "$var" ] + then + fail_test "Failed to create clusterrole granting pod/logs access to the tekton controller." + fi + var=$(kubectl get clusterrolebindings | grep tekton-pipelines-controller-pod-log-access) + if [ -z "$var" ] + then + fail_test "Failed to create clusterrole binding granting pod/logs access to the tekton controller." + fi +} + function uninstall_pipeline_crd() { echo ">> Uninstalling Tekton Pipelines" ko delete --ignore-not-found=true -R -f config/ diff --git a/vendor/github.com/tektoncd/pipeline/test/e2e-tests-kind-prow-alpha.env b/vendor/github.com/tektoncd/pipeline/test/e2e-tests-kind-prow-alpha.env index eacb0ef5eb..b1db6ff354 100644 --- a/vendor/github.com/tektoncd/pipeline/test/e2e-tests-kind-prow-alpha.env +++ b/vendor/github.com/tektoncd/pipeline/test/e2e-tests-kind-prow-alpha.env @@ -4,3 +4,4 @@ EMBEDDED_STATUS_GATE=minimal RUN_YAML_TESTS=true KO_DOCKER_REPO=registry.local:5000 E2E_GO_TEST_TIMEOUT=40m +RESULTS_FROM=sidecar-logs diff --git a/vendor/github.com/tektoncd/pipeline/test/e2e-tests.sh b/vendor/github.com/tektoncd/pipeline/test/e2e-tests.sh index b553452f46..459cd7ecbd 100644 --- a/vendor/github.com/tektoncd/pipeline/test/e2e-tests.sh +++ b/vendor/github.com/tektoncd/pipeline/test/e2e-tests.sh @@ -27,6 +27,7 @@ SKIP_INITIALIZE=${SKIP_INITIALIZE:="false"} RUN_YAML_TESTS=${RUN_YAML_TESTS:="true"} SKIP_GO_E2E_TESTS=${SKIP_GO_E2E_TESTS:="false"} E2E_GO_TEST_TIMEOUT=${E2E_GO_TEST_TIMEOUT:="20m"} +RESULTS_FROM=${RESULTS_FROM:-termination-message} failed=0 # Script entry point. @@ -75,6 +76,18 @@ function set_embedded_status() { kubectl patch configmap feature-flags -n tekton-pipelines -p "$jsonpatch" } +function set_result_extraction_method() { + local method="$1" + if [ "$method" != "termination-message" ] && [ "$method" != "sidecar-logs" ]; then + printf "Invalid value for results-from %s\n" ${method} + exit 255 + fi + printf "Setting results-from to %s\n", ${method} + jsonpatch=$(printf "{\"data\": {\"results-from\": \"%s\"}}" $1) + echo "feature-flags ConfigMap patch: ${jsonpatch}" + kubectl patch configmap feature-flags -n tekton-pipelines -p "$jsonpatch" +} + function run_e2e() { # Run the integration tests header "Running Go e2e tests" @@ -93,6 +106,7 @@ function run_e2e() { set_feature_gate "$PIPELINE_FEATURE_GATE" set_embedded_status "$EMBEDDED_STATUS_GATE" +set_result_extraction_method "$RESULTS_FROM" run_e2e (( failed )) && fail_test diff --git a/vendor/github.com/tektoncd/pipeline/test/multiarch_utils.go b/vendor/github.com/tektoncd/pipeline/test/multiarch_utils.go index 856dbf462c..9bb55c29d9 100644 --- a/vendor/github.com/tektoncd/pipeline/test/multiarch_utils.go +++ b/vendor/github.com/tektoncd/pipeline/test/multiarch_utils.go @@ -18,7 +18,6 @@ package test import ( "os" - "regexp" "runtime" "testing" @@ -26,9 +25,8 @@ import ( ) var ( - imageNames = initImageNames() - excludedTests = initExcludedTests() - imagesMappingRE map[*regexp.Regexp][]byte + imageNames = initImageNames() + excludedTests = initExcludedTests() ) const ( @@ -42,10 +40,6 @@ const ( dockerizeImage ) -func init() { - imagesMappingRE = getImagesMappingRE() -} - // getTestArch returns architecture of the cluster where test suites will be executed. // default value is similar to build architecture, TEST_RUNTIME_ARCH is used when test target cluster has another architecture func getTestArch() string { @@ -83,60 +77,13 @@ func initImageNames() map[int]string { } } -// getImagesMappingRE generates the map ready to search and replace image names with regexp for examples files. -// search is done using "image: " pattern. -func getImagesMappingRE() map[*regexp.Regexp][]byte { - imageNamesMapping := imageNamesMapping() - imageMappingRE := make(map[*regexp.Regexp][]byte, len(imageNamesMapping)) - - for existingImage, archSpecificImage := range imageNamesMapping { - imageMappingRE[regexp.MustCompile("(?im)image: "+existingImage+"$")] = []byte("image: " + archSpecificImage) - imageMappingRE[regexp.MustCompile("(?im)default: "+existingImage+"$")] = []byte("default: " + archSpecificImage) - } - - return imageMappingRE -} - -// imageNamesMapping provides mapping between image name in the examples yaml files and desired image name for specific arch. -// by default empty map is returned. -func imageNamesMapping() map[string]string { - - switch getTestArch() { - case "s390x": - return map[string]string{ - "registry": getTestImage(registryImage), - "node": "node:alpine3.11", - "gcr.io/cloud-builders/git": "alpine/git:latest", - "docker:dind": "ibmcom/docker-s390x:20.10", - "docker": "docker:18.06.3", - "mikefarah/yq:3": "danielxlee/yq:2.4.0", - "stedolan/jq": "ibmcom/jq-s390x:latest", - "amd64/ubuntu": "s390x/ubuntu", - "gcr.io/kaniko-project/executor:v1.3.0": getTestImage(kanikoImage), - } - case "ppc64le": - return map[string]string{ - "registry": getTestImage(registryImage), - "node": "node:alpine3.11", - "gcr.io/cloud-builders/git": "alpine/git:latest", - "docker:dind": "ibmcom/docker-ppc64le:19.03-dind", - "docker": "docker:18.06.3", - "mikefarah/yq:3": "danielxlee/yq:2.4.0", - "stedolan/jq": "ibmcom/jq-ppc64le:latest", - "gcr.io/kaniko-project/executor:v1.3.0": getTestImage(kanikoImage), - } - - } - - return make(map[string]string) -} - // initExcludedTests provides list of excluded tests for e2e and exanples tests func initExcludedTests() sets.String { - switch getTestArch() { case "s390x": return sets.NewString( + // Git resolver test using local Gitea instance + "TestGitResolver_API", // examples "TestExamples/v1alpha1/taskruns/gcs-resource", "TestExamples/v1beta1/taskruns/gcs-resource", @@ -144,6 +91,8 @@ func initExcludedTests() sets.String { ) case "ppc64le": return sets.NewString( + // Git resolver test using local Gitea instance + "TestGitResolver_API", // examples "TestExamples/v1alpha1/taskruns/gcs-resource", "TestExamples/v1beta1/taskruns/gcs-resource", diff --git a/vendor/github.com/tektoncd/pipeline/test/parse/yaml.go b/vendor/github.com/tektoncd/pipeline/test/parse/yaml.go index 9b50a3c159..dcbaa6540f 100644 --- a/vendor/github.com/tektoncd/pipeline/test/parse/yaml.go +++ b/vendor/github.com/tektoncd/pipeline/test/parse/yaml.go @@ -16,6 +16,7 @@ package parse import ( "testing" + v1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" resourcev1alpha1 "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" @@ -34,6 +35,16 @@ kind: TaskRun return &tr } +// MustParseV1TaskRun takes YAML and parses it into a *v1.TaskRun +func MustParseV1TaskRun(t *testing.T, yaml string) *v1.TaskRun { + var tr v1.TaskRun + yaml = `apiVersion: tekton.dev/v1 +kind: TaskRun +` + yaml + mustParseYAML(t, yaml, &tr) + return &tr +} + // MustParseRun takes YAML and parses it into a *v1alpha1.Run func MustParseRun(t *testing.T, yaml string) *v1alpha1.Run { var r v1alpha1.Run @@ -54,6 +65,26 @@ kind: Task return &task } +// MustParseCustomRun takes YAML and parses it into a *v1beta1.CustomRun +func MustParseCustomRun(t *testing.T, yaml string) *v1beta1.CustomRun { + var r v1beta1.CustomRun + yaml = `apiVersion: tekton.dev/v1beta1 +kind: CustomRun +` + yaml + mustParseYAML(t, yaml, &r) + return &r +} + +// MustParseV1Task takes YAML and parses it into a *v1.Task +func MustParseV1Task(t *testing.T, yaml string) *v1.Task { + var task v1.Task + yaml = `apiVersion: tekton.dev/v1 +kind: Task +` + yaml + mustParseYAML(t, yaml, &task) + return &task +} + // MustParseClusterTask takes YAML and parses it into a *v1beta1.ClusterTask func MustParseClusterTask(t *testing.T, yaml string) *v1beta1.ClusterTask { var clusterTask v1beta1.ClusterTask @@ -74,6 +105,16 @@ kind: PipelineRun return &pr } +// MustParseV1PipelineRun takes YAML and parses it into a *v1.PipelineRun +func MustParseV1PipelineRun(t *testing.T, yaml string) *v1.PipelineRun { + var pr v1.PipelineRun + yaml = `apiVersion: tekton.dev/v1 +kind: PipelineRun +` + yaml + mustParseYAML(t, yaml, &pr) + return &pr +} + // MustParseV1beta1Pipeline takes YAML and parses it into a *v1beta1.Pipeline func MustParseV1beta1Pipeline(t *testing.T, yaml string) *v1beta1.Pipeline { var pipeline v1beta1.Pipeline @@ -84,6 +125,16 @@ kind: Pipeline return &pipeline } +// MustParseV1Pipeline takes YAML and parses it into a *v1.Pipeline +func MustParseV1Pipeline(t *testing.T, yaml string) *v1.Pipeline { + var pipeline v1.Pipeline + yaml = `apiVersion: tekton.dev/v1 +kind: Pipeline +` + yaml + mustParseYAML(t, yaml, &pipeline) + return &pipeline +} + // MustParsePipelineResource takes YAML and parses it into a *resourcev1alpha1.PipelineResource func MustParsePipelineResource(t *testing.T, yaml string) *resourcev1alpha1.PipelineResource { var resource resourcev1alpha1.PipelineResource @@ -94,6 +145,16 @@ kind: PipelineResource return &resource } +// MustParseVerificationPolicy takes YAML and parses it into a *v1alpha1.VerificationPolicy +func MustParseVerificationPolicy(t *testing.T, yaml string) *v1alpha1.VerificationPolicy { + var v v1alpha1.VerificationPolicy + yaml = `apiVersion: tekton.dev/v1alpha1 +kind: VerificationPolicy +` + yaml + mustParseYAML(t, yaml, &v) + return &v +} + func mustParseYAML(t *testing.T, yaml string, i runtime.Object) { if _, _, err := scheme.Codecs.UniversalDeserializer().Decode([]byte(yaml), nil, i); err != nil { t.Fatalf("mustParseYAML (%s): %v", yaml, err) diff --git a/vendor/github.com/tektoncd/pipeline/test/presubmit-tests.sh b/vendor/github.com/tektoncd/pipeline/test/presubmit-tests.sh index 6a8c81ca14..9369dd57cb 100644 --- a/vendor/github.com/tektoncd/pipeline/test/presubmit-tests.sh +++ b/vendor/github.com/tektoncd/pipeline/test/presubmit-tests.sh @@ -33,7 +33,7 @@ function check_go_lint() { header "Testing if golint has been done" # deadline of 5m, and show all the issues - golangci-lint -j 1 --color=never run + GOFLAGS="-mod=mod" make golangci-lint-check if [[ $? != 0 ]]; then results_banner "Go Lint" 1 diff --git a/vendor/github.com/tektoncd/pipeline/test/secret.go b/vendor/github.com/tektoncd/pipeline/test/secret.go index 23f6e44d9c..4e6541a98d 100644 --- a/vendor/github.com/tektoncd/pipeline/test/secret.go +++ b/vendor/github.com/tektoncd/pipeline/test/secret.go @@ -22,7 +22,6 @@ package test import ( "context" "fmt" - "io/ioutil" "os" "testing" @@ -53,7 +52,7 @@ func CreateGCPServiceAccountSecret(t *testing.T, c kubernetes.Interface, namespa }, } - bs, err := ioutil.ReadFile(file) + bs, err := os.ReadFile(file) if err != nil { return false, fmt.Errorf("couldn't read secret json from %s: %w", file, err) } diff --git a/vendor/github.com/tektoncd/pipeline/test/trustedresources.go b/vendor/github.com/tektoncd/pipeline/test/trustedresources.go index 779bc8e753..403599ba71 100644 --- a/vendor/github.com/tektoncd/pipeline/test/trustedresources.go +++ b/vendor/github.com/tektoncd/pipeline/test/trustedresources.go @@ -34,13 +34,16 @@ import ( "github.com/sigstore/sigstore/pkg/cryptoutils" "github.com/sigstore/sigstore/pkg/signature" "github.com/tektoncd/pipeline/pkg/apis/config" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" - corev1 "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + fakek8s "k8s.io/client-go/kubernetes/fake" "knative.dev/pkg/logging" ) +// TODO(#5820): refactor those into an internal pkg const ( namespace = "trusted-resources" // signatureAnnotation is the key of signature in annotation map @@ -92,8 +95,9 @@ func GetUnsignedPipeline(name string) *v1beta1.Pipeline { } } -// SetupTrustedResourceConfig config the keys and feature flag for testing -func SetupTrustedResourceConfig(ctx context.Context, keypath string, resourceVerificationMode string) context.Context { +// SetupTrustedResourceKeyConfig config the public keys keypath in config-trusted-resources +// and resource-verification-mode feature flag by given resourceVerificationMode for testing +func SetupTrustedResourceKeyConfig(ctx context.Context, keypath string, resourceVerificationMode string) context.Context { store := config.NewStore(logging.FromContext(ctx).Named("config-store")) cm := &corev1.ConfigMap{ TypeMeta: metav1.TypeMeta{ @@ -109,7 +113,13 @@ func SetupTrustedResourceConfig(ctx context.Context, keypath string, resourceVer }, } store.OnConfigChanged(cm) + ctx = SetupTrustedResourceConfig(ctx, resourceVerificationMode) + return store.ToContext(ctx) +} +// SetupTrustedResourceConfig config the resource-verification-mode feature flag by given mode for testing +func SetupTrustedResourceConfig(ctx context.Context, resourceVerificationMode string) context.Context { + store := config.NewStore(logging.FromContext(ctx).Named("config-store")) featureflags := &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ Namespace: namespace, @@ -124,44 +134,176 @@ func SetupTrustedResourceConfig(ctx context.Context, keypath string, resourceVer return store.ToContext(ctx) } -// GetSignerFromFile generates key files to tmpdir, return signer and pubkey path -func GetSignerFromFile(ctx context.Context, t *testing.T) (signature.Signer, string, error) { +// SetupVerificationPolicies set verification policies and secrets to store public keys. +// This function helps to setup 3 kinds of VerificationPolicies: +// 1. One public key in inline data +// 2. One public key in secret +// 3. 2 authorities referring to the same secret. This is to test and make sure we don't have duplicate counts +// SignerVerifier is returned to sign resources +// The k8s clientset is returned to fetch secret from it. +// VerificationPolicies are returned to fetch public keys +func SetupVerificationPolicies(t *testing.T) (signature.SignerVerifier, *ecdsa.PrivateKey, *fakek8s.Clientset, []*v1alpha1.VerificationPolicy) { t.Helper() + sv, keys, pub, err := GenerateKeys(elliptic.P256(), crypto.SHA256) + if err != nil { + t.Fatalf("failed to generate keys %v", err) + } + _, _, pub2, err := GenerateKeys(elliptic.P256(), crypto.SHA256) + if err != nil { + t.Fatalf("failed to generate keys %v", err) + } + secret := &v1.Secret{ + Data: map[string][]byte{"cosign.pub": pub}, + ObjectMeta: metav1.ObjectMeta{ + Name: "verification-secrets", + Namespace: namespace}} + + keyInDataVp := getVerificationPolicy( + "keyInDataVp", + namespace, + []v1alpha1.ResourcePattern{ + {Pattern: "https://github.com/tektoncd/catalog.git"}, + }, + []v1alpha1.Authority{ + { + Name: "pubkey", + Key: &v1alpha1.KeyRef{ + Data: string(pub), + HashAlgorithm: "sha256", + }, + }, + }) + + keyInSecretVp := getVerificationPolicy( + "keyInSecretVp", + namespace, + []v1alpha1.ResourcePattern{{ + Pattern: "gcr.io/tekton-releases/catalog/upstream/git-clone"}, + }, + []v1alpha1.Authority{ + { + Name: "pubkey", + Key: &v1alpha1.KeyRef{ + SecretRef: &v1.SecretReference{ + Name: secret.Name, + Namespace: secret.Namespace, + }, + HashAlgorithm: "sha256", + }, + }, + }) + + wrongKeyandPatternVp := getVerificationPolicy( + "wrongKeyInDataVp", + namespace, + []v1alpha1.ResourcePattern{ + {Pattern: "this should not match any resources"}, + }, + []v1alpha1.Authority{ + { + Name: "pubkey", + Key: &v1alpha1.KeyRef{ + Data: string(pub2), + HashAlgorithm: "sha256", + }, + }, + }) + + k8sclient := fakek8s.NewSimpleClientset(secret) + + return sv, keys, k8sclient, []*v1alpha1.VerificationPolicy{&keyInDataVp, &keyInSecretVp, &wrongKeyandPatternVp} +} + +// SetupMatchAllVerificationPolicies set verification policies with a Pattern to match all resources +// SignerVerifier is returned to sign resources +// The k8s clientset is returned to fetch secret from it. +// VerificationPolicies are returned to fetch public keys +func SetupMatchAllVerificationPolicies(t *testing.T, namespace string) (signature.SignerVerifier, *fakek8s.Clientset, []*v1alpha1.VerificationPolicy) { + t.Helper() + sv, _, pub, err := GenerateKeys(elliptic.P256(), crypto.SHA256) + if err != nil { + t.Fatalf("failed to generate keys %v", err) + } + + secret := &v1.Secret{ + Data: map[string][]byte{"cosign.pub": pub}, + ObjectMeta: metav1.ObjectMeta{ + Name: "verification-secrets", + Namespace: namespace}} + + matchAllVp := getVerificationPolicy( + "matchAllVp", + namespace, + []v1alpha1.ResourcePattern{ + {Pattern: ".*"}, + }, + []v1alpha1.Authority{ + { + Name: "pubkey", + Key: &v1alpha1.KeyRef{ + Data: string(pub), + HashAlgorithm: "sha256", + }, + }, + }) + + k8sclient := fakek8s.NewSimpleClientset(secret) + + return sv, k8sclient, []*v1alpha1.VerificationPolicy{&matchAllVp} +} + +// GetSignerFromFile generates key files to tmpdir, return signer and pubkey path +func GetSignerFromFile(ctx context.Context, t *testing.T) (signature.Signer, string) { + t.Helper() + sv, _, pub, err := GenerateKeys(elliptic.P256(), crypto.SHA256) + if err != nil { + t.Fatal(err) + } tmpDir := t.TempDir() - publicKeyFile := "ecdsa.pub" - sv, err := GenerateKeyFile(tmpDir, publicKeyFile) + pubKey := filepath.Join(tmpDir, "ecdsa.pub") + if err := os.WriteFile(pubKey, pub, 0600); err != nil { + t.Fatal(err) + } + + return sv, pubKey +} + +// GetKeysFromFile generates key files to tmpdir, return keys and pubkey path +func GetKeysFromFile(ctx context.Context, t *testing.T) (*ecdsa.PrivateKey, string) { + t.Helper() + _, keys, pub, err := GenerateKeys(elliptic.P256(), crypto.SHA256) if err != nil { t.Fatal(err) } + tmpDir := t.TempDir() + pubKey := filepath.Join(tmpDir, "ecdsa.pub") + if err := os.WriteFile(pubKey, pub, 0600); err != nil { + t.Fatal(err) + } - return sv, filepath.Join(tmpDir, publicKeyFile), nil + return keys, pubKey } -// GenerateKeyFile creates public key files, return the SignerVerifier -func GenerateKeyFile(dir string, pubkeyfile string) (signature.SignerVerifier, error) { - keys, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) +// GenerateKeys creates public key files, return the SignerVerifier +func GenerateKeys(c elliptic.Curve, hashFunc crypto.Hash) (signature.SignerVerifier, *ecdsa.PrivateKey, []byte, error) { + keys, err := ecdsa.GenerateKey(c, rand.Reader) if err != nil { - return nil, err + return nil, nil, nil, err } // Now do the public key pubBytes, err := cryptoutils.MarshalPublicKeyToPEM(keys.Public()) if err != nil { - return nil, err + return nil, nil, nil, err } - pubKey := filepath.Join(dir, pubkeyfile) - if err := os.WriteFile(pubKey, pubBytes, 0600); err != nil { - return nil, err - } - - sv, err := signature.LoadSignerVerifier(keys, crypto.SHA256) + sv, err := signature.LoadSignerVerifier(keys, hashFunc) if err != nil { - return nil, err + return nil, nil, nil, err } - return sv, nil + return sv, keys, pubBytes, nil } // signInterface returns the encoded signature for the given object. @@ -218,7 +360,6 @@ func getPass(confirm bool) ([]byte, error) { read := read(confirm) return read() } - func readPasswordFn(confirm bool) func() ([]byte, error) { pw, ok := os.LookupEnv("PRIVATE_PASSWORD") if ok { @@ -230,3 +371,20 @@ func readPasswordFn(confirm bool) func() ([]byte, error) { return nil, fmt.Errorf("fail to get password") } } + +func getVerificationPolicy(name, namespace string, patterns []v1alpha1.ResourcePattern, authorities []v1alpha1.Authority) v1alpha1.VerificationPolicy { + return v1alpha1.VerificationPolicy{ + TypeMeta: metav1.TypeMeta{ + Kind: "VerificationPolicy", + APIVersion: "v1alpha1", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: namespace, + }, + Spec: v1alpha1.VerificationPolicySpec{ + Resources: patterns, + Authorities: authorities, + }, + } +} diff --git a/vendor/github.com/tektoncd/pipeline/test/wait.go b/vendor/github.com/tektoncd/pipeline/test/wait.go index ffd161b207..0dd0f83fed 100644 --- a/vendor/github.com/tektoncd/pipeline/test/wait.go +++ b/vendor/github.com/tektoncd/pipeline/test/wait.go @@ -60,8 +60,9 @@ import ( ) const ( - interval = 1 * time.Second - timeout = 10 * time.Minute + interval = 1 * time.Second + timeout = 10 * time.Minute + v1beta1Version = "v1beta1" ) // ConditionAccessorFn is a condition function used polling functions @@ -82,17 +83,27 @@ func pollImmediateWithContext(ctx context.Context, fn func() (bool, error)) erro // interval until inState returns `true` indicating it is done, returns an // error or timeout. desc will be used to name the metric that is emitted to // track how long it took for name to get into the state checked by inState. -func WaitForTaskRunState(ctx context.Context, c *clients, name string, inState ConditionAccessorFn, desc string) error { +// version will be used to determine the client to be applied for the wait. +func WaitForTaskRunState(ctx context.Context, c *clients, name string, inState ConditionAccessorFn, desc, version string) error { metricName := fmt.Sprintf("WaitForTaskRunState/%s/%s", name, desc) _, span := trace.StartSpan(context.Background(), metricName) defer span.End() return pollImmediateWithContext(ctx, func() (bool, error) { - r, err := c.V1beta1TaskRunClient.Get(ctx, name, metav1.GetOptions{}) - if err != nil { - return true, err + switch version { + case "v1": + r, err := c.V1TaskRunClient.Get(ctx, name, metav1.GetOptions{}) + if err != nil { + return true, err + } + return inState(&r.Status) + default: + r, err := c.V1beta1TaskRunClient.Get(ctx, name, metav1.GetOptions{}) + if err != nil { + return true, err + } + return inState(&r.Status) } - return inState(&r.Status) }) } @@ -156,19 +167,30 @@ func WaitForPodState(ctx context.Context, c *clients, name string, namespace str // interval until inState returns `true` indicating it is done, returns an // error or timeout. desc will be used to name the metric that is emitted to // track how long it took for name to get into the state checked by inState. -func WaitForPipelineRunState(ctx context.Context, c *clients, name string, polltimeout time.Duration, inState ConditionAccessorFn, desc string) error { +// version will be used to determine the client to be applied for the wait. +func WaitForPipelineRunState(ctx context.Context, c *clients, name string, polltimeout time.Duration, inState ConditionAccessorFn, desc, version string) error { metricName := fmt.Sprintf("WaitForPipelineRunState/%s/%s", name, desc) _, span := trace.StartSpan(context.Background(), metricName) defer span.End() ctx, cancel := context.WithTimeout(ctx, polltimeout) defer cancel() + return pollImmediateWithContext(ctx, func() (bool, error) { - r, err := c.V1beta1PipelineRunClient.Get(ctx, name, metav1.GetOptions{}) - if err != nil { - return true, err + switch version { + case "v1": + r, err := c.V1PipelineRunClient.Get(ctx, name, metav1.GetOptions{}) + if err != nil { + return true, err + } + return inState(&r.Status) + default: + r, err := c.V1beta1PipelineRunClient.Get(ctx, name, metav1.GetOptions{}) + if err != nil { + return true, err + } + return inState(&r.Status) } - return inState(&r.Status) }) } diff --git a/vendor/modules.txt b/vendor/modules.txt index c82307fcf8..834f26a55b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1055,7 +1055,7 @@ github.com/mattn/go-isatty # github.com/mattn/go-runewidth v0.0.14 ## explicit; go 1.9 github.com/mattn/go-runewidth -# github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 +# github.com/matttproud/golang_protobuf_extensions v1.0.4 ## explicit; go 1.9 github.com/matttproud/golang_protobuf_extensions/pbutil # github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d @@ -1401,7 +1401,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.42.0 +# github.com/tektoncd/pipeline v0.43.1 ## explicit; go 1.18 github.com/tektoncd/pipeline/pkg/apis/config github.com/tektoncd/pipeline/pkg/apis/config/resolver @@ -1440,6 +1440,8 @@ github.com/tektoncd/pipeline/pkg/client/injection/informers/factory github.com/tektoncd/pipeline/pkg/client/injection/informers/factory/fake github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha1/run github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha1/run/fake +github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha1/verificationpolicy +github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha1/verificationpolicy/fake github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1beta1/clustertask github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1beta1/clustertask/fake github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1beta1/customrun