Copybara fails to make GerritApi call with SSO enabled on Gerrit server
- Dominant language
- Java
- Stars
- 3.8k
- Forks
- 345
- PR merge metrics
- No merged PRs in 30d
Description
On Gerrit side we are moving from Cookie to SSO based authorization. As part of this, all the Gerrit URL's are changing from [https:///r](https:///r) to [https:///r/a](https:///r/a)
After some testing and debugging it was understood that this is not supported as it was giving an error while querying Gerrit using the GerritApi `gerrit_get_changes`
**Copybara logs**
```
INFO: Setting up LogManager
opybara source mover (Version: Unknown version)
Task: Loading config copy.bara.sky
Task: Git Origin: Initializing local repo
WARN: Assuming repository 'https:///r/a/.git' for looking for review 'https:///r/'
Task: Querying Gerrit ('https:///r/a/.git') for active changes with hashtag 'copybara_id_DE0748C6172C03CDF7FDCA09E00A9F7D_'
--------------------------gerrit_get_changes----------------------------r/changes/?q=hashtag%3A%22copybara_id_DE0748C6172C03CDF7FDCA09E00A9F7D_%22+AND+project%3Aa%2F.git+AND+status%3ANEW
WARN: Failed querying the hash tag from gerrit changes. Reason: Error running Gerrit API operation https:///r/changes/?q=hashtag:%22copybara_id_DE0748C6172C03CDF7FDCA09E00A9F7D_%22%20AND%20project:a/.git%20AND%20status:NEW
INFO: Git Destination: skipped push to remote.
```
As a fix, the solution was to make changes to the GerritApi call itself to append the extra /a to the URL but now we have an issue that it fails to authorize
**Error**
```
Task: Querying Gerrit ('https://destination_gerrit_server/r/a/.git') for active changes with hashtag 'copybara_id_DE0748C6172C03CDF7FDCA09E00A9F7D_'
--------------------------gerrit_get_changes----------------------------r/a/changes/?q=hashtag%3A%22copybara_id_DE0748C6172C03CDF7FDCA09E00A9F7D_%22+AND+project%3A.git+AND+status%3ANEW
WARN: Failed querying the hash tag from gerrit changes. Reason: Unauthorized
```
**Code changes**

Contributor guide
Assessment
This issue has not been assessed yet.