-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Differing behaviour retrieving gitlab-tags and releases between datasource and changelog #13497
Comments
I think this can be fixed first/independently:
For the second point, are you adding any |
I have added the following rules manually. module.exports = {
hostRules: [
{
"matchHost": "https://gitlab.com/api/v4/projects/renovate-reproduction-test%2Fprivate-template-repo-example",
"authType": "Bearer",
"token": process.env["READONLY_GITLAB_LOOKUP_TOKEN"]
}
]
}; During debugging locally by adding some additional log statement(No longer have the logs, but will see if can rerun later today for completeness) I noticed the following rules in the resulting hostRules that is being applied to the requests:
I also tried also adding the following rule besides the one above. module.exports = {
hostRules: [
{
"hostType: "gitlab",
"matchHost": "https://gitlab.com/api/v4/projects/renovate-reproduction-test%2Fprivate-template-repo-example",
"authType": "Bearer",
"token": process.env["READONLY_GITLAB_LOOKUP_TOKEN"]
}
]
}; But since the automatically generated one is always last in the list, it also always is applied as the last multi rule(both hostType and hostName match). Making the above rule ineffective. |
OK, so your best guess right now is that it's caused by the ordering of |
I think we need to use renovate/lib/platform/index.ts Lines 71 to 72 in ab01819
Not sure how to handle the second line. Maybe clear and readd all rules? |
Maybe time for a code inspection and refactor to determine why we don't have a single source of truth already and if it can be made better. |
I have looked at the code a bit more. While the ordering of the rules might be a bit confusing it indeed might be undesirable to override platform authentication (RENOVATE_TOKEN), which is probably why the rule is added at end. The main cause I think is actually that non platform calls like getting changelog for a release/dependency use the platform identifier as hostType, making it indistinguishable from platform calls(getting user, checking out repo, pushing MR). That way it can be overridden by a hostType specific host rule and the hostrules code already contains a fallback to gitlab hostype if there are no rules for the specific type. I just locally implemented and tested a solution where I added a 'gitlab-changelog' host type to the changelog calls instead of the default 'gitlab' and added it to the fallback types. I also noticed when looking through the code, that this same issue probably exists for gitlab-packages datasource, since it also doesn't set the hostType in calls as far as I can tell. Will create a PR for these fixes. |
🎉 This issue has been resolved in version 31.66.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
How are you running Renovate?
Self-hosted
If you're self-hosting Renovate, tell us what version of Renovate you run.
31.22.1
Please select which platform you are using if self-hosting.
gitlab.com
If you're self-hosting Renovate, tell us what version of the platform you run.
gitlab.com
Describe the bug
When configuring hostRules for gitlab-tags to make retrieval of tags of a private repository I ran into issues. The tags can be succesfully retrieved however soon after that when renovate tries to retrieve the changelogs by querying the same repository (tags, changelog md or releases) it fails since the same hostrules don't apply.
Created reproduction on gitlab(when doing so on github, the gitlab-tags datasource starts using github api, but that is different issue).
In the case where I ran into this, it is not possible to have the permission for the private repository added to the global RENOVATE_TOKEN used for the runner.
I did some debugging and I think the following are the causes preventing this from being possible:
I would be happy to create a PR for a fix, but what would be the best way to proceed?
What I can think of is the following, but I don't have the complete picture.:
Relevant debug logs
Logs
[Runner job logs](https://gitlab.com/renovate-reproduction-test/renovate-reproduction-runner/-/jobs/1964027168)Section which I think is relevant, added below
Have you created a minimal reproduction repository?
I have linked to a minimal reproduction repository in the bug description
The text was updated successfully, but these errors were encountered: