Mirror changes from Web IDE to CI runner
Frontend issue: https://gitlab.com/gitlab-org/gitlab-ee/issues/9066 (Consolidated here)
- BE weight: 3
- FE weight: 4
Problem to solve
CI runners checkout code from Git, but when being used with the Web IDE local changes should be mirrored to the runner so that builds and tests run against the state in the Web IDE. It is confusing to have a terminal next to an editor interacting with different versions of the code.
Target audience
As a software engineer, when I am viewing or editing a repository in the Web IDE I want to be able to make changes and test them using the Web Terminal before committing them, so that I know that I am committing code that works.
Further details
This also significantly improves the ability of people to contribute to projects they don't contribute to regularly, by allowing them to view, edit, and test without install local dependencies.
Proposal
Implement a method for mirroring changes from the Web IDE to the runner. The editor will establish a websocket connection to the mirroring service running in the CI build, using an event-based messaging protocol. In this communication, the editor will send diffs from the current changes to the service.
Editor contents will be saved to the development environment when the editor loses focus or is closed. The Save keyboard shortcut (CTRL+s
, Command+s
) can be used to save your changes immediately.
What does success look like, and how can we measure that?
This feature improves the utility of the Web Terminal in the Web IDE, and should increase the use of the Web IDE for Ultimate users. This can be monitored through the existing Web IDE usage ping.
Links / references
- https://gitlab.com/gitlab-org/gitlab-ee/issues/5274
- https://gitlab.com/gitlab-org/gitlab-ce/issues/25990
Development Workflow
In order to implement these services and the other ones related to services in CI build we need to implement some foundations which we'll reuse in each of them. This way we won't need to reinvent the wheel every time and manage them in a homogenized way.
There are three places where we have to make modifications:
- Rails: we need to update the Web IDE config yaml to accept a new
ports section
. We also need add a new endpoint and a way to handle the communication from/to Workhorse - Workhorse: we need to add a new endpoint and be able to proxy HTTP and Websockets requests.
- Runner: we also need a new endpoint in the session and also update the executors to handle this kind of requests.
Besides, we need to decide/implement several things:
- Decide how to deliver/ship these CI services
- Apply/retrieve diff patches, and also check if we should send incremental diffs instead of the whole diff
- Implement a way to deal with diffs in FE
- We need a way to communicate to the FE which services are available
Followups
- webide-file-sync#2 (closed)
-
webide-file-sync#1 (closed) Binary files changes don't generate diffs. Therefore, we have to upload the whole file and this is inefficient. We should explore again other options like using the
rsync
protocol.
Required for https://gitlab.com/gitlab-org/gitlab-ee/issues/4013:
- gitlab-workhorse#216 (closed). We need to implement an endpoint to proxy HTTP requests
- https://gitlab.com/gitlab-org/gitlab-ee/issues/11078. Rails part of the endpoint to proxy HTTP requests