Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package lookup fails with Golang submodules In Gitlab.com #28540

Open
rarkins opened this issue Apr 20, 2024 Discussed in #28530 · 1 comment
Open

Package lookup fails with Golang submodules In Gitlab.com #28540

rarkins opened this issue Apr 20, 2024 Discussed in #28530 · 1 comment
Labels
datasource:go platform:gitlab GitLab Platform priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality

Comments

@rarkins
Copy link
Collaborator

rarkins commented Apr 20, 2024

Discussed in #28530

Originally posted by rrey April 19, 2024

What would you like help with?

I think I found a bug

How are you running Renovate?

Self-hosted

If you're self-hosting Renovate, tell us which platform (GitHub, GitLab, etc) and which version of Renovate.

GitLab and renovate 37.308.0

Please tell us more about your question or problem

I have private repositories on gitlab.com where I reproduce the error, let me know who I shall add to the repository to allow you to reproduce.

I have a project with the following go.mod:

module [gitlab.com/rrey2/some-project](https://gitlab.com/rrey2/some-project/)

go 1.18

require (
	[gitlab.com/rrey2/some-deps](https://gitlab.com/rrey2/some-deps/) v1.0.0
	[gitlab.com/rrey2/some-deps/submodule](https://gitlab.com/rrey2/some-deps/submodule/) v1.0.0
)

The first module gitlab.com/rrey2/some-deps is not an issue and renovate can process it.
The second one is a submodule located in the same repository as the first one in a subdirectory.

For the submodule the lookup fails. See attached logs.

Logs (if relevant)

Logs

DEBUG: Fetching gitlab.com/rrey2/some-deps via GONOPROXY match (repository=rrey2/some-project)
DEBUG: Fetching gitlab.com/rrey2/some-deps/submodule via GONOPROXY match (repository=rrey2/some-project)
DEBUG: Go lookup source url https://gitlab.com/rrey2/some-deps for module gitlab.com/rrey2/some-deps (repository=rrey2/some-project)
DEBUG: Extracted information: gitlabUrl: https://gitlab.com, gitlabUrlName: rrey2/some-deps, gitlabModuleName: rrey2/some-deps (repository=rrey2/some-project)
DEBUG: Go lookup source url https://gitlab.com/rrey2/some-deps for module gitlab.com/rrey2/some-deps/submodule (repository=rrey2/some-project)
DEBUG: Extracted information: gitlabUrl: https://gitlab.com, gitlabUrlName: rrey2/some-deps, gitlabModuleName: rrey2/some-deps/submodule (repository=rrey2/some-project)
DEBUG: GET https://gitlab.com/api/v4/projects/rrey2%2Fsome-deps%2Fsubmodule/repository/tags?per_page=100 = (code=ERR_NON_2XX_3XX_RESPONSE, statusCode=404 retryCount=0, duration=164) (repository=rrey2/some-project)
DEBUG: GitLab API 404 (repository=rrey2/some-project)
       "url": "https://gitlab.com/api/v4/projects/rrey2%2Fsome-deps%2Fsubmodule/repository/tags?per_page=100"
DEBUG: Datasource 404 (repository=rrey2/some-project)
       "datasource": "go",
       "packageName": "gitlab.com/rrey2/some-deps/submodule",
       "url": "https://gitlab.com/api/v4/projects/rrey2%2Fsome-deps%2Fsubmodule/repository/tags?per_page=100"
DEBUG: Failed to look up go package gitlab.com/rrey2/some-deps/submodule (repository=rrey2/some-project, packageFile=go.mod, dependency=gitlab.com/rrey2/some-deps/submodule)

The problem seems to be that the URL used to fetch the submodule is not the repository url, while the response from gitlab to the go-get=1 properly points to the repository:

$ curl 'https://gitlab.com/rrey2/some-deps/submodule?go-get=1'
<html>
    <head>
        <meta name="go-import" content="gitlab.com/rrey2/some-deps git https://gitlab.com/rrey2/some-deps.git">
        <meta name="go-source" content="gitlab.com/rrey2/some-deps https://gitlab.com/rrey2/some-deps https://gitlab.com/rrey2/some-deps/-/tree/master{/dir} https://gitlab.com/rrey2/some-deps/-/blob/master{/dir}/{file}#L{line}">
    </head>
    <body>go get https://gitlab.com/rrey2/some-deps</body>
</html>

I tried to debug by pulling the repo and testing on main by adding debug logs.
I added a log in lib/modules/datasource/go/base.ts to show what is the parsed content of the meta blocks. These logs are visible in my extract as the lines starting with Extracted information.

We can see that the gitlabUrlName variable properly points to the repository, but the GET is not performed on this path.

@rarkins rarkins added type:bug Bug fix of existing functionality priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others platform:gitlab GitLab Platform datasource:go labels Apr 20, 2024
@rarkins
Copy link
Collaborator Author

rarkins commented Apr 20, 2024

Unit test: #28533

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datasource:go platform:gitlab GitLab Platform priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality
Projects
None yet
Development

No branches or pull requests

1 participant