ContainerSSH / ContainerSSH

ContainerSSH: Launch containers on demand
https://containerssh.io/
Apache License 2.0
2.62k stars 73 forks source link

Support Gitlab CI runners #61

Open ghost opened 3 years ago

ghost commented 3 years ago

Currently, ContainerSSH launches a new container for every connection. It was requested that we support Gitlab CI which opens a new connection for every command. It is possible to identify the connections via the environment variables CI_JOB_ID, CI_JOB_TOKEN, CI_PIPELINE_ID, or CI_JOB_IMAGE. The container should be cleaned up after it hasn't been used for a while.

kfox1111 commented 3 years ago

+1. Some users like myself use screen. Some support for reconnecting would be useful. Would need to be configurable with a timeout since some sites wouldn't like containers to out last their ssh connections.

ghost commented 3 years ago

@kfox1111 thank you for your input. This idea originally comes from @ecrazor1911 and the last point where we left off was the fact that Gitlab opens several connections instead of opening one and then using multiple channels inside that connection. This means that we can't properly dispose of containers once the job is finished.

Our plan is to release support for semi-persistent containers, which would mean that several connections within a time limit land in the same container. However, to do that and support HA we need a synchronization mechanism across the network to make sure we are not deleting containers that are being used by other ContainerSSH instances. This is still up for discussion.

Please watch this issue, we'll update you here when we reach a conclusion on how to make that happen.