Prototype: Expand Atlassian Connect App to function as a proxy for self-managed GitLab
Problem to Solve
For users of self-managed GitLab instances, they are unable to use the GitLab.com for Jira Cloud application on the Atlassian Marketplace, at least directly "out of the box". That application is directly linked to GitLab.com, which means self-managed customers need to use other means to get this feature working. This issue's parent epic outlines the other options.
Proposal
@Andysoiron has proposed an alternative method where we could extend the Connect Application functionality on GitLab.com, which will allow it to act as a proxy for self-managed instances.
Most of what the app does is GitLab pushing data to Jira. This part will work fine on self-managed. Only the setup (installation and loading the iframe for namespace linking) is Jira connecting to GitLab. For this part, we can build a proxy application that handles installation hooks, and redirects users to self-managed instances for namespace linking.
This will provide the most intuitive solution, allowing all GitLab users to follow the same installation path, regardless of whether they're on SaaS or self-managed.
The only limitation in this approach is for customers who do not wish their data to be proxied, or have specific network/security limitations that prevent this from being possible. For these customers, they're able to take one of the other approaches that are being documented.
Solution Breakdown
I did an experimental MR as a proof of concept: !54378 (closed)
UX
There should be a way users can enter the URL to a self-managed instance that should be used for the app. Maybe this can be an extra step in the app setup?
Frontend
We can't redirect the iframe on Jira to the instance because changing the location is blocked, so we will have to render a nested iframe and figure out how to receive the token
from the parent iframe. @tomquirk already had an idea how this could work (!54378 (comment 512524846))
Backend
Add a new column to jira_connect_installations
In order to use gitlab.com as a proxy for self-managed instances, we need to know the instance URL. Therefor we need a new column instance_url
on jira_connect_installations.
Add a new controller to update JiraConnectInstallation
An installation is created when we receive an event webhook from atlassian. A new controller is needed to add an instance URL to an installation.
Forward events
Once an installation is updated with a instance_url
we will send a installed
event webhook to the instance to pretend that the app was installed on Jira. Whenever we receive events for installations that have a instance_url
we need to forward them to the instance.