diff --git a/go.mod b/go.mod index ae53b3544c..fa1e5e056d 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/tektoncd/hub/api v0.0.0-20201027094520-f56d79d14d70 github.com/tektoncd/pipeline v0.17.1-0.20201007165454-9611f3e4509e github.com/tektoncd/plumbing v0.0.0-20200430135134-e53521e1d887 - github.com/tektoncd/triggers v0.8.2-0.20201007153255-cb1879311818 + github.com/tektoncd/triggers v0.9.1 github.com/tidwall/gjson v1.6.0 // indirect go.opencensus.io v0.22.4 go.uber.org/multierr v1.5.0 diff --git a/go.sum b/go.sum index ff2ab51ee1..bc5709a921 100644 --- a/go.sum +++ b/go.sum @@ -1264,8 +1264,8 @@ github.com/tektoncd/plumbing v0.0.0-20200217163359-cd0db6e567d2/go.mod h1:QZHgU0 github.com/tektoncd/plumbing v0.0.0-20200430135134-e53521e1d887 h1:crv70CBAJ2gZFSbf13aRVwdbjR2GYwTms/ZEok/SnFM= github.com/tektoncd/plumbing v0.0.0-20200430135134-e53521e1d887/go.mod h1:cZPJIeTIoP7UPTxQyTQLs7VE1TiXJSNj0te+If4Q+jI= github.com/tektoncd/plumbing/pipelinerun-logs v0.0.0-20191206114338-712d544c2c21/go.mod h1:S62EUWtqmejjJgUMOGB1CCCHRp6C706laH06BoALkzU= -github.com/tektoncd/triggers v0.8.2-0.20201007153255-cb1879311818 h1:KWEoOYU9ht2G5iW/BbGEqGRZwrWVUuTdEeDsuEXR4go= -github.com/tektoncd/triggers v0.8.2-0.20201007153255-cb1879311818/go.mod h1:BccgHGtBbJp6gpKCxU/X2j6it4lLFE6HIT7zn7BKX94= +github.com/tektoncd/triggers v0.9.1 h1:KR4/mIfcCv2MdhQWvH/4ZkEzJvsQm72mL8ZtcKA71Kc= +github.com/tektoncd/triggers v0.9.1/go.mod h1:BccgHGtBbJp6gpKCxU/X2j6it4lLFE6HIT7zn7BKX94= github.com/tetafro/godot v0.3.7/go.mod h1:/7NLHhv08H1+8DNj0MElpAACw1ajsCuf3TKNQxA5S+0= github.com/tetafro/godot v0.4.2/go.mod h1:/7NLHhv08H1+8DNj0MElpAACw1ajsCuf3TKNQxA5S+0= github.com/tidwall/gjson v1.3.5/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= diff --git a/pkg/cmd/eventlistener/describe.go b/pkg/cmd/eventlistener/describe.go index 903266d9cd..4e739a4b39 100644 --- a/pkg/cmd/eventlistener/describe.go +++ b/pkg/cmd/eventlistener/describe.go @@ -81,6 +81,15 @@ const describeTemplate = `{{decorate "bold" "Name"}}: {{ .EventListener.Name }} {{- end }} {{ " " }} {{- end }} +{{- if isBindingNameExist $v.Bindings }} + NAME VALUE +{{- range $b := $v.Bindings }} +{{- if ne $b.Name "" }} + {{ decorate "bullet" $b.Name }} {{ $b.Value }} +{{- end }} +{{- end }} +{{ " " }} +{{- end }} {{- if isBindingSpecExist $v.Bindings }} SPEC @@ -95,8 +104,13 @@ const describeTemplate = `{{decorate "bold" "Name"}}: {{ .EventListener.Name }} {{ " " }} {{- end }} {{- end }} +{{- if isTemplateRefExist $v.Template }} + TEMPLATE REF APIVERSION + {{ decorate "bullet" $v.Template.Ref }} {{ $v.Template.APIVersion }} +{{- else }} TEMPLATE NAME APIVERSION {{ decorate "bullet" $v.Template.Name }} {{ $v.Template.APIVersion }} +{{- end }} {{- if eq $v.ServiceAccountName "" }} {{- else }} {{ " " }} @@ -225,6 +239,8 @@ func printEventListenerDescription(s *cli.Stream, p cli.Params, elName string) e "getEventListenerName": getEventListenerName, "isBindingRefExist": isBindingRefExist, "isBindingSpecExist": isBindingSpecExist, + "isBindingNameExist": isBindingNameExist, + "isTemplateRefExist": isTemplateRefExist, } w := tabwriter.NewWriter(s.Out, 0, 5, 3, ' ', tabwriter.TabIndent) @@ -277,3 +293,17 @@ func isBindingSpecExist(bindings []*v1alpha1.EventListenerBinding) bool { } return specExist } + +func isBindingNameExist(bindings []*v1alpha1.EventListenerBinding) bool { + nameExist := false + for _, j := range bindings { + if j.Name != "" { + return true + } + } + return nameExist +} + +func isTemplateRefExist(templates *v1alpha1.EventListenerTemplate) bool { + return templates.Ref != nil +} diff --git a/pkg/cmd/eventlistener/describe_test.go b/pkg/cmd/eventlistener/describe_test.go index 05e1e7226d..97b7faae37 100644 --- a/pkg/cmd/eventlistener/describe_test.go +++ b/pkg/cmd/eventlistener/describe_test.go @@ -135,6 +135,73 @@ func TestEventListenerDescribe_OneTriggerWithMultipleTriggerBinding(t *testing.T executeEventListenerCommand(t, els) } +func TestEventListenerDescribe_OneTriggerWithTriggerBindingName(t *testing.T) { + bindingval := "somevalue" + + els := []*v1alpha1.EventListener{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "el1", + Namespace: "ns", + }, + Spec: v1alpha1.EventListenerSpec{ + Triggers: []v1alpha1.EventListenerTrigger{ + { + Bindings: []*v1alpha1.EventListenerBinding{ + { + Name: "binding", + Value: &bindingval, + }, + }, + Template: &v1alpha1.EventListenerTemplate{ + Name: "tt1", + Ref: nil, + APIVersion: "v1alpha1", + Spec: nil, + }, + Name: "tt1", + }, + }, + }, + }, + } + + executeEventListenerCommand(t, els) +} + +func TestEventListenerDescribe_TriggerWithTriggerTemplateRef(t *testing.T) { + bindingval := "somevalue" + tempRef := "someref" + + els := []*v1alpha1.EventListener{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "el1", + Namespace: "ns", + }, + Spec: v1alpha1.EventListenerSpec{ + Triggers: []v1alpha1.EventListenerTrigger{ + { + Bindings: []*v1alpha1.EventListenerBinding{ + { + Name: "binding", + Value: &bindingval, + }, + }, + Template: &v1alpha1.EventListenerTemplate{ + Ref: &tempRef, + APIVersion: "v1alpha1", + }, + Name: "tt1", + }, + }, + }, + }, + } + + executeEventListenerCommand(t, els) +} + func TestEventListenerDescribe_OneTriggerWithEmptyTriggerBinding(t *testing.T) { els := []*v1alpha1.EventListener{ el.EventListener("el1", "ns", diff --git a/pkg/cmd/eventlistener/testdata/TestEventListenerDescribe_OneTriggerWithTriggerBindingName.golden b/pkg/cmd/eventlistener/testdata/TestEventListenerDescribe_OneTriggerWithTriggerBindingName.golden new file mode 100644 index 0000000000..909690fa88 --- /dev/null +++ b/pkg/cmd/eventlistener/testdata/TestEventListenerDescribe_OneTriggerWithTriggerBindingName.golden @@ -0,0 +1,16 @@ +Name: el1 +Namespace: ns + +EventListenerTriggers + + NAME + tt1 + + BINDINGS + + NAME VALUE + binding somevalue + + TEMPLATE NAME APIVERSION + tt1 v1alpha1 + diff --git a/pkg/cmd/eventlistener/testdata/TestEventListenerDescribe_OutputYAMLWithMultipleBindingAndInterceptors.golden b/pkg/cmd/eventlistener/testdata/TestEventListenerDescribe_OutputYAMLWithMultipleBindingAndInterceptors.golden index 2536601c63..4eab4c8e0f 100644 --- a/pkg/cmd/eventlistener/testdata/TestEventListenerDescribe_OutputYAMLWithMultipleBindingAndInterceptors.golden +++ b/pkg/cmd/eventlistener/testdata/TestEventListenerDescribe_OutputYAMLWithMultipleBindingAndInterceptors.golden @@ -12,17 +12,17 @@ { "bindings": [ { - "kind": "TriggerBinding", - "ref": "tb1" + "ref": "tb1", + "kind": "TriggerBinding" }, { - "kind": "ClusterTriggerBinding", "ref": "tb2", + "kind": "ClusterTriggerBinding", "apiversion": "v1alpha1" }, { - "kind": "TriggerBinding", "ref": "tb3", + "kind": "TriggerBinding", "apiversion": "v1alpha1" } ], @@ -48,12 +48,12 @@ { "bindings": [ { - "kind": "TriggerBinding", - "ref": "tb4" + "ref": "tb4", + "kind": "TriggerBinding" }, { - "kind": "ClusterTriggerBinding", "ref": "tb5", + "kind": "ClusterTriggerBinding", "apiversion": "v1alpha1" } ], diff --git a/pkg/cmd/eventlistener/testdata/TestEventListenerDescribe_TriggerWithTriggerTemplateRef.golden b/pkg/cmd/eventlistener/testdata/TestEventListenerDescribe_TriggerWithTriggerTemplateRef.golden new file mode 100644 index 0000000000..0db85439cc --- /dev/null +++ b/pkg/cmd/eventlistener/testdata/TestEventListenerDescribe_TriggerWithTriggerTemplateRef.golden @@ -0,0 +1,16 @@ +Name: el1 +Namespace: ns + +EventListenerTriggers + + NAME + tt1 + + BINDINGS + + NAME VALUE + binding somevalue + + TEMPLATE REF APIVERSION + someref v1alpha1 + diff --git a/third_party/VENDOR-LICENSE/LICENSE b/third_party/VENDOR-LICENSE/LICENSE deleted file mode 100644 index 6a66aea5ea..0000000000 --- a/third_party/VENDOR-LICENSE/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/third_party/VENDOR-LICENSE/github.com/dimfeld/httptreemux/v5/LICENSE b/third_party/VENDOR-LICENSE/github.com/dimfeld/httptreemux/v5/LICENSE new file mode 100644 index 0000000000..32c75c9b1e --- /dev/null +++ b/third_party/VENDOR-LICENSE/github.com/dimfeld/httptreemux/v5/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014,2015 Daniel Imfeld + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/third_party/VENDOR-LICENSE/github.com/gorilla/websocket/LICENSE b/third_party/VENDOR-LICENSE/github.com/gorilla/websocket/LICENSE new file mode 100644 index 0000000000..9171c97225 --- /dev/null +++ b/third_party/VENDOR-LICENSE/github.com/gorilla/websocket/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/third_party/VENDOR-LICENSE/github.com/mitchellh/go-homedir/LICENSE b/third_party/VENDOR-LICENSE/github.com/mitchellh/go-homedir/LICENSE new file mode 100644 index 0000000000..f9c841a51e --- /dev/null +++ b/third_party/VENDOR-LICENSE/github.com/mitchellh/go-homedir/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013 Mitchell Hashimoto + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/third_party/VENDOR-LICENSE/github.com/tektoncd/hub/api/LICENSE b/third_party/VENDOR-LICENSE/github.com/tektoncd/hub/api/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/third_party/VENDOR-LICENSE/github.com/tektoncd/hub/api/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/third_party/VENDOR-LICENSE/goa.design/goa/v3/LICENSE b/third_party/VENDOR-LICENSE/goa.design/goa/v3/LICENSE new file mode 100644 index 0000000000..d4c1b519a5 --- /dev/null +++ b/third_party/VENDOR-LICENSE/goa.design/goa/v3/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Raphael Simon and goa Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/third_party/VENDOR-LICENSE/vendor/golang.org/x/crypto/LICENSE b/third_party/VENDOR-LICENSE/vendor/golang.org/x/crypto/LICENSE deleted file mode 100644 index 6a66aea5ea..0000000000 --- a/third_party/VENDOR-LICENSE/vendor/golang.org/x/crypto/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/third_party/VENDOR-LICENSE/vendor/golang.org/x/net/LICENSE b/third_party/VENDOR-LICENSE/vendor/golang.org/x/net/LICENSE deleted file mode 100644 index 6a66aea5ea..0000000000 --- a/third_party/VENDOR-LICENSE/vendor/golang.org/x/net/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/third_party/VENDOR-LICENSE/vendor/golang.org/x/sys/cpu/LICENSE b/third_party/VENDOR-LICENSE/vendor/golang.org/x/sys/cpu/LICENSE deleted file mode 100644 index 6a66aea5ea..0000000000 --- a/third_party/VENDOR-LICENSE/vendor/golang.org/x/sys/cpu/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/third_party/VENDOR-LICENSE/vendor/golang.org/x/text/LICENSE b/third_party/VENDOR-LICENSE/vendor/golang.org/x/text/LICENSE deleted file mode 100644 index 6a66aea5ea..0000000000 --- a/third_party/VENDOR-LICENSE/vendor/golang.org/x/text/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/event_listener_types.go b/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/event_listener_types.go index e819bacb93..daa7f3f7ba 100644 --- a/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/event_listener_types.go +++ b/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/event_listener_types.go @@ -112,7 +112,6 @@ type EventInterceptor = TriggerInterceptor type SecretRef struct { SecretKey string `json:"secretKey,omitempty"` SecretName string `json:"secretName,omitempty"` - Namespace string `json:"namespace,omitempty"` } // EventListenerBinding refers to a particular TriggerBinding or ClusterTriggerBindingresource. diff --git a/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/trigger_defaults.go b/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/trigger_defaults.go index 5465a215e7..9071981f7c 100644 --- a/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/trigger_defaults.go +++ b/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/trigger_defaults.go @@ -18,16 +18,35 @@ package v1alpha1 import ( "context" + + "knative.dev/pkg/ptr" ) type triggerSpecBindingArray []*TriggerSpecBinding // SetDefaults sets the defaults on the object. func (t *Trigger) SetDefaults(ctx context.Context) { - if IsUpgradeViaDefaulting(ctx) { - // set defaults - triggerSpecBindingArray(t.Spec.Bindings).defaultBindings() + if !IsUpgradeViaDefaulting(ctx) { + return + } + triggerSpecBindingArray(t.Spec.Bindings).defaultBindings() + + // Upgrade old style embedded bindings to new concise syntax + bindings := []*TriggerSpecBinding{} + for _, b := range t.Spec.Bindings { + if b.Spec == nil { + bindings = append(bindings, b) + } else { + for _, p := range b.Spec.Params { + bindings = append(bindings, &TriggerSpecBinding{ + Name: p.Name, + Value: ptr.String(p.Value), + }) + } + } } + t.Spec.Bindings = bindings + templateNameToRef(&t.Spec.Template) } // set default TriggerBinding kind for Bindings in TriggerSpec @@ -40,3 +59,11 @@ func (t triggerSpecBindingArray) defaultBindings() { } } } + +func templateNameToRef(template *TriggerSpecTemplate) { + name := template.Name + if name != "" && template.Ref == nil { + template.Ref = &name + template.Name = "" + } +} diff --git a/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/trigger_types.go b/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/trigger_types.go index be032ae99d..b4d516c6be 100644 --- a/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/trigger_types.go +++ b/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/trigger_types.go @@ -39,16 +39,35 @@ type TriggerSpec struct { } type TriggerSpecTemplate struct { - Name string `json:"name"` - APIVersion string `json:"apiversion,omitempty"` + // Deprecated: Use Ref instead + Name string `json:"name"` + Ref *string `json:"ref,omitempty"` + APIVersion string `json:"apiversion,omitempty"` + Spec *TriggerTemplateSpec `json:"spec,omitempty"` } type TriggerSpecBinding struct { - Name string `json:"name,omitempty"` - Kind TriggerBindingKind `json:"kind,omitempty"` - Ref string `json:"ref,omitempty"` - Spec *TriggerBindingSpec `json:"spec,omitempty"` - APIVersion string `json:"apiversion,omitempty"` + // Name is the name of the binding param + // Mutually exclusive with Ref + Name string `json:"name,omitempty"` + // Value is the value of the binding param. Can contain JSONPath + // Has to be pointer since "" is a valid value + // Required if Name is also specified. + Value *string `json:"value,omitempty"` + + // Ref is a reference to a TriggerBinding kind. + // Mutually exclusive with Name + Ref string `json:"ref,omitempty"` + + // Kind can only be provided if Ref is also provided. Defaults to TriggerBinding + Kind TriggerBindingKind `json:"kind,omitempty"` + + // Spec is the deprecated way of embedding TriggerBindings. + // TODO(#782): Remove deprecated syntax. + Spec *TriggerBindingSpec `json:"spec,omitempty"` + + // APIVersion of the binding ref + APIVersion string `json:"apiversion,omitempty"` } // +genclient diff --git a/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/trigger_validation.go b/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/trigger_validation.go index 1d9819ab64..eb697ff2f3 100644 --- a/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/trigger_validation.go +++ b/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/trigger_validation.go @@ -54,29 +54,50 @@ func (t TriggerSpecTemplate) validate(ctx context.Context) (errs *apis.FieldErro errs = errs.Also(apis.ErrInvalidValue(fmt.Errorf("invalid apiVersion"), "template.apiVersion")) } } - if t.Name == "" { - errs = errs.Also(apis.ErrMissingField("template.name")) + + // Validate only one of Name or Ref is set. + if t.Name != "" && t.Ref != nil { + errs = errs.Also(apis.ErrMultipleOneOf("template.name", "template.ref")) + } + + // Set Ref to Name + if t.Name != "" { + t.Ref = &t.Name } - return errs + switch { + case t.Spec != nil && t.Ref != nil: + errs = errs.Also(apis.ErrMultipleOneOf("template.spec", "template.ref")) + case t.Spec == nil && t.Ref == nil: + errs = errs.Also(apis.ErrMissingOneOf("template.spec", "template.ref")) + case t.Spec != nil: + errs = errs.Also(t.Spec.validate(ctx)) + case t.Ref == nil || *t.Ref == "": + errs = errs.Also(apis.ErrMissingField("template.ref")) + } + return errs } func (t triggerSpecBindingArray) validate(ctx context.Context) (errs *apis.FieldError) { - if len(t) > 0 { - for i, b := range t { - // Either Ref or Spec should be present - if b.Ref == "" && b.Spec == nil { - errs = errs.Also(apis.ErrMissingOneOf(fmt.Sprintf("bindings[%d].Ref", i), fmt.Sprintf("bindings[%d].Spec", i))) - } - - // Both Ref and Spec can't be present at the same time - if b.Ref != "" && b.Spec != nil { + for i, b := range t { + switch { + case b.Ref != "": + switch { + case b.Spec != nil: // Cannot specify both Ref and Spec errs = errs.Also(apis.ErrMultipleOneOf(fmt.Sprintf("bindings[%d].Ref", i), fmt.Sprintf("bindings[%d].Spec", i))) - } - - if b.Ref != "" && b.Kind != NamespacedTriggerBindingKind && b.Kind != ClusterTriggerBindingKind { + case b.Name != "": // Cannot specify both Ref and Name + errs = errs.Also(apis.ErrMultipleOneOf(fmt.Sprintf("bindings[%d].Ref", i), fmt.Sprintf("bindings[%d].Name", i))) + case b.Kind != NamespacedTriggerBindingKind && b.Kind != ClusterTriggerBindingKind: // Kind must be valid errs = errs.Also(apis.ErrInvalidValue(fmt.Errorf("invalid kind"), fmt.Sprintf("bindings[%d].kind", i))) } + case b.Spec != nil: // TODO(#768): Remove deprecated old style embedded bindings + break // For backwards compatibility, users who specify Spec may also specify Name + case b.Name != "": + if b.Value == nil { // Value is mandatory if Name is specified + errs = errs.Also(apis.ErrMissingField(fmt.Sprintf("bindings[%d].Value", i))) + } + default: + errs = errs.Also(apis.ErrMissingOneOf(fmt.Sprintf("bindings[%d].Ref", i), fmt.Sprintf("bindings[%d].Spec", i), fmt.Sprintf("bindings[%d].Name", i))) } } return errs diff --git a/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/zz_generated.deepcopy.go index 50d9d288c4..bc8f10b8c3 100644 --- a/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1/zz_generated.deepcopy.go @@ -293,7 +293,7 @@ func (in *EventListenerTrigger) DeepCopyInto(out *EventListenerTrigger) { if in.Template != nil { in, out := &in.Template, &out.Template *out = new(TriggerSpecTemplate) - **out = **in + (*in).DeepCopyInto(*out) } if in.Interceptors != nil { in, out := &in.Interceptors, &out.Interceptors @@ -722,7 +722,7 @@ func (in *TriggerSpec) DeepCopyInto(out *TriggerSpec) { } } } - out.Template = in.Template + in.Template.DeepCopyInto(&out.Template) if in.Interceptors != nil { in, out := &in.Interceptors, &out.Interceptors *out = make([]*TriggerInterceptor, len(*in)) @@ -750,6 +750,11 @@ func (in *TriggerSpec) DeepCopy() *TriggerSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TriggerSpecBinding) DeepCopyInto(out *TriggerSpecBinding) { *out = *in + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(string) + **out = **in + } if in.Spec != nil { in, out := &in.Spec, &out.Spec *out = new(TriggerBindingSpec) @@ -771,6 +776,16 @@ func (in *TriggerSpecBinding) DeepCopy() *TriggerSpecBinding { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TriggerSpecTemplate) DeepCopyInto(out *TriggerSpecTemplate) { *out = *in + if in.Ref != nil { + in, out := &in.Ref, &out.Ref + *out = new(string) + **out = **in + } + if in.Spec != nil { + in, out := &in.Spec, &out.Spec + *out = new(TriggerTemplateSpec) + (*in).DeepCopyInto(*out) + } return } diff --git a/vendor/github.com/tektoncd/triggers/test/builder/trigger.go b/vendor/github.com/tektoncd/triggers/test/builder/trigger.go index d482471efb..a9d7ba5658 100644 --- a/vendor/github.com/tektoncd/triggers/test/builder/trigger.go +++ b/vendor/github.com/tektoncd/triggers/test/builder/trigger.go @@ -63,7 +63,7 @@ func TriggerSpec(ops ...TriggerSpecOp) TriggerOp { func TriggerSpecTemplate(ttName, apiVersion string) TriggerSpecOp { return func(spec *v1alpha1.TriggerSpec) { tt := v1alpha1.TriggerSpecTemplate{ - Name: ttName, + Ref: &ttName, APIVersion: apiVersion, } spec.Template = tt diff --git a/vendor/github.com/tektoncd/triggers/test/e2e-tests-ingress.sh b/vendor/github.com/tektoncd/triggers/test/e2e-tests-ingress.sh index dc4d6df278..bd4bd09923 100644 --- a/vendor/github.com/tektoncd/triggers/test/e2e-tests-ingress.sh +++ b/vendor/github.com/tektoncd/triggers/test/e2e-tests-ingress.sh @@ -128,7 +128,7 @@ spec: - bindings: - ref: pipeline-binding template: - name: pipeline-template + ref: pipeline-template DONE INGRESS_TASKRUN_NAME="create-ingress-taskrun" diff --git a/vendor/github.com/tektoncd/triggers/test/raw.go b/vendor/github.com/tektoncd/triggers/test/raw.go new file mode 100644 index 0000000000..e1e930db39 --- /dev/null +++ b/vendor/github.com/tektoncd/triggers/test/raw.go @@ -0,0 +1,18 @@ +package test + +import ( + "encoding/json" + "testing" + + "k8s.io/apimachinery/pkg/runtime" +) + +// RawExtenstion is a test helper to generate RawExtension objects for tests +func RawExtension(t *testing.T, a interface{}) runtime.RawExtension { + t.Helper() + b, err := json.Marshal(a) + if err != nil { + t.Fatal(err) + } + return runtime.RawExtension{Raw: b} +} diff --git a/vendor/knative.dev/pkg/ptr/doc.go b/vendor/knative.dev/pkg/ptr/doc.go new file mode 100644 index 0000000000..1ebcea2845 --- /dev/null +++ b/vendor/knative.dev/pkg/ptr/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2019 The Knative 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 ptr holds utilities for taking pointer references to values. +package ptr diff --git a/vendor/knative.dev/pkg/ptr/ptr.go b/vendor/knative.dev/pkg/ptr/ptr.go new file mode 100644 index 0000000000..6d5eeaab69 --- /dev/null +++ b/vendor/knative.dev/pkg/ptr/ptr.go @@ -0,0 +1,67 @@ +/* +Copyright 2019 The Knative 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 ptr + +import "time" + +// Int32 is a helper for turning integers into pointers for use in +// API types that want *int32. +func Int32(i int32) *int32 { + return &i +} + +// Int64 is a helper for turning integers into pointers for use in +// API types that want *int64. +func Int64(i int64) *int64 { + return &i +} + +// Float32 is a helper for turning floats into pointers for use in +// API types that want *float32. +func Float32(f float32) *float32 { + return &f +} + +// Float64 is a helper for turning floats into pointers for use in +// API types that want *float64. +func Float64(f float64) *float64 { + return &f +} + +// Bool is a helper for turning bools into pointers for use in +// API types that want *bool. +func Bool(b bool) *bool { + return &b +} + +// String is a helper for turning strings into pointers for use in +// API types that want *string. +func String(s string) *string { + return &s +} + +// Duration is a helper for turning time.Duration into pointers for use in +// API types that want *time.Duration. +func Duration(t time.Duration) *time.Duration { + return &t +} + +// Time is a helper for turning a const time.Time into a pointer for use in +// API types that want *time.Duration. +func Time(t time.Time) *time.Time { + return &t +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 5aae158928..6070792d75 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -423,7 +423,7 @@ github.com/tektoncd/pipeline/test github.com/tektoncd/pipeline/test/v1alpha1 # github.com/tektoncd/plumbing v0.0.0-20200430135134-e53521e1d887 github.com/tektoncd/plumbing/scripts -# github.com/tektoncd/triggers v0.8.2-0.20201007153255-cb1879311818 +# github.com/tektoncd/triggers v0.9.1 github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1 github.com/tektoncd/triggers/pkg/client/clientset/versioned github.com/tektoncd/triggers/pkg/client/clientset/versioned/fake @@ -1052,6 +1052,7 @@ knative.dev/pkg/logging/testing knative.dev/pkg/metrics knative.dev/pkg/metrics/metricskey knative.dev/pkg/network +knative.dev/pkg/ptr knative.dev/pkg/reconciler knative.dev/pkg/reconciler/testing knative.dev/pkg/system