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

Allow import Gitlab repo manually and set a webhook automatically #3934

Merged
merged 3 commits into from May 3, 2018

Conversation

@humitos
Copy link
Member

@humitos humitos commented Apr 10, 2018

When we import a Project manually we don't have a RemoteRepository associated with that Project, so we use the old technique of getting the username and repo names from the URL using get_gitlab_username_repo function.

This case (Manual Import) won't support custom Gitlab installations in the future with this code.

Closes readthedocs/readthedocs-corporate#265

@humitos humitos requested a review from Apr 10, 2018
@humitos humitos force-pushed the humitos/webhook/manual-import-gitlab branch from 93c0aae to 573120e Apr 10, 2018
@agjohnson agjohnson added this to the 2.4 milestone Apr 11, 2018
Copy link
Member

@ericholscher ericholscher left a comment

Looks good. I assume GH/BB do similar already?

Loading

@humitos
Copy link
Member Author

@humitos humitos commented Apr 18, 2018

Looks good. I assume GH/BB do similar already?

Yes. They are working because they always used the get_username_repo function. In gitlab, I didn't write it directly like that since it could be a custom installation of gitlab so having gitlab.com in the regex wasn't good.

Then, because of that decision we found this issue.

Loading

Copy link
Contributor

@agjohnson agjohnson left a comment

Noted a spot for some more defensive code.

Loading

repo_id = '{username}%2F{repo}'.format(
username=username,
repo=repo,
)
Copy link
Contributor

@agjohnson agjohnson Apr 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs error handling and probably some tests. In a case where get_gitlab_username_repo doesn't match, it returns (None, None) and we'll search for repo 'None/None'.

Loading

humitos added 3 commits Apr 24, 2018
When we import a Project manually we don't have a RemoteRepository
associated with that Project, so we use the old technique of getting
the username and repo names from the URL using
`get_gitlab_username_repo` function.

This case (Manual Import) won't support custom Gitlab installations in
the future with this code.
@humitos humitos force-pushed the humitos/webhook/manual-import-gitlab branch from 573120e to 844b6a9 Apr 24, 2018
@humitos
Copy link
Member Author

@humitos humitos commented Apr 24, 2018

I just added a test case for this and rebased the branch.

Loading

@agjohnson
Copy link
Contributor

@agjohnson agjohnson commented May 3, 2018

Changes and test look good!

Loading

@agjohnson agjohnson merged commit 5300c90 into master May 3, 2018
1 check passed
Loading
@agjohnson agjohnson deleted the humitos/webhook/manual-import-gitlab branch May 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants