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

Private gitlab maven repository doesn't work with sbt-package datasource #16761

Closed
sschoebinger opened this issue Jul 25, 2022 · 10 comments · Fixed by #16817
Closed

Private gitlab maven repository doesn't work with sbt-package datasource #16761

sschoebinger opened this issue Jul 25, 2022 · 10 comments · Fixed by #16817
Labels
datasource:sbt-package Related to the sbt-package datasource priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality

Comments

@sschoebinger
Copy link

How are you running Renovate?

Self-hosted

If you're self-hosting Renovate, tell us what version of Renovate you run.

32.99.9

Please select which platform you are using if self-hosting.

GitLab self-hosted

If you're self-hosting Renovate, tell us what version of the platform you run.

14.10.5-ee

Was this something which used to work for you, and then stopped?

I never saw this working

Describe the bug

I have a scala library in a private gitlab maven repository. If I use this library in a way that renovate detects it as a maven datasource it will find the right versions und propose a proper update. But if I use this library as a sbt dependency renovate is not able to find any version.

A local setup of renovate and deeper analysis showed that sbt-package datasource parses the html response of the repository in order to find the proper versions whereas maven datasource uses the metadata.xml files.

Unfortunately gitlab maven repository doesn't support directory listings and I'm also not able to classify a dependency found in build.sbt as maven datasource instead of sbt-package.

So I see currently no chance to solve this issue with configuration only.

If I change lib/modules/datasource like below it works perfectly fine:
Screenshot 2022-07-25 at 14 04 33

So I think all code is already there but no option to choose the maven datasource in case the dependency was found in build.sbt

A very quick fix can be to just retry with datasource maven in case we found no dependencies with sbt-package:
Screenshot 2022-07-25 at 15 09 46

I hope someone can help me to get my setup work (scala/sbt with private gitlab maven repository).

Relevant debug logs

No response

Have you created a minimal reproduction repository?

No reproduction repository

@sschoebinger sschoebinger added priority-5-triage status:requirements Full requirements are not yet known, so implementation should not be started type:bug Bug fix of existing functionality labels Jul 25, 2022
@rarkins
Copy link
Collaborator

rarkins commented Jul 26, 2022

Can this problem be reproduced using gitlab.com? It would otherwise be hard for anyone else to fix it if it can only be reproduced privately

@sschoebinger
Copy link
Author

Yes, we can reproduce it with gitlab.com

This is the test project https://gitlab.com/sschoebi/renovate-test/ I added you as a maintainer.

I use this config:

module.exports = {
    endpoint: "https://gitlab.com/api/v4/",
    platform: "gitlab",
    repositories: ["sschoebi/renovate-test"],
    "hostRules": [
      {
        "hostType": "maven",
        "matchHost": "gitlab.com",
        "token": "...",
        "authType": "Bearer"
      }
    ]
  };

I start renovate locally and it says:

{
                 "registryUrls": [
                   "https://repo.maven.apache.org/maven2",
                   "https://gitlab.com/api/v4/projects/38102196/packages/maven/"
                 ],
                 "depName": "com.example:scala-base-lib",
                 "packageName": "com.example:scala-base-lib_2.13",
                 "currentValue": "0.0.3",
                 "datasource": "sbt-package",
                 "depIndex": 1,
                 "updates": [],
                 "warnings": [
                   {
                     "topic": "com.example:scala-base-lib",
                     "message": "Failed to look up dependency com.example:scala-base-lib"
                   }
                 ],
                 "versioning": "ivy"
               }

if I change the renovate code to retry with datasource maven it creates the MR like expected.

Screenshot 2022-07-26 at 10 06 59

@rarkins rarkins added datasource:sbt-package Related to the sbt-package datasource priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others reproduction:provided and removed priority-5-triage status:requirements Full requirements are not yet known, so implementation should not be started labels Jul 26, 2022
@rarkins
Copy link
Collaborator

rarkins commented Jul 26, 2022

If you think you can fix it yourself then you're welcome to submit a PR. I'm not sure the code you provide is the best way though, ideally we either:

  • fix the sbt datasource to work first time, or
  • work out how to know to use maven from the start

@viceice
Copy link
Member

viceice commented Jul 26, 2022

@sschoebinger Don't use "authType": "Bearer" Bearer is the default value.

@sschoebinger
Copy link
Author

@rarkins is there someone available who is familiar with both the datasources (maven and sbt-package)? For me it would take some time to make a proposal which is not a hack.

@zharinov
Copy link
Collaborator

zharinov commented Jul 27, 2022

Please, provide reproduction so that we'll know if any proposed fix would work or not

Sorry for that, didn't see your later messages

@zharinov
Copy link
Collaborator

@sschoebinger Are you able to test my branch against your repo? (see above PR)

@sschoebinger
Copy link
Author

Yes I tested it. It worked fine for my gitlab.com example 👍 , but not for our self hosted gitlab, I think there is no chance to decide based on a URL if the registry is from "type" gitlab. Is there a reason why we can only fallback to the maven implementation in case of gitlab registries?

@zharinov
Copy link
Collaborator

The original reason why we parse index.html pages is because it's faster than trying to find dependency with/without suffixes like scala version, native, etc.

In the next iteration, I'll adjust it to support your private package repositories as well. Stay tuned 😉

@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 32.137.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
datasource:sbt-package Related to the sbt-package datasource 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
5 participants