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

Projects
None yet
3 participants
@humitos
Member

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 rtfd/readthedocs-corporate#265

@humitos humitos requested a review from rtfd/core Apr 10, 2018

@agjohnson agjohnson added this to the 2.4 milestone Apr 11, 2018

@ericholscher

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

@humitos

This comment has been minimized.

Member

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.

@agjohnson

Noted a spot for some more defensive code.

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

This comment has been minimized.

@agjohnson

agjohnson Apr 19, 2018

Contributor

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'.

humitos added some commits Apr 10, 2018

Allow import Gitlab repo manually and set a webhook automatically
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

This comment has been minimized.

Member

humitos commented Apr 24, 2018

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

@agjohnson

This comment has been minimized.

Contributor

agjohnson commented May 3, 2018

Changes and test look good!

@agjohnson agjohnson merged commit 5300c90 into master May 3, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@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