-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
fix(gitlab): Consistent urlencoding and call source specific hostType for gitlab (changelogs, packages, tags, releases) #13577
Conversation
…changelogs from platform calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any blocking reason why we couldn't use gitlab-tags as the datasource where applicable? I'm not too keen to add a new hostType of gitlab-packages |
@viceice @rarkins I only added it to the existing datasource type for gitlab-packages, it was already considered an existing hostType in the fallback types, the packages datasource just didn't add it to its calls like all other datasources add their id as hostype(except gitlab-packages and bitbucket-tags) For changelogs I did add a new hostType, since it would be the least invasive. For gitlab changelog calls could reuse the hostType of gitlab-tags and gitlab-releases, but it also does a call to tree node api, which currently has not hostType. |
Ok, let's do it in smaller separate PR's. |
@@ -19,4 +19,5 @@ export const GITLAB_API_USING_HOST_TYPES = [ | |||
'gitlab-releases', | |||
'gitlab-tags', | |||
'gitlab-packages', | |||
'gitlab-changelog', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@viceice are you sure you like this idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know a better solution yet. 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have looked for alternative solutions to solve the problem.
The problem is that it is currently impossible to apply hostRules to calls made by the changelog modules. This due to the fact that they use the platform identifier as hostType, which cannot have any rules applied to them since the automatically generated host rule for the platform is always applied last, overriding the authentication set by any previous rule.
Most datasources apply their datasource id to their Http client which adds it as hostType, making it possible to set hostRules for specific datasources. That is also what gitlab-tags and gitlab-releases datasources do. The hostRules also have a fallback mechanism for sources that use Gitlab or Github as source. This makes it possible for gitlab-tags and gitlab-releases to have specific rules configured for private repositories and otherwise fallback to the platform configuration. The changelog http clients,(which are called after datasource lookups) however always use the platform identifier as hostType, which as previously mentioned cannot be overridden.
I can think of only the 3 options to make hostRules configurable for changelogs so that they don't fail when datasources are configured with their own authentication which is not applied to subsequent changelog lookups.
-
Moving automatically generated platform rule to the beginning, making it possible to override automatically generated rule for call using the platform identifier. Making it possible to override the configured renovate platform token. However there is no ways to differentiate between preset, platform and changelog calls.
- Which might also break configurations where there are silently ignored hostRules for the platformId hostType.
-
In the case of the Gitlab changelog retrieval, it does 3 types of calls, tag lookup, checking for existence of changelog md(tree lookup) and looking up releases.
- tags lookup could use the same hostType that gitlab-tags datsource uses
- release lookup could use the same hostType that gitlab-releases datsource uses
- the tree api lookup call is done also done in the platform module with platform identifier as hostType, but that was the problem, so new identifier needs to be introduced, since both tags and releases types calls don't make sense.
-
Treat the changelog module just like a gitlab-releases or gitlab-tags datasource with its own identifier used as hostType, making it possible to differentiate from other platform calls and apply rules to them, and adding it to the fallback list. (The solution above, which I personally like best, but I am biased.)
|
Changes:
Context:
Making it possible to apply hostRules to changelogs and gitlab-packages calls.
Documentation (please check one with an [x])
How I've tested my work (please tick one)
I have verified these changes via: