diff --git a/go.mod b/go.mod index e5de973a480..12a31e64f7b 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/golang-lru v1.0.2 - github.com/jenkins-x/go-scm v1.13.13 + github.com/jenkins-x/go-scm v1.14.14 github.com/mitchellh/go-homedir v1.1.0 github.com/opencontainers/image-spec v1.1.0-rc4 github.com/pkg/errors v0.9.1 @@ -29,7 +29,7 @@ require ( gomodules.xyz/jsonpatch/v2 v2.2.0 gopkg.in/square/go-jose.v2 v2.6.0 k8s.io/api v0.27.1 - k8s.io/apimachinery v0.27.1 + k8s.io/apimachinery v0.27.3 k8s.io/client-go v0.27.1 k8s.io/code-generator v0.26.5 k8s.io/klog v1.0.0 @@ -210,7 +210,7 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/shurcooL/githubv4 v0.0.0-20190718010115-4ba037080260 // indirect github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f // indirect - github.com/sirupsen/logrus v1.9.1 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/testify v1.8.4 github.com/vbatts/tar-split v0.11.3 // indirect diff --git a/go.sum b/go.sum index 9771b92cb0f..563b0ee6298 100644 --- a/go.sum +++ b/go.sum @@ -729,8 +729,8 @@ github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aW github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= github.com/jellydator/ttlcache/v3 v3.1.0 h1:0gPFG0IHHP6xyUyXq+JaD8fwkDCqgqwohXNJBcYE71g= github.com/jellydator/ttlcache/v3 v3.1.0/go.mod h1:hi7MGFdMAwZna5n2tuvh63DvFLzVKySzCVW6+0gA2n4= -github.com/jenkins-x/go-scm v1.13.13 h1:QEUDWwaLMMGuf8b82SUR8AZpXETEu9U5J7eC4fU7HSM= -github.com/jenkins-x/go-scm v1.13.13/go.mod h1:CY2nNGW77Wp8bKvNf8/iarzMgP9h/l2cFDx/vb/ymF0= +github.com/jenkins-x/go-scm v1.14.14 h1:a4c3z4+FVPMWMl59hgdLZNbnbc0Z0/Ln6fHXS0hLAyY= +github.com/jenkins-x/go-scm v1.14.14/go.mod h1:MR/WVGUSEqED4SP/lWaRKtks/vYGtylFueDr1FLogYg= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= @@ -993,7 +993,7 @@ github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqn github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= @@ -1033,8 +1033,8 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/sirupsen/logrus v1.9.1 h1:Ou41VVR3nMWWmTiEUnj0OlsgOSCUFgsPAOl6jRIcVtQ= -github.com/sirupsen/logrus v1.9.1/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/skeema/knownhosts v1.2.0 h1:h9r9cf0+u7wSE+M183ZtMGgOJKiL96brpaz5ekfJCpM= github.com/skeema/knownhosts v1.2.0/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= diff --git a/vendor/github.com/jenkins-x/go-scm/scm/driver/bitbucket/user.go b/vendor/github.com/jenkins-x/go-scm/scm/driver/bitbucket/user.go index 4a69b8da8e5..f878896836e 100644 --- a/vendor/github.com/jenkins-x/go-scm/scm/driver/bitbucket/user.go +++ b/vendor/github.com/jenkins-x/go-scm/scm/driver/bitbucket/user.go @@ -79,9 +79,13 @@ func convertUser(from *user) *scm.User { if name == "" { name = from.DisplayName } + login := from.Login + if login == "" { + login = from.AccountID + } return &scm.User{ - Avatar: fmt.Sprintf("https://bitbucket.org/account/%s/avatar/32/", from.Login), - Login: from.Login, + Avatar: fmt.Sprintf("https://bitbucket.org/account/%s/avatar/32/", login), + Login: login, Name: name, } } diff --git a/vendor/github.com/jenkins-x/go-scm/scm/driver/fake/content.go b/vendor/github.com/jenkins-x/go-scm/scm/driver/fake/content.go index 17c29dfc8fb..819524b84c4 100644 --- a/vendor/github.com/jenkins-x/go-scm/scm/driver/fake/content.go +++ b/vendor/github.com/jenkins-x/go-scm/scm/driver/fake/content.go @@ -59,7 +59,6 @@ func (c contentService) List(_ context.Context, repo, path, ref string) ([]*scm. if f.IsDir() { t = "dir" } - path := filepath.Join(dir, name) info, err := f.Info() if err != nil { return nil, nil, fmt.Errorf("cannot get info for file %s: %v", name, err) @@ -68,11 +67,11 @@ func (c contentService) List(_ context.Context, repo, path, ref string) ([]*scm. answer = append(answer, &scm.FileEntry{ Name: name, - Path: path, + Path: fmt.Sprintf("%s/%s", path, name), Type: t, Size: int(fSize), Sha: ref, - Link: "file://" + path, + Link: "file://" + filepath.Join(dir, name), }) } return answer, nil, nil diff --git a/vendor/github.com/jenkins-x/go-scm/scm/driver/gitea/user.go b/vendor/github.com/jenkins-x/go-scm/scm/driver/gitea/user.go index 6fe3d24d720..71deed18486 100644 --- a/vendor/github.com/jenkins-x/go-scm/scm/driver/gitea/user.go +++ b/vendor/github.com/jenkins-x/go-scm/scm/driver/gitea/user.go @@ -83,10 +83,11 @@ func convertUser(src *gitea.User) *scm.User { return nil } return &scm.User{ - ID: int(src.ID), - Login: src.UserName, - Name: src.FullName, - Email: src.Email, - Avatar: src.AvatarURL, + ID: int(src.ID), + Login: src.UserName, + Name: src.FullName, + Email: src.Email, + Avatar: src.AvatarURL, + IsAdmin: src.IsAdmin, } } diff --git a/vendor/github.com/jenkins-x/go-scm/scm/driver/gitlab/repo.go b/vendor/github.com/jenkins-x/go-scm/scm/driver/gitlab/repo.go index 0efe6689136..2ce7799a9c9 100644 --- a/vendor/github.com/jenkins-x/go-scm/scm/driver/gitlab/repo.go +++ b/vendor/github.com/jenkins-x/go-scm/scm/driver/gitlab/repo.go @@ -252,10 +252,15 @@ func (s *repositoryService) AddCollaborator(ctx context.Context, repo, username, AccessLevel: stringToAccessLevel(permission), } res, err := s.client.do(ctx, "POST", path, in, &out) + if res.Status == 409 { + // GitLab returns 409 Conflict and message "Member already exists" + return false, true, res, err + } if err != nil { return false, false, res, err } - return true, false, res, nil + // Return that user has become a member already (no invite/accept in GitLab) + return true, true, res, nil } func (s *repositoryService) IsCollaborator(ctx context.Context, repo, user string) (bool, *scm.Response, error) { diff --git a/vendor/github.com/jenkins-x/go-scm/scm/driver/gitlab/webhook.go b/vendor/github.com/jenkins-x/go-scm/scm/driver/gitlab/webhook.go index 728663c6938..2a02c096b8e 100644 --- a/vendor/github.com/jenkins-x/go-scm/scm/driver/gitlab/webhook.go +++ b/vendor/github.com/jenkins-x/go-scm/scm/driver/gitlab/webhook.go @@ -184,6 +184,15 @@ func convertPushHook(src *pushHook) *scm.PushHook { // get the last commit (most recent) dst.Commit.Message = src.Commits[len(src.Commits)-1].Message dst.Commit.Link = src.Commits[len(src.Commits)-1].URL + for i := range src.Commits { + dst.Commits = append(dst.Commits, scm.PushCommit{ + ID: src.Commits[i].URL, + Message: src.Commits[i].Message, + Added: src.Commits[i].Added, + Removed: src.Commits[i].Removed, + Modified: src.Commits[i].Modified, + }) + } } return dst } @@ -513,9 +522,9 @@ type ( Name string `json:"name"` Email string `json:"email"` } `json:"author"` - Added []string `json:"added"` - Modified []interface{} `json:"modified"` - Removed []interface{} `json:"removed"` + Added []string `json:"added"` + Modified []string `json:"modified"` + Removed []string `json:"removed"` } `json:"commits"` TotalCommitsCount int `json:"total_commits_count"` Repository struct { diff --git a/vendor/github.com/sirupsen/logrus/writer.go b/vendor/github.com/sirupsen/logrus/writer.go index 7e7703c7238..074fd4b8bd7 100644 --- a/vendor/github.com/sirupsen/logrus/writer.go +++ b/vendor/github.com/sirupsen/logrus/writer.go @@ -70,16 +70,16 @@ func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ... scanner.Buffer(make([]byte, bufio.MaxScanTokenSize), bufio.MaxScanTokenSize) // Define a split function to split the input into chunks of up to 64KB - chunkSize := 64 * 1024 // 64KB + chunkSize := bufio.MaxScanTokenSize // 64KB splitFunc := func(data []byte, atEOF bool) (int, []byte, error) { - if len(data) > chunkSize { + if len(data) >= chunkSize { return chunkSize, data[:chunkSize], nil } - return len(data), data, nil + return bufio.ScanLines(data, atEOF) } - //Use the custom split function to split the input + // Use the custom split function to split the input scanner.Split(splitFunc) // Scan the input and write it to the logger using the specified print function diff --git a/vendor/modules.txt b/vendor/modules.txt index 3a54bae3c36..88d94538be2 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -642,7 +642,7 @@ github.com/jbenet/go-context/io # github.com/jellydator/ttlcache/v3 v3.1.0 ## explicit; go 1.18 github.com/jellydator/ttlcache/v3 -# github.com/jenkins-x/go-scm v1.13.13 +# github.com/jenkins-x/go-scm v1.14.14 ## explicit; go 1.19 github.com/jenkins-x/go-scm/pkg/hmac github.com/jenkins-x/go-scm/scm @@ -817,7 +817,7 @@ github.com/sigstore/sigstore/pkg/signature/kms/gcp # github.com/sigstore/sigstore/pkg/signature/kms/hashivault v1.7.3 ## explicit; go 1.19 github.com/sigstore/sigstore/pkg/signature/kms/hashivault -# github.com/sirupsen/logrus v1.9.1 +# github.com/sirupsen/logrus v1.9.3 ## explicit; go 1.13 github.com/sirupsen/logrus # github.com/skeema/knownhosts v1.2.0 @@ -1296,7 +1296,7 @@ k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensio k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1 k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1beta1 -# k8s.io/apimachinery v0.27.1 => k8s.io/apimachinery v0.26.7 +# k8s.io/apimachinery v0.27.3 => k8s.io/apimachinery v0.26.7 ## explicit; go 1.19 k8s.io/apimachinery/pkg/api/equality k8s.io/apimachinery/pkg/api/errors