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

Move registryUrls handling into datasource #6533

Closed
rarkins opened this issue Jun 17, 2020 · 10 comments · Fixed by #6549
Closed

Move registryUrls handling into datasource #6533

rarkins opened this issue Jun 17, 2020 · 10 comments · Fixed by #6549
Assignees
Labels
priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:refactor Refactoring or improving of existing code

Comments

@rarkins
Copy link
Collaborator

rarkins commented Jun 17, 2020

What would you like Renovate to be able to do?

Shift the complexity of trying multiple registries into the shared datasource logic instead of re-implemented into each datasource type.

Describe the solution you'd like

Default behavior for multiple datasources should be "hunt" - i.e. try the registryUrls in order and return as soon as there's one result. An alternative would be "merge" or "combine" - i.e. try them all and combine the results. If a datasource needs "combine" it would be an exported configuration option.

Describe alternatives you've considered

Today each datasource implements/re-implements hunt or merging logic on its own.

Additional context

If each datasource's getReleases() logic needs to take into consideration only one registryUrl then it will also improve our caching ability for times when there's a mix of public and private results.

@rarkins rarkins added needs-requirements priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:refactor Refactoring or improving of existing code labels Jun 17, 2020
@rarkins
Copy link
Collaborator Author

rarkins commented Jun 17, 2020

@JamieMagee does this conflict with any of the ideas you've had about Datasource classes?

@rarkins
Copy link
Collaborator Author

rarkins commented Jun 17, 2020

First step we need to do before moving this to ready is to survey which datasources support multiple registryUrls today, how they support them, and if there are any "spanners in the works" I haven't thought of that would make this too hard in their case.

@rarkins
Copy link
Collaborator Author

rarkins commented Jun 17, 2020

  • docker: uses the first one only
  • git-submodules: seems to abuse registryUrls into something it's not meant to be??
  • gitlab-tags: uses the first one only
  • gradle-version: merges multiple
  • helm: uses the first one only
  • maven: combines multiple
  • nuget: combines multiple
  • packagist: hunts multiple
  • pod: seems to take the last one today (intentional?)
  • pypi: also takes the last one?
  • rubygems: hunts
  • sbt-package: hunts
  • sbt-plugin: hunts
  • terraform-module: takes the first

@rarkins
Copy link
Collaborator Author

rarkins commented Jun 17, 2020

Datasources can optionally export a new field registryStrategy with values of:

  • none (no registryUrl needed)
  • first (only the first url is used)
  • hunt (try registry urls in sequence)
  • merge (try all registry urls and merge the results)

@rarkins
Copy link
Collaborator Author

rarkins commented Jun 17, 2020

This also gives us the possibility to record which registry/registries that results were found on, although I haven't thought of a use for that.

@JamieMagee
Copy link
Contributor

I don't think my work with datasources should be affected by this. Rather, I think it might actively help us to achieve this.

I have been sitting on the conversion of the cndjs for over a week now. I should tidy it up and send it out for (draft) PR and get some feedback on the approach.

@rarkins
Copy link
Collaborator Author

rarkins commented Jun 17, 2020

Haha, I was also starting with cdnjs

@rarkins
Copy link
Collaborator Author

rarkins commented Jun 17, 2020

It's actually not the perfect one for me to start with though because it's one of the datasources that is best doing its own caching instead of delegating it to the main datasource.

@rarkins
Copy link
Collaborator Author

rarkins commented Jun 18, 2020

Waiting on #6538

rarkins added a commit that referenced this issue Jun 19, 2020
datasource implementations can export a `registryStrategy` field that is used by the datasource index/controller to manage the approach:
- ‘first’: send only the first registryUrl
- ‘hunt’: return the first successful result
- ‘merge’: try all registries and combined/deduplicate the results

Closes #6533
@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 21.13.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:refactor Refactoring or improving of existing code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants