diff --git a/go.mod b/go.mod index 034fbcddb..225f441e7 100644 --- a/go.mod +++ b/go.mod @@ -56,7 +56,7 @@ require ( github.com/xeipuuv/gojsonschema v1.2.0 github.com/yaronf/httpsign v0.4.1 github.com/zalando/go-keyring v0.2.6 - gitlab.com/gitlab-org/api/client-go v0.161.1 + gitlab.com/gitlab-org/api/client-go v1.2.0 go.uber.org/multierr v1.11.0 golang.org/x/crypto v0.45.0 golang.org/x/net v0.47.0 @@ -212,10 +212,10 @@ require ( go.yaml.in/yaml/v2 v2.4.2 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/arch v0.20.0 // indirect - golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect + golang.org/x/exp v0.0.0-20250813145105-42675adae3e6 // indirect golang.org/x/mod v0.29.0 // indirect golang.org/x/sys v0.38.0 // indirect - golang.org/x/time v0.12.0 // indirect + golang.org/x/time v0.14.0 // indirect golang.org/x/tools v0.38.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20251022142026-3a174f9686a8 // indirect diff --git a/go.sum b/go.sum index 4e9261611..d60819448 100644 --- a/go.sum +++ b/go.sum @@ -599,8 +599,8 @@ github.com/zalando/go-keyring v0.2.6 h1:r7Yc3+H+Ux0+M72zacZoItR3UDxeWfKTcabvkI8u github.com/zalando/go-keyring v0.2.6/go.mod h1:2TCrxYrbUNYfNS/Kgy/LSrkSQzZ5UPVH85RwfczwvcI= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0= -gitlab.com/gitlab-org/api/client-go v0.161.1 h1:XX0EtVGL6cGEdNy9xnJ96CSciIzjCwAVsayItHY1YyU= -gitlab.com/gitlab-org/api/client-go v0.161.1/go.mod h1:YqKcnxyV9OPAL5U99mpwBVEgBPz1PK/3qwqq/3h6bao= +gitlab.com/gitlab-org/api/client-go v1.2.0 h1:D8v1XDL/PahIMBKIPT5qiYa5CFUFTlwkpdVkEek4bi4= +gitlab.com/gitlab-org/api/client-go v1.2.0/go.mod h1:RQfw64j1FE+KMZUAKsi1ZOOvwbWxHn9SkyZg+IAvjk4= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk= @@ -660,8 +660,8 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= -golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= -golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= +golang.org/x/exp v0.0.0-20250813145105-42675adae3e6 h1:SbTAbRFnd5kjQXbczszQ0hdk3ctwYf3qBNH9jIsGclE= +golang.org/x/exp v0.0.0-20250813145105-42675adae3e6/go.mod h1:4QTo5u+SEIbbKW1RacMZq1YEfOBqeXa19JeshGi+zc4= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= @@ -745,8 +745,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM= golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= -golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE= -golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= +golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= +golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= diff --git a/server/forge/gitlab/convert.go b/server/forge/gitlab/convert.go index ea5ddaafd..6b3f6270a 100644 --- a/server/forge/gitlab/convert.go +++ b/server/forge/gitlab/convert.go @@ -84,7 +84,7 @@ func (g *GitLab) convertGitLabRepo(_repo *gitlab.Project, projectMember *gitlab. return repo, nil } -func convertMergeRequestHook(hook *gitlab.MergeEvent, req *http.Request) (mergeID, milestoneID int, repo *model.Repo, pipeline *model.Pipeline, err error) { +func convertMergeRequestHook(hook *gitlab.MergeEvent, req *http.Request) (mergeID, milestoneID int64, repo *model.Repo, pipeline *model.Pipeline, err error) { repo = &model.Repo{} pipeline = &model.Pipeline{} diff --git a/server/forge/gitlab/gitlab.go b/server/forge/gitlab/gitlab.go index b4e6eb79a..a4683bb4b 100644 --- a/server/forge/gitlab/gitlab.go +++ b/server/forge/gitlab/gitlab.go @@ -206,8 +206,8 @@ func (g *GitLab) Teams(ctx context.Context, user *model.User, p *model.ListOptio groups, _, err := client.Groups.ListGroups(&gitlab.ListGroupsOptions{ ListOptions: gitlab.ListOptions{ - Page: p.Page, - PerPage: perPage, + Page: int64(p.Page), + PerPage: int64(perPage), }, AllAvailable: gitlab.Ptr(false), MinAccessLevel: gitlab.Ptr(gitlab.DeveloperPermissions), // TODO: check what's best here @@ -248,7 +248,7 @@ func (g *GitLab) getProject(ctx context.Context, client *gitlab.Client, forgeRem return repo, err } -func (g *GitLab) getInheritedProjectMember(ctx context.Context, client *gitlab.Client, forgeRemoteID model.ForgeRemoteID, owner, name string, userID int) (*gitlab.ProjectMember, error) { +func (g *GitLab) getInheritedProjectMember(ctx context.Context, client *gitlab.Client, forgeRemoteID model.ForgeRemoteID, owner, name string, userID int64) (*gitlab.ProjectMember, error) { if forgeRemoteID.IsValid() { intID, err := strconv.Atoi(string(forgeRemoteID)) if err != nil { @@ -279,7 +279,7 @@ func (g *GitLab) Repo(ctx context.Context, user *model.User, remoteID model.Forg return nil, err } - projectMember, err := g.getInheritedProjectMember(ctx, client, remoteID, owner, name, intUserID) + projectMember, err := g.getInheritedProjectMember(ctx, client, remoteID, owner, name, int64(intUserID)) if err != nil { return nil, err } @@ -301,8 +301,8 @@ func (g *GitLab) Repos(ctx context.Context, user *model.User, p *model.ListOptio opts := &gitlab.ListProjectsOptions{ ListOptions: gitlab.ListOptions{ - Page: p.Page, - PerPage: perPage, + Page: int64(p.Page), + PerPage: int64(perPage), }, MinAccessLevel: gitlab.Ptr(gitlab.DeveloperPermissions), // TODO: check what's best here } @@ -322,7 +322,7 @@ func (g *GitLab) Repos(ctx context.Context, user *model.User, p *model.ListOptio repos := make([]*model.Repo, 0, len(projects)) for i := range projects { - projectMember, _, err := client.ProjectMembers.GetInheritedProjectMember(projects[i].ID, intUserID, gitlab.WithContext(ctx)) + projectMember, _, err := client.ProjectMembers.GetInheritedProjectMember(projects[i].ID, int64(intUserID), gitlab.WithContext(ctx)) if err != nil { return nil, err } @@ -352,7 +352,7 @@ func (g *GitLab) PullRequests(ctx context.Context, u *model.User, r *model.Repo, state := "opened" pullRequests, _, err := client.MergeRequests.ListProjectMergeRequests(_repo.ID, &gitlab.ListProjectMergeRequestsOptions{ - ListOptions: gitlab.ListOptions{Page: p.Page, PerPage: p.PerPage}, + ListOptions: gitlab.ListOptions{Page: int64(p.Page), PerPage: int64(p.PerPage)}, State: &state, }) if err != nil { @@ -362,7 +362,7 @@ func (g *GitLab) PullRequests(ctx context.Context, u *model.User, r *model.Repo, result := make([]*model.PullRequest, len(pullRequests)) for i := range pullRequests { result[i] = &model.PullRequest{ - Index: model.ForgeRemoteID(strconv.Itoa(pullRequests[i].ID)), + Index: model.ForgeRemoteID(strconv.Itoa(int(pullRequests[i].ID))), Title: pullRequests[i].Title, } } @@ -549,8 +549,10 @@ func (g *GitLab) Deactivate(ctx context.Context, user *model.User, repo *model.R } listProjectHooksOptions := &gitlab.ListProjectHooksOptions{ - PerPage: defaultPerPage, - Page: 1, + ListOptions: gitlab.ListOptions{ + PerPage: defaultPerPage, + Page: 1, + }, } for { hooks, resp, err := client.Projects.ListProjectHooks(_repo.ID, listProjectHooksOptions, gitlab.WithContext(ctx)) @@ -593,7 +595,7 @@ func (g *GitLab) Branches(ctx context.Context, user *model.User, repo *model.Rep } gitlabBranches, _, err := client.Branches.ListBranches(_repo.ID, - &gitlab.ListBranchesOptions{ListOptions: gitlab.ListOptions{Page: p.Page, PerPage: p.PerPage}}, + &gitlab.ListBranchesOptions{ListOptions: gitlab.ListOptions{Page: int64(p.Page), PerPage: int64(p.PerPage)}}, gitlab.WithContext(ctx)) if err != nil { return nil, err @@ -689,7 +691,7 @@ func (g *GitLab) OrgMembership(ctx context.Context, u *model.User, owner string) if err != nil { return nil, err } - var gid int + var gid int64 for _, group := range groups { if group.Name == owner { gid = group.ID @@ -708,7 +710,7 @@ func (g *GitLab) OrgMembership(ctx context.Context, u *model.User, owner string) } for i := 1; true; i++ { - opts.Page = i + opts.Page = int64(i) members, _, err := client.Groups.ListAllGroupMembers(gid, opts, gitlab.WithContext(ctx)) if err != nil { return nil, err @@ -719,7 +721,7 @@ func (g *GitLab) OrgMembership(ctx context.Context, u *model.User, owner string) } } - if len(members) < opts.PerPage { + if len(members) < int(opts.PerPage) { break } } @@ -777,7 +779,7 @@ func (g *GitLab) Org(ctx context.Context, u *model.User, owner string) (*model.O }, nil } -func (g *GitLab) loadMetadataFromMergeRequest(ctx context.Context, tmpRepo *model.Repo, pipeline *model.Pipeline, mergeID, milestoneID int) (*model.Pipeline, error) { +func (g *GitLab) loadMetadataFromMergeRequest(ctx context.Context, tmpRepo *model.Repo, pipeline *model.Pipeline, mergeID, milestoneID int64) (*model.Pipeline, error) { _store, ok := store.TryFromContext(ctx) if !ok { log.Error().Msg("could not get store from context")