lindell / multi-gitter

Update multiple repositories in with one command

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can not support gitlab api v4

zhxjdwh opened this issue · comments

Describe the bug
can not support gitlab api v4

To Reproduce

self hosted gitlab-server version: 13.1.1
multi-gitter version: @latest

  1. install multi-gitter
    go install github.com/lindell/multi-gitter@latest

./multi-gitter run 'ls' --base-url http://192.168.1.165:62000/ -m "test Commit message" -R 'agent-H5/agent-aecarspdb-api' -B develop --log-level=trace

gitlab server return error:
API V3 is no longer supported. Use API V4 instead.

./multi-gitter run 'ls' --base-url http://192.168.1.165:62000/api/v4 -m "test Commit message" -R 'agent-H5/agent-aecarspdb-api' -B develop --log-level=trace

gitlab server return error:
404 not found

Expected behavior
support gitlab api v4

Additional context

./multi-gitter run 'ls' --base-url http://192.168.1.165:62000/ -m "test Commit message" -R 'agent-H5/agent-aecarspdb-api' -B develop --log-level=trace
TRAC[0000] http request host="192.168.1.165:62000" request="GET /api/v3/repos/agent-H5/agent-aecarspdb-api HTTP/1.1\r\nHost: 192.168.1.165:62000\r\nUser-Agent: go-github/v59.0.0\r\nAccept: application/vnd.github.scarlet-witch-preview+json, application/vnd.github.mercy-preview+json, application/vnd.github.baptiste-preview+json, application/vnd.github.nebula-preview+json\r\nX-Github-Api-Version: 2022-11-28\r\nAccept-Encoding: gzip\r\n\r\n" response="HTTP/1.1 410 Gone\r\nContent-Length: 62\r\nCache-Control: no-cache\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nDate: Thu, 14 Mar 2024 04:15:34 GMT\r\nServer: nginx\r\nVary: Origin\r\nX-Request-Id: RGo7iWRHrU7\r\nX-Runtime: 0.008462\r\n\r\n{"error":"API V3 is no longer supported. Use API V4 instead."}" took=12.7817ms
could not fetch repositories: could not get information about agent-H5/agent-aecarspdb-api: GET http://192.168.1.165:62000/api/v3/repos/agent-H5/agent-aecarspdb-api: 410 []

./multi-gitter run 'ls' --base-url http://192.168.1.165:62000/api/v4 -m "test Commit message" -R 'agent-H5/agent-aecarspdb-api' -B develop --log-level=t
race
TRAC[0000] http request host="192.168.1.165:62000" request="GET /api/v4/api/v3/repos/agent-H5/agent-aecarspdb-api HTTP/1.1\r\nHost: 192.168.1.165:62000\r\nUser-Agent: go-github/v59.0.0\r\nAccept: application/vnd.github.scarlet-witch-preview+json, application/vnd.github.mercy-preview+json, application/vnd.github.baptiste-preview+json, application/vnd.github.nebula-preview+json\r\nX-Github-Api-Version: 2022-11-28\r\nAccept-Encoding: gzip\r\n\r\n" response="HTTP/1.1 404 Not Found\r\nContent-Length: 25\r\nCache-Control: no-cache\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nDate: Thu, 14 Mar 2024 04:17:21 GMT\r\nServer: nginx\r\nVary: Origin\r\nX-Request-Id: tHKPrrJSyo9\r\nX-Runtime: 0.007020\r\n\r\n{"error":"404 Not Found"}" took=10.7306ms
could not fetch repositories: could not get information about agent-H5/agent-aecarspdb-api: GET http://192.168.1.165:62000/api/v4/api/v3/repos/agent-H5/agent-aecarspdb-api: 404 []

Expected behavior
support gitlab api v4

I think this is the opposite of what you think.
The library that multi-gitter uses seems to only support v4 as of 2017

Release v0.6.0 (released on 25-08-2017) no longer supports the older V3 GitLab API. If you need V3 support, please use the f-> api-v3 branch. This release contains some backwards incompatible changes that were needed to fully support the V4 GitLab API.

From: https://github.com/xanzy/go-gitlab

We do not intend to support the now very old v3 API.

Please confirm that this is the case so that this bug can be closed.

@ccrstory Please read my last comment. The problem seems to be the opposite. Which GitLab version are you using?

@ccrstory Please read my last comment. The problem seems to be the opposite. Which GitLab version are you using?

Gitlab version v16.5.8-ee

Is it the GitLab instance that's making the request to v3? I'm not specifying it anywhere

Hmm, you version is way more up to date compared to @zhxjdwh . It should have V4, could you provide what parameters you are using, and some logs resulting from it.

multi-gitter run ./test.sh --log-level=trace --config=config.yml -m "test"
TRAC[0000] http request host=gitlab.test.com request="GET /api/v3/repos/e4/angular HTTP/1.1\r\nHost: gitlab.test.com\r\nUser-Agent: go-github/v59.0.0\r\nAccept: application/vnd.github.scarlet-witch-preview+json, application/vnd.github.mercy-preview+json, application/vnd.github.baptiste-preview+json, application/vnd.github.nebula-preview+json\r\nX-Github-Api-Version: 2022-11-28\r\nAccept-Encoding: gzip\r\n\r\n" response="HTTP/1.1 410 Gone\r\nContent-Length: 62\r\nCache-Control: no-cache\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nDate: Wed, 29 May 2024 17:21:23 GMT\r\nServer: nginx\r\nVary: Origin\r\nX-Content-Type-Options: nosniff\r\nX-Frame-Options: SAMEORIGIN\r\nX-Gitlab-Meta: {"correlation_id":"01HZ2NXVDTMYB0GT8WK56K95N6","version":"1"}\r\nX-Request-Id: 01HZ2NXVDTMYB0GT8WK56K95N6\r\nX-Runtime: 0.011207\r\n\r\n{"error":"API V3 is no longer supported. Use API V4 instead."}" took=483.695274ms
could not fetch repositories: could not get information about e4/angular: GET https://gitlab.test.com/api/v3/repos/e4/angular: 410 []

And what is in your config file.

It's strange that it uses a V3 url, since that was discontinued in the lib used years ago.

Might you not set the platform properly, and it is trying to use the GitHub API urls instead?

base-url: https://gitlab.test.com/

branch: test-tag

repo:

  • e4/angular

token: **********

It is using the endpoints from the GitHub API. Since GitHub is the default platform if none are set.
Add:

platform: gitlab

And it should work

That worked thank you