Skip to content

Commit 8299ee9

Browse files
authored
Update gitlab library (#3064)
Signed-off-by: Matej Vašek <mvasek@redhat.com>
1 parent 7cb458e commit 8299ee9

File tree

4 files changed

+19
-69
lines changed

4 files changed

+19
-69
lines changed

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ require (
5353
github.com/spf13/pflag v1.0.10
5454
github.com/tektoncd/cli v0.37.0
5555
github.com/tektoncd/pipeline v0.65.1
56-
github.com/xanzy/go-gitlab v0.102.0
56+
gitlab.com/gitlab-org/api/client-go v0.150.0
5757
golang.org/x/crypto v0.42.0
5858
golang.org/x/net v0.44.0
5959
golang.org/x/oauth2 v0.30.0
@@ -166,7 +166,7 @@ require (
166166
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
167167
github.com/golang/protobuf v1.5.4 // indirect
168168
github.com/google/btree v1.1.3 // indirect
169-
github.com/google/cel-go v0.23.2 // indirect
169+
github.com/google/cel-go v0.26.1 // indirect
170170
github.com/google/gnostic-models v0.6.9 // indirect
171171
github.com/google/go-intervals v0.0.2 // indirect
172172
github.com/google/go-querystring v1.1.0 // indirect
@@ -179,7 +179,7 @@ require (
179179
github.com/hashicorp/errwrap v1.1.0 // indirect
180180
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
181181
github.com/hashicorp/go-multierror v1.1.1 // indirect
182-
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
182+
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
183183
github.com/hashicorp/golang-lru v1.0.2 // indirect
184184
github.com/hashicorp/hcl v1.0.1-vault-5 // indirect
185185
github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0 // indirect
@@ -252,7 +252,7 @@ require (
252252
github.com/spf13/cast v1.7.1 // indirect
253253
github.com/spf13/jwalterweatherman v1.1.0 // indirect
254254
github.com/spf13/viper v1.18.2 // indirect
255-
github.com/stoewer/go-strcase v1.3.0 // indirect
255+
github.com/stoewer/go-strcase v1.3.1 // indirect
256256
github.com/subosito/gotenv v1.6.0 // indirect
257257
github.com/sylabs/sif/v2 v2.18.0 // indirect
258258
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
@@ -288,7 +288,7 @@ require (
288288
google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect
289289
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
290290
google.golang.org/grpc v1.74.2 // indirect
291-
google.golang.org/protobuf v1.36.8 // indirect
291+
google.golang.org/protobuf v1.36.10 // indirect
292292
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
293293
gopkg.in/inf.v0 v0.9.1 // indirect
294294
gopkg.in/ini.v1 v1.67.0 // indirect

go.sum

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,8 @@ github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9
503503
github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg=
504504
github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
505505
github.com/google/cel-go v0.12.7/go.mod h1:Jk7ljRzLBhkmiAwBoUxB1sZSCVBAzkqPF25olK/iRDw=
506-
github.com/google/cel-go v0.23.2 h1:UdEe3CvQh3Nv+E/j9r1Y//WO0K0cSyD7/y0bzyLIMI4=
507-
github.com/google/cel-go v0.23.2/go.mod h1:52Pb6QsDbC5kvgxvZhiL9QX1oZEkcUF/ZqaPx1J5Wwo=
506+
github.com/google/cel-go v0.26.1 h1:iPbVVEdkhTX++hpe3lzSk7D3G3QSYqLGoHOcEio+UXQ=
507+
github.com/google/cel-go v0.26.1/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM=
508508
github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ=
509509
github.com/google/gnostic-models v0.6.9 h1:MU/8wDLif2qCXZmzncUQ/BOfxWfthHi63KqpoNbWqVw=
510510
github.com/google/gnostic-models v0.6.9/go.mod h1:CiWsm0s6BSQd1hRn8/QmxqB6BesYcbSZxsz9b0KuDBw=
@@ -610,8 +610,8 @@ github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iP
610610
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
611611
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
612612
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
613-
github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU=
614-
github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk=
613+
github.com/hashicorp/go-retryablehttp v0.7.8 h1:ylXZWnqa7Lhqpk0L1P1LzDtGcCR0rPVUrx/c8Unxc48=
614+
github.com/hashicorp/go-retryablehttp v0.7.8/go.mod h1:rjiScheydd+CxvumBsIrFKlx3iS0jrZ7LvzFGFmuKbw=
615615
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
616616
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
617617
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
@@ -1024,8 +1024,8 @@ github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5q
10241024
github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ=
10251025
github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk=
10261026
github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8=
1027-
github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs=
1028-
github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo=
1027+
github.com/stoewer/go-strcase v1.3.1 h1:iS0MdW+kVTxgMoE1LAZyMiYJFKlOzLooE4MxjirtkAs=
1028+
github.com/stoewer/go-strcase v1.3.1/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo=
10291029
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
10301030
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
10311031
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
@@ -1093,8 +1093,6 @@ github.com/vbatts/tar-split v0.11.6 h1:4SjTW5+PU11n6fZenf2IPoV8/tz3AaYHMWjf23env
10931093
github.com/vbatts/tar-split v0.11.6/go.mod h1:dqKNtesIOr2j2Qv3W/cHjnvk9I8+G7oAkFDFN6TCBEI=
10941094
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
10951095
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
1096-
github.com/xanzy/go-gitlab v0.102.0 h1:ExHuJ1OTQ2yt25zBMMj0G96ChBirGYv8U7HyUiYkZ+4=
1097-
github.com/xanzy/go-gitlab v0.102.0/go.mod h1:ETg8tcj4OhrB84UEgeE8dSuV/0h4BBL1uOV/qK0vlyI=
10981096
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
10991097
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
11001098
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
@@ -1117,6 +1115,8 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
11171115
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
11181116
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
11191117
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
1118+
gitlab.com/gitlab-org/api/client-go v0.150.0 h1:vaSt6hBsSAXc1ZQIEMa1sGuG9vBu3nUGouURDTrPMPw=
1119+
gitlab.com/gitlab-org/api/client-go v0.150.0/go.mod h1:CQVoxjEswJZeXft4Mi+H+OF1MVrpNVF6m4xvlPTQ2J4=
11201120
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
11211121
go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4=
11221122
go.etcd.io/etcd/api/v3 v3.5.7/go.mod h1:9qew1gCdDDLu+VwmeG+iFpL+QlpHTo7iubavdVDgCAA=
@@ -1786,8 +1786,8 @@ google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw
17861786
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
17871787
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
17881788
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
1789-
google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=
1790-
google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
1789+
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
1790+
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
17911791
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
17921792
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
17931793
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

pkg/git/gitlab/gitlab.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"fmt"
66

7-
"github.com/xanzy/go-gitlab"
7+
gitlab "gitlab.com/gitlab-org/api/client-go"
88
)
99

1010
type Client struct {

pkg/pipelines/tekton/gitlab_int_test.go

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
package tekton_test
55

66
import (
7-
"bytes"
87
"context"
98
"crypto/ecdsa"
109
"crypto/elliptic"
@@ -13,7 +12,6 @@ import (
1312
"encoding/json"
1413
"encoding/pem"
1514
"fmt"
16-
"io"
1715
"net/http"
1816
"net/http/cookiejar"
1917
"net/url"
@@ -26,7 +24,7 @@ import (
2624
"testing"
2725
"time"
2826

29-
"github.com/xanzy/go-gitlab"
27+
gitlab "gitlab.com/gitlab-org/api/client-go"
3028
"golang.org/x/crypto/ssh"
3129
"golang.org/x/net/html"
3230

@@ -214,10 +212,7 @@ func setupGitlabEnv(ctx context.Context, t *testing.T, baseURL, username, passwo
214212
t.Fatal(err)
215213
}
216214

217-
// http client with hacky RoundTripper that removes problematic values from the JSON response
218-
httpCli := &http.Client{Transport: rt{}}
219-
220-
glabCli, err := gitlab.NewClient(rootToken, gitlab.WithBaseURL(baseURL), gitlab.WithHTTPClient(httpCli))
215+
glabCli, err := gitlab.NewClient(rootToken, gitlab.WithBaseURL(baseURL))
221216
if err != nil {
222217
t.Fatal(err)
223218
}
@@ -317,7 +312,7 @@ func setupGitlabEnv(ctx context.Context, t *testing.T, baseURL, username, passwo
317312
}
318313
t.Logf("created project: %q", project.Name)
319314
t.Cleanup(func() {
320-
_, _ = glabCli.Projects.DeleteProject(project.ID)
315+
_, _ = glabCli.Projects.DeleteProject(project.ID, nil)
321316
})
322317
//endregion
323318

@@ -359,51 +354,6 @@ func setupGitlabEnv(ctx context.Context, t *testing.T, baseURL, username, passwo
359354
}
360355
}
361356

362-
// RoundTripper which only purpose is to ensures that response JSON from the setting endpoint
363-
// does not contain empty string value the key container_registry_import_created_before.
364-
// Empty string for date/time causes serialization error.
365-
type rt struct{}
366-
367-
func (r rt) RoundTrip(request *http.Request) (*http.Response, error) {
368-
resp, err := http.DefaultTransport.RoundTrip(request)
369-
370-
if request.URL.Path != "/api/v4/application/settings" {
371-
return resp, err
372-
}
373-
if resp.Header.Get("Content-Type") != "application/json" {
374-
return resp, err
375-
}
376-
if err != nil {
377-
return nil, err
378-
}
379-
380-
origBody := resp.Body
381-
defer origBody.Close()
382-
383-
var data any
384-
dec := json.NewDecoder(origBody)
385-
err = dec.Decode(&data)
386-
if err != nil {
387-
return nil, fmt.Errorf("roundtripper could not deserialize data: %v", err)
388-
}
389-
390-
if m, ok := data.(map[string]any); ok {
391-
if val, inMap := m["container_registry_import_created_before"]; inMap && val == "" {
392-
delete(m, "container_registry_import_created_before")
393-
}
394-
}
395-
396-
var newBody bytes.Buffer
397-
enc := json.NewEncoder(&newBody)
398-
err = enc.Encode(&data)
399-
if err != nil {
400-
return nil, fmt.Errorf("roundtripper could not serialize data: %v", err)
401-
}
402-
403-
resp.Body = io.NopCloser(&newBody)
404-
return resp, nil
405-
}
406-
407357
func getAPIToken(baseURL, username, password string) (string, error) {
408358
jar, err := cookiejar.New(nil)
409359
if err != nil {

0 commit comments

Comments
 (0)