-
Notifications
You must be signed in to change notification settings - Fork 7.1k
fix: can't add gitlab personal access token and add more debug log in validate_provider_token #8782
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
Conversation
… validate_provider_token
… validate_provider_token
👍 |
Thanks you for this! I've added one comment but besides that this LGTM |
I've updated and resubmitted the changes to /runtime/base.py based on your feedback. |
Fix: Robust Handling of
|
fix lint error trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
debug statements (python)................................................Passed
pyproject-fmt........................................(no files to check)Skipped
Validate pyproject.toml..............................(no files to check)Skipped
ruff.....................................................................Passed
ruff-format..............................................................Passed
mypy.....................................................................Passed
[main 65a5f5eb] style: apply ruff formatting to utils.py |
End-user friendly description of the problem this fixes or functionality this introduces.
When the GitLab server’s /v4/user endpoint returns an empty avatar_url, token validation fails.
Summarize what the PR does, explaining any non-trivial design decisions.
In some self-hosted GitLab instances, the avatar_url field can be returned as None.
When this happens, GitLabService.get_user fails while building a User object, because the User model expects avatar_url to be a string, triggering a pydantic_core._pydantic_core.ValidationError (see stack trace below).
I fixed the issue by adding a check for avatar_url in the method and supplying a default value of empty string
This minimal change resolves the problem in my tests.
I also added two debug log lines to validate_provider_token to make troubleshooting easier.
During the debugging process, I also noticed that the /user/info endpoint and the runtime image build were pulling the user repository using the default gitlab.com instead of the specified GitLab domain. I have fixed both issues.
Please carefully review whether the ProviderToken.host property has a default value when the user does not provide a domain. I'm not very familiar with this repository's code。
Link of any specific issues this addresses:
#8781
#8534