-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
OAuth: connect Project
to RemoteRepository
#9381
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
There are multiple reasons why a `Project` could be disconnected from a `RemoteRepository`: 1. it was imported manually 2. the user deleted their account, which also deleted the `RemoteRepository` (old behaviour) 3. got disconnected when doing the data migration 4. others? If any of the previous scenarios happened, the user was not able to (re)connect their project anymore. The only way was to delete the project and re-import it using the wizard with a VCS account connected. This commit adds a button under "Admin" -> "Integrations" page to "Connect VCS repository" allowing users to perform this action by themselves. When a `Project` is connected to a `RemoteRepository` permissions can be managed at VCS level, allowing the organization to be able to use VCS SSO. Besides, this connection will be used when sending status notifications to the VCS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have tests for this new feature
messages.add_message( | ||
request, | ||
messages.ERROR, | ||
_(f"There was a problem connect your project."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_(f"There was a problem connect your project."), | |
_(f"There was a problem connecting your project."), |
Maybe we could add more information about the reason? Looks like if there isn't a remote_repository, it means the user isn't an admin or the project hasn't been synced yet.
@@ -14,6 +14,14 @@ | |||
{% block project_edit_content %} | |||
<div class="button-bar"> | |||
<ul> | |||
{% if connect_vcs_repository %} | |||
<li> | |||
<form style="float: left" method="post" action="{% url 'projects_integrations_connect_project' project_slug=project.slug %}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we didn't wan to add inline styles on new code, @agjohnson may have more info about this.
""" | ||
|
||
@staticmethod | ||
def get_final_url(project): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should put a docstring about this. The head request looks like it's to get normalize http
and .git
urls?
context["connect_vcs_repository"] = all( | ||
[ | ||
url, | ||
remote_repository, | ||
] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
context["connect_vcs_repository"] = all( | |
[ | |
url, | |
remote_repository, | |
] | |
) | |
context["connect_vcs_repository"] = url and remote_repository |
Thanks @stsewd for the review here. However, it seems that we won't expose this to users. We will try to do this automatically first without user intervention. We can come back to this PR if we consider it needed, tho. |
There are multiple reasons why a
Project
could be disconnected from aRemoteRepository
:RemoteRepository
(old behaviour)If any of the previous scenarios happened, the user was not able to (re)connect
their project anymore. The only way was to delete the project and re-import it
using the wizard with a VCS account connected.
This commit adds a button under "Admin" -> "Integrations" page to "Connect VCS
repository" allowing users to perform this action by themselves.
When a
Project
is connected to aRemoteRepository
permissions can be managedat VCS level, allowing the organization to be able to use VCS SSO. Besides, this
connection will be used when sending status notifications to the VCS.
Closes #8229