Introduce new docker strategy for build container
The docker executor interactive web terminal #3467 (closed) has some limitation due to the nature of the docker. Right now we are running the build script in the container as
ps 1 which means as soon as the script exits the container is stoped as well (behavior of docker). This makes having the terminal connection open after the script has finished quite impossible.
Introduce a new life cycle for the docker container that runs that build script to be the same as the kubernetes executor as described below.
graph TD id1(Create container with deattached tty with shell scriped invoked)-->|Container waiting for commands|id2(Execute the build script) id2-->id3(Wait for temrinal if any) id3-->id4(Clean up container)
This allows us to wait for the terminal to disconnect/timeout even after the build script has finished.
Since this is quite a big change to the docker behavior and might break some flow for certain users, a new feature flag in a form of a variable will be introduced
DOCKER_STRATEGY (similar to git strategy) wich can take two values either:
attach: The current behavior the docker executor has, this will be the default behavior
exec: Will run the container with a detacched tty instead and the commands are run via
Links to related issues and merge requests / references
Main issue that add interactive web terminal for docker executor #3467 (closed)
This documentation MR should be clarified once this issue is fixed: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21880