Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Commit

Permalink
Update deps to master
Browse files Browse the repository at this point in the history
- Change deps version from `.16` to `master`
- `hack/update-deps --upgrade`
- Fix compilation errors

Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
  • Loading branch information
pierDipi committed Jul 27, 2020
1 parent f1f0b1e commit d65391d
Show file tree
Hide file tree
Showing 1,009 changed files with 95,517 additions and 75,576 deletions.
60 changes: 14 additions & 46 deletions gitlab/client.go
Original file line number Diff line number Diff line change
@@ -1,55 +1,23 @@
/*
Copyright 2020 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.
*/
* Copyright 2020 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 gitlab

import (
"context"
"io/ioutil"
"net/http"
"path/filepath"

"github.com/xanzy/go-gitlab"
)

const (
AccessTokenKey = "accessToken"
VolumeName = "gitlab-binding"
MountPath = "/var/bindings/gitlab"
)

// ReadKey may be used to read keys from the secret bound by the GitLabBinding.
func ReadKey(key string) (string, error) {
data, err := ioutil.ReadFile(filepath.Join(MountPath, key))
if err != nil {
return "", err
}
return string(data), nil
}

// AccessToken reads the file named accessToken that is mounted by the GitLabBinding.
func AccessToken() (string, error) {
return ReadKey(AccessTokenKey)
}

// New instantiates a new gitlab client from the access token from the GitLabBinding
func New(ctx context.Context) (*gitlab.Client, error) {
at, err := AccessToken()
if err != nil {
return nil, err
}
return gitlab.NewClient(http.DefaultClient, at), nil
}
12 changes: 8 additions & 4 deletions gitlab/pkg/reconciler/source/webhook_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ type projectHookOptions struct {
type gitlabHookClient struct{}

func (client gitlabHookClient) Create(baseURL string, options *projectHookOptions) (string, error) {
glClient := gitlab.NewClient(nil, options.accessToken)
glClient.SetBaseURL(baseURL)
glClient, err := gitlab.NewClient(options.accessToken, gitlab.WithBaseURL(baseURL))
if err != nil {
return "", fmt.Errorf("failed to create client: %w", err)
}

if options.id != "" {
hookID, err := strconv.Atoi(options.id)
Expand Down Expand Up @@ -100,8 +102,10 @@ func (client gitlabHookClient) Delete(baseURL string, options *projectHookOption
if err != nil {
return fmt.Errorf("failed to convert hook id to int: " + err.Error())
}
glClient := gitlab.NewClient(nil, options.accessToken)
glClient.SetBaseURL(baseURL)
glClient, err := gitlab.NewClient(options.accessToken, gitlab.WithBaseURL(baseURL))
if err != nil {
return fmt.Errorf("failed to create client: %w", err)
}

projhooks, _, err := glClient.Projects.ListProjectHooks(options.project, nil, nil)
if err != nil {
Expand Down
22 changes: 11 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.14
require (
github.com/Shopify/sarama v1.26.4
github.com/apache/camel-k v0.0.0-20200430164844-778ae8a2bd63
github.com/aws/aws-sdk-go v1.30.16
github.com/aws/aws-sdk-go v1.31.12
github.com/cloudevents/sdk-go/protocol/kafka_sarama/v2 v2.1.0
github.com/cloudevents/sdk-go/protocol/stan/v2 v2.1.0
github.com/cloudevents/sdk-go/v2 v2.1.0
Expand All @@ -14,35 +14,35 @@ require (
github.com/go-kivik/couchdb/v3 v3.0.4
github.com/go-kivik/kivik/v3 v3.0.2
github.com/go-kivik/kivikmock/v3 v3.0.0
github.com/golang/protobuf v1.4.0
github.com/google/go-cmp v0.4.1
github.com/golang/protobuf v1.4.2
github.com/google/go-cmp v0.5.1
github.com/google/go-github/v31 v31.0.0
github.com/google/uuid v1.1.1
github.com/gorilla/websocket v1.4.1
github.com/gorilla/websocket v1.4.2
github.com/kelseyhightower/envconfig v1.4.0
github.com/nats-io/stan.go v0.6.0
github.com/otiai10/copy v1.2.0 // indirect
github.com/pkg/errors v0.9.1
github.com/robfig/cron v1.2.0
github.com/slinkydeveloper/loadastic v0.0.0-20191203132749-9afe5a010a57
github.com/stretchr/testify v1.5.1
github.com/xanzy/go-gitlab v0.28.0
github.com/xanzy/go-gitlab v0.32.0
gitlab.com/flimzy/testy v0.2.1 // indirect
go.opencensus.io v0.22.5-0.20200716030834-3456e1d174b2
go.opentelemetry.io/otel v0.4.2 // indirect
go.uber.org/zap v1.14.1
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e
golang.org/x/net v0.0.0-20200707034311-ab3426394381
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
gopkg.in/go-playground/webhooks.v5 v5.13.0
gopkg.in/yaml.v2 v2.3.0
k8s.io/api v0.18.1
k8s.io/apimachinery v0.18.1
k8s.io/apimachinery v0.18.6
k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible
k8s.io/utils v0.0.0-20200124190032-861946025e34
knative.dev/eventing v0.16.1
knative.dev/pkg v0.0.0-20200702222342-ea4d6e985ba0
knative.dev/serving v0.16.0
knative.dev/test-infra v0.0.0-20200630141629-15f40fe97047
knative.dev/eventing v0.16.1-0.20200726092658-9c16bdbec2f3
knative.dev/pkg v0.0.0-20200727081359-9a051b3decfd
knative.dev/serving v0.16.1-0.20200727085159-0fb04711c130
knative.dev/test-infra v0.0.0-20200725213358-8557dab80d7a
)

replace (
Expand Down
Loading

0 comments on commit d65391d

Please sign in to comment.