From 68fa08e0814b1b7b8846a279fce9453bac6fd8cd Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Fri, 13 Dec 2019 11:37:28 +0100 Subject: [PATCH] Tektoncd Release 0.9.2 Signed-off-by: Chmouel Boudjnah --- go.mod | 2 +- go.sum | 4 +-- .../v1alpha1/pull_request_resource.go | 26 ++++++++++++------- vendor/modules.txt | 2 +- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index c2f1a2cb0..6fe7738bf 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/spf13/cobra v0.0.5 github.com/spf13/pflag v1.0.3 github.com/stretchr/testify v1.4.0 - github.com/tektoncd/pipeline v0.9.1 + github.com/tektoncd/pipeline v0.9.2 github.com/tektoncd/plumbing v0.0.0-20191114095731-51c53a31e779 go.opencensus.io v0.22.1 // indirect golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392 // indirect diff --git a/go.sum b/go.sum index 875b0a4d8..b742c0741 100644 --- a/go.sum +++ b/go.sum @@ -210,8 +210,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/tektoncd/pipeline v0.9.1 h1:nfhhQKxmo2TeL+LGR5pXlArEaFaRwnw7oAN3F0Gy55U= -github.com/tektoncd/pipeline v0.9.1/go.mod h1:IZzJdiX9EqEMuUcgdnElozdYYRh0/ZRC+NKMLj1K3Yw= +github.com/tektoncd/pipeline v0.9.2 h1:eJ9x1KY/XpUGmTjNdowRHF7G9FozKGptHnEGwKO4W/I= +github.com/tektoncd/pipeline v0.9.2/go.mod h1:IZzJdiX9EqEMuUcgdnElozdYYRh0/ZRC+NKMLj1K3Yw= github.com/tektoncd/plumbing v0.0.0-20191114095731-51c53a31e779 h1:sSxeUSt6SAL0cLItd932SwFNdgplkDFcmCBTouDA058= github.com/tektoncd/plumbing v0.0.0-20191114095731-51c53a31e779/go.mod h1:dvZoTaPGpr3ZDqOUR1sc8VOhh/7OzYncVnbQETJTqvQ= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/pull_request_resource.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/pull_request_resource.go index 2b34b7c7e..012b9997a 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/pull_request_resource.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1/pull_request_resource.go @@ -25,10 +25,10 @@ import ( ) const ( - prSource = "pr-source" - githubTokenField = "githubToken" + prSource = "pr-source" + authTokenField = "authToken" // nolint: gosec - githubTokenEnv = "GITHUB_TOKEN" + authTokenEnv = "AUTH_TOKEN" ) // PullRequestResource is an endpoint from which to get data which is required @@ -37,9 +37,11 @@ type PullRequestResource struct { Name string `json:"name"` Type PipelineResourceType `json:"type"` - // GitHub URL pointing to the pull request. + // URL pointing to the pull request. // Example: https://github.com/owner/repo/pulls/1 URL string `json:"url"` + // SCM provider (github or gitlab today). This will be guessed from URL if not set. + Provider string `json:"provider"` // Secrets holds a struct to indicate a field name and corresponding secret name to populate it. Secrets []SecretParam `json:"secrets"` @@ -60,6 +62,8 @@ func NewPullRequestResource(prImage string, r *PipelineResource) (*PullRequestRe for _, param := range r.Spec.Params { if strings.EqualFold(param.Name, "URL") { prResource.URL = param.Value + } else if strings.EqualFold(param.Name, "Provider") { + prResource.Provider = param.Value } } @@ -84,9 +88,10 @@ func (s *PullRequestResource) GetURL() string { // Replacements is used for template replacement on a PullRequestResource inside of a Taskrun. func (s *PullRequestResource) Replacements() map[string]string { return map[string]string{ - "name": s.Name, - "type": string(s.Type), - "url": s.URL, + "name": s.Name, + "type": string(s.Type), + "url": s.URL, + "provider": s.Provider, } } @@ -106,12 +111,15 @@ func (s *PullRequestResource) GetOutputTaskModifier(ts *TaskSpec, sourcePath str func (s *PullRequestResource) getSteps(mode string, sourcePath string) []Step { args := []string{"-url", s.URL, "-path", sourcePath, "-mode", mode} + if s.Provider != "" { + args = append(args, []string{"-provider", s.Provider}...) + } evs := []corev1.EnvVar{} for _, sec := range s.Secrets { - if strings.EqualFold(sec.FieldName, githubTokenField) { + if strings.EqualFold(sec.FieldName, authTokenField) { ev := corev1.EnvVar{ - Name: githubTokenEnv, + Name: authTokenEnv, ValueFrom: &corev1.EnvVarSource{ SecretKeyRef: &corev1.SecretKeySelector{ LocalObjectReference: corev1.LocalObjectReference{ diff --git a/vendor/modules.txt b/vendor/modules.txt index 0615e0182..cc71029d2 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -167,7 +167,7 @@ github.com/spf13/pflag # github.com/stretchr/testify v1.4.0 github.com/stretchr/testify/assert github.com/stretchr/testify/require -# github.com/tektoncd/pipeline v0.9.1 +# github.com/tektoncd/pipeline v0.9.2 github.com/tektoncd/pipeline/pkg/apis/config github.com/tektoncd/pipeline/pkg/apis/pipeline github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1