Interactive web terminals for CI/CD shell, k8s, and docker jobs
Problem to solve
CI/CD jobs are executed by runners based on the configuration provided by users in their pipeline definition. But this execution is not interactive and, in case of failure, users cannot dig into details to spot the possible source of the problem.
When a test fails, users may want to inspect files and to run commands. This is a huge improvement to the current status, where output is the only feedback they get.
If we make the session where the job has been executed live, users can access it and get what they need. This could be something similar to what we already have to inspect deployments (https://docs.gitlab.com/ee/administration/integration/terminal.html)
For the MVC of the interactive web terminals, we'll implement a few basic features that will allow the ability to connect to a running job session from the GitLab UI. Once opened, the terminal will allow users to interact with the session. If a terminal is opened while the job is running, the session will stay open after the end of the execution for a specific amount of time (configurable, up to 2hrs - default is 30m. On GitLab.com it will be 10m.), to allow users to do further investigations but that sessions will be immediately closed if the user disconnects.
- !21094 (merged) - From the job output page, a new button to open a web terminal will be made available. Upon clicking, the terminal window will open in new tab where the user is able to interact with a standard, already logged-in terminal session.
If the terminal session times out, or is otherwise disconnected, this will be displayed to the user clearly on the page.
If another user connects to the terminal session, an additional (new tty) session is created for the second user. The overall "stay open" time for the session is not reset by new users connecting. The overall session will close before the timeout, immediately, once all users disconnect. Maximum connections is set in the runner configuration, and will be set to 2 or 3 on gitlab.com.
If a user connects to a job while it's still running, and a user is connected to the terminal, the job will show as still running until the last user disconnects even if the automated tasks complete.
If the window is closed while the terminal session is active, a warning will be displayed indicating the session will be lost.
Only users with appropriate permissions should be able to get to a shell, since you can run arbitrary commands at that point. The appropriate user is any who create/retry/cancel the job.
It should be possible to disable the web terminals feature via the runner.
Prior to turning off due to timeout (5min before), a sysmsg is sent indicating the session provider will be stopped.
It should be possible for the backend to send messages/events to be displayed by the frontend through the websocket connection. This will be used to indicate on the web terminal page when the automated tasks in the job are complete.
Terminal window countdown progress is shown at top of page:
The following executors will be available in the initial MVC version: shell, k8s, docker
Small visual improvements to terminal in new tab
- included in above mockups and consists of:
- added padding to the terminal
- rounded corners (4px)
Links / references
Similar to http://circleci.com/docs/1.0/ssh-build/