Once a user finishes installing the SonarCloud Github App on an organisation, her browser will be redirected to the configured "Setup URL" of the application (if any).
Github adds a installation_id to this URL.
This URL should ensure the specified installation id is known to SonarCloud and then redirect to the "create project" page.
In case of error, a query parameter "error" should be added with the text to display to the user.
Currently, SonarCloud registers an installation when it receives the WebHook from github informing that an installation occurred.
However, it may happen that the user is redirected to SonarCloud before we receive the webhook and/or that we don't receive the webhook at all.
In such case, this URL should ensure the installation is registered by making a few appropriate calls to GitHub.
An error message should be displayed to the user when (by adding a error query parameter to the redirect):
- If the installation can not be registered (for any reason) => "Github Application installation could not be registered on our side, please uninstall and reinstall the application"
The "Setup URL" is configured for the application and will be called for any installation, even one which we didn't trigger from SonarCloud "Create projects" page.
This implies that the URL may be called:
- for an installation on any organization, therefor not the personal organization of a user
- and/or as user is not authenticated on SonarCloud
In both case, simply redirecting to the "Create Projects" page without an error message works:
- if installation occurred for another organization, the "Create Project" page will display projects for the personal org or request to do so. It's a bit confusing at the moment as we don't support other organization, but this behavior is the target behavior
- if user is not authenticated, Web application will request authentication and redirect her to "Create Project" page
The value of the Setup URL in the GitHub App shall be SONARCLOUD_URL + "/integration/github/post_installation"