Skip to content

Commit 0526032

Browse files
authored
Merge pull request #155 from fluxcd/update-gitlab
bump gitlab to v0.68.0
2 parents 032d4fc + a69f979 commit 0526032

File tree

6 files changed

+27
-29
lines changed

6 files changed

+27
-29
lines changed

gitlab/client_repository_deploykey.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func (c *DeployKeyClient) Reconcile(ctx context.Context, req gitprovider.DeployK
138138
return actual, true, actual.Update(ctx)
139139
}
140140

141-
func createDeployKey(c gitlabClient, ref gitprovider.RepositoryRef, req gitprovider.DeployKeyInfo) (*gitlab.DeployKey, error) {
141+
func createDeployKey(c gitlabClient, ref gitprovider.RepositoryRef, req gitprovider.DeployKeyInfo) (*gitlab.ProjectDeployKey, error) {
142142
// First thing, validate and default the request to ensure a valid and fully-populated object
143143
// (to minimize any possible diffs between desired and actual state)
144144
if err := gitprovider.ValidateAndDefaultInfo(&req); err != nil {

gitlab/gitlabclient.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ type gitlabClient interface {
8080

8181
// ListKeys is a wrapper for "GET /projects/{project}/deploy_keys".
8282
// This function handles pagination, HTTP error wrapping, and validates the server result.
83-
ListKeys(projectName string) ([]*gitlab.DeployKey, error)
83+
ListKeys(projectName string) ([]*gitlab.ProjectDeployKey, error)
8484
// CreateProjectKey is a wrapper for "POST /projects/{project}/deploy_keys".
8585
// This function handles HTTP error wrapping, and validates the server result.
86-
CreateKey(projectName string, req *gitlab.DeployKey) (*gitlab.DeployKey, error)
86+
CreateKey(projectName string, req *gitlab.ProjectDeployKey) (*gitlab.ProjectDeployKey, error)
8787
// DeleteKey is a wrapper for "DELETE /projects/{project}/deploy_keys/{key_id}".
8888
// This function handles HTTP error wrapping.
8989
DeleteKey(projectName string, keyID int) error
@@ -155,10 +155,10 @@ func (c *gitlabClientImpl) ListGroups(ctx context.Context) ([]*gitlab.Group, err
155155

156156
func (c *gitlabClientImpl) ListSubgroups(ctx context.Context, groupName string) ([]*gitlab.Group, error) {
157157
var apiObjs []*gitlab.Group
158-
opts := &gitlab.ListSubgroupsOptions{}
158+
opts := &gitlab.ListSubGroupsOptions{}
159159
err := allSubgroupPages(opts, func() (*gitlab.Response, error) {
160160
// GET /groups
161-
pageObjs, resp, listErr := c.c.Groups.ListSubgroups(groupName, opts, gitlab.WithContext(ctx))
161+
pageObjs, resp, listErr := c.c.Groups.ListSubGroups(groupName, opts, gitlab.WithContext(ctx))
162162
apiObjs = append(apiObjs, pageObjs...)
163163
return resp, listErr
164164
})
@@ -329,8 +329,8 @@ func (c *gitlabClientImpl) DeleteProject(ctx context.Context, projectName string
329329
return err
330330
}
331331

332-
func (c *gitlabClientImpl) ListKeys(projectName string) ([]*gitlab.DeployKey, error) {
333-
apiObjs := []*gitlab.DeployKey{}
332+
func (c *gitlabClientImpl) ListKeys(projectName string) ([]*gitlab.ProjectDeployKey, error) {
333+
apiObjs := []*gitlab.ProjectDeployKey{}
334334
opts := &gitlab.ListProjectDeployKeysOptions{}
335335
err := allDeployKeyPages(opts, func() (*gitlab.Response, error) {
336336
// GET /projects/{project}/deploy_keys
@@ -350,11 +350,11 @@ func (c *gitlabClientImpl) ListKeys(projectName string) ([]*gitlab.DeployKey, er
350350
return apiObjs, nil
351351
}
352352

353-
func (c *gitlabClientImpl) CreateKey(projectName string, req *gitlab.DeployKey) (*gitlab.DeployKey, error) {
353+
func (c *gitlabClientImpl) CreateKey(projectName string, req *gitlab.ProjectDeployKey) (*gitlab.ProjectDeployKey, error) {
354354
opts := &gitlab.AddDeployKeyOptions{
355355
Title: &req.Title,
356356
Key: &req.Key,
357-
CanPush: req.CanPush,
357+
CanPush: &req.CanPush,
358358
}
359359
// POST /projects/{project}/deploy_keys
360360
apiObj, _, err := c.c.DeployKeys.AddDeployKey(projectName, opts)

gitlab/resource_deploykey.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"github.com/fluxcd/go-git-providers/validation"
2929
)
3030

31-
func newDeployKey(c *DeployKeyClient, key *gitlab.DeployKey) *deployKey {
31+
func newDeployKey(c *DeployKeyClient, key *gitlab.ProjectDeployKey) *deployKey {
3232
return &deployKey{
3333
k: *key,
3434
c: c,
@@ -39,9 +39,9 @@ func newDeployKey(c *DeployKeyClient, key *gitlab.DeployKey) *deployKey {
3939
var _ gitprovider.DeployKey = &deployKey{}
4040

4141
type deployKey struct {
42-
k gitlab.DeployKey
42+
k gitlab.ProjectDeployKey
4343
c *DeployKeyClient
44-
canpush *bool
44+
canpush bool
4545
}
4646

4747
func (dk *deployKey) Get() gitprovider.DeployKeyInfo {
@@ -136,7 +136,7 @@ func (dk *deployKey) createIntoSelf() error {
136136
return nil
137137
}
138138

139-
func validateDeployKeyAPI(apiObj *gitlab.DeployKey) error {
139+
func validateDeployKeyAPI(apiObj *gitlab.ProjectDeployKey) error {
140140
return validateAPIObject("GitLab.Key", func(validator validation.Validator) {
141141
if apiObj.Title == "" {
142142
validator.Required("Title")
@@ -147,40 +147,40 @@ func validateDeployKeyAPI(apiObj *gitlab.DeployKey) error {
147147
})
148148
}
149149

150-
func deployKeyFromAPI(apiObj *gitlab.DeployKey) gitprovider.DeployKeyInfo {
150+
func deployKeyFromAPI(apiObj *gitlab.ProjectDeployKey) gitprovider.DeployKeyInfo {
151151
return gitprovider.DeployKeyInfo{
152152
Name: apiObj.Title,
153153
Key: []byte(apiObj.Key),
154154
}
155155
}
156156

157-
func deployKeyToAPI(info *gitprovider.DeployKeyInfo) *gitlab.DeployKey {
158-
k := &gitlab.DeployKey{}
157+
func deployKeyToAPI(info *gitprovider.DeployKeyInfo) *gitlab.ProjectDeployKey {
158+
k := &gitlab.ProjectDeployKey{}
159159
deployKeyInfoToAPIObj(info, k)
160160
return k
161161
}
162162

163-
func deployKeyInfoToAPIObj(info *gitprovider.DeployKeyInfo, apiObj *gitlab.DeployKey) {
163+
func deployKeyInfoToAPIObj(info *gitprovider.DeployKeyInfo, apiObj *gitlab.ProjectDeployKey) {
164164
// Required fields, we assume info is validated, and hence these are set
165165
apiObj.Title = info.Name
166166
apiObj.Key = string(info.Key)
167167
// optional fields
168168
derefedBool := false
169169
if info.ReadOnly != nil {
170170
if *info.ReadOnly {
171-
apiObj.CanPush = &derefedBool
171+
apiObj.CanPush = derefedBool
172172
} else {
173173
derefedBool = true
174-
apiObj.CanPush = &derefedBool
174+
apiObj.CanPush = derefedBool
175175
}
176176
}
177177
}
178178

179179
// This function copies over the fields that are part of create request of a deploy
180180
// i.e. the desired spec of the deploy key. This allows us to separate "spec" from "status" fields.
181-
func newGitlabKeySpec(key *gitlab.DeployKey) *gitlabKeySpec {
181+
func newGitlabKeySpec(key *gitlab.ProjectDeployKey) *gitlabKeySpec {
182182
return &gitlabKeySpec{
183-
&gitlab.DeployKey{
183+
&gitlab.ProjectDeployKey{
184184
// Create-specific parameters
185185
Title: key.Title,
186186
Key: key.Key,
@@ -190,7 +190,7 @@ func newGitlabKeySpec(key *gitlab.DeployKey) *gitlabKeySpec {
190190
}
191191

192192
type gitlabKeySpec struct {
193-
*gitlab.DeployKey
193+
*gitlab.ProjectDeployKey
194194
}
195195

196196
func (s *gitlabKeySpec) Equals(other *gitlabKeySpec) bool {

gitlab/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func allGroupPages(opts *gitlab.ListGroupsOptions, fn func() (*gitlab.Response,
3838
}
3939
}
4040

41-
func allSubgroupPages(opts *gitlab.ListSubgroupsOptions, fn func() (*gitlab.Response, error)) error {
41+
func allSubgroupPages(opts *gitlab.ListSubGroupsOptions, fn func() (*gitlab.Response, error)) error {
4242
for {
4343
resp, err := fn()
4444
if err != nil {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require (
1717
github.com/ktrysmt/go-bitbucket v0.9.46
1818
github.com/onsi/ginkgo v1.16.5
1919
github.com/onsi/gomega v1.19.0
20-
github.com/xanzy/go-gitlab v0.58.0
20+
github.com/xanzy/go-gitlab v0.68.0
2121
go.uber.org/zap v1.21.0
2222
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
2323
golang.org/x/oauth2 v0.0.0-20220524215830-622c5d57e401

go.sum

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxC
160160
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
161161
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
162162
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
163-
github.com/hashicorp/go-retryablehttp v0.6.8/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
164163
github.com/hashicorp/go-retryablehttp v0.7.1 h1:sUiuQAnLlbvmExtFQs72iFW/HXeUn8Z1aJLQ4LJJbTQ=
165164
github.com/hashicorp/go-retryablehttp v0.7.1/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
166165
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
@@ -233,8 +232,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
233232
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
234233
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
235234
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
236-
github.com/xanzy/go-gitlab v0.58.0 h1:Entnl8GrVDlc1jd1BlOWhNR0QVQgiO3WDom5DJbT+1s=
237-
github.com/xanzy/go-gitlab v0.58.0/go.mod h1:F0QEXwmqiBUxCgJm8fE9S+1veX4XC9Z4cfaAbqwk4YM=
235+
github.com/xanzy/go-gitlab v0.68.0 h1:b2iMQHgZ1V+NyRqLRJVv6RFfr4xnd/AASeS/PETYL0Y=
236+
github.com/xanzy/go-gitlab v0.68.0/go.mod h1:o4yExCtdaqlM8YGdDJWuZoBmfxBsmA9TPEjs9mx1UO4=
238237
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
239238
github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0=
240239
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@@ -340,11 +339,11 @@ golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 h1:NWy5+hlRbC7HK+PmcXVUmW1IM
340339
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
341340
golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
342341
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
343-
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
344342
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
345343
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
346344
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
347345
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
346+
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
348347
golang.org/x/oauth2 v0.0.0-20220524215830-622c5d57e401 h1:zwrSfklXn0gxyLRX/aR+q6cgHbV/ItVyzbPlbA+dkAw=
349348
golang.org/x/oauth2 v0.0.0-20220524215830-622c5d57e401/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
350349
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -482,7 +481,6 @@ google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSr
482481
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
483482
google.golang.org/appengine v1.0.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
484483
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
485-
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
486484
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
487485
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
488486
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=

0 commit comments

Comments
 (0)