summaryrefslogtreecommitdiff
path: root/start-container-docker.sh
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2017-04-20 09:27:20 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2017-04-20 12:57:20 +0000
commit61e547acdbba4eab0b95fa023bf18f50f29753fe (patch)
tree54d7d90d9ae8dbfe58738723398f5b8cb9f0522c /start-container-docker.sh
parent806d97531d2d1a4cf2a5da232d358976dfc6a172 (diff)
start-container-docker.sh: Remove ssh-agent workaround.
Change-Id: Ia09d11756fdef4aaf1182784215f5dcba53999c7
Diffstat (limited to 'start-container-docker.sh')
-rwxr-xr-xstart-container-docker.sh48
1 files changed, 1 insertions, 47 deletions
diff --git a/start-container-docker.sh b/start-container-docker.sh
index f16969d2..fa56a001 100755
--- a/start-container-docker.sh
+++ b/start-container-docker.sh
@@ -12,11 +12,8 @@ set -e
# container on exit for instance
# - definition of ${session_host} and ${session_port}, can be used for
# a remote connexion to the container
-# - if needed, the script starts ssh-agent and adds the required key,
-# and returns shell statements to export the related variables. In
-# this case, it also defines ${SSH_AGENT_CLEANUP}.
usage() {
- echo "Usage: $0 --arch container-arch --distro flavour [--session-host host] [--session-name name] [--task {build|test}] [--weight weight] [--no-ssh-agent]"
+ echo "Usage: $0 --arch container-arch --distro flavour [--session-host host] [--session-name name] [--task {build|test}] [--weight weight]"
echo
echo " container-arch: architecture (eg: amd64, i386, arm64, armhf)"
echo " distro: distribution (eg: trusty)"
@@ -25,7 +22,6 @@ usage() {
echo " session-name: session, in case the default '$BUILD_NUMBER-$JOB_NAME' is not suitable"
echo " task: type of container (build or test, default=build)"
echo " weight: container weight, reserves resources. Default=1"
- echo " no-ssh-agent: do not start ssh-agent"
exit 1
}
@@ -41,7 +37,6 @@ session_host=
session_name=
task="build"
weight=1
-ssh_agent=true
while [ $# -ge 1 ]
do
@@ -56,10 +51,6 @@ do
[ x${distro} = x ] && usage
shift 2
;;
- --no-ssh-agent)
- ssh_agent=false
- shift 1
- ;;
--session-host)
session_host=$2
[ x${session_host} = x ] && usage
@@ -163,32 +154,6 @@ trap "exec 1>&3 2>&4 ; ${CONTAINER_CLEANUP}" EXIT
session_port=$($DOCKER port $session_id 22 | cut -d: -f 2)
-# Special case for tcwg-buildslave: we use a dedicated ssh key for
-# builds in TCWG lab. Update the docker container authorized_keys with
-# a copy from the main host.
-SSH_AGENT_CLEANUP=
-if [ "x`whoami`" = "xtcwg-buildslave" ]; then
- $DOCKER cp $HOME/.ssh/authorized_keys ${session_id}:/home/tcwg-buildslave/.ssh/authorized_keys
-
- # For 'test' containers, we also need to add the same keys to 'root'
- if [ "${task}" = "test" ]; then
- $DOCKER cp $HOME/.ssh/authorized_keys ${session_id}:/root/.ssh/authorized_keys
- fi
-
- # Start ssh-agent locally and add the right private key to it, but
- # only if it is not already running. Indeed, even if we want to
- # start several containers, we need only one ssh-agent.
- if ${ssh_agent} && [ -f $HOME/.ssh/id_rsa -a "x${SSH_AGENT_PID}" = "x" ]; then
- # Close fds 3 and 4 in ssh-agent's subshell, otherwise they
- # leak into the background daemon, and prevent this script
- # from working in a pipeline
- eval `ssh-agent -s 3>&- 4>&-`
- ssh-add $HOME/.ssh/id_rsa
- SSH_AGENT_CLEANUP="ssh-agent -k"
- trap "exec 1>&3 2>&4 ; ${CONTAINER_CLEANUP} ; eval \`$SSH_AGENT_CLEANUP\`" EXIT
- fi
-fi
-
# Wait until the ssh server is ready to serve connexions
# Make sure connexion messages go to stderr, so that in case of
@@ -214,17 +179,6 @@ trap EXIT
# Restore stdout/stderr
exec 1>&3 2>&4
-# Non-empty SSH_AGENT_CLEANUP means we have started ssh-agent in this
-# invocation, so make sure to share the relevant information with the
-# parent shell
-if [ "x${SSH_AGENT_CLEANUP}" != "x" ]; then
- cat <<EOF
-export SSH_AGENT_PID=${SSH_AGENT_PID}
-export SSH_AUTH_SOCK=${SSH_AUTH_SOCK}
-SSH_AGENT_CLEANUP="${SSH_AGENT_CLEANUP}"
-EOF
-fi
-
cat <<EOF
CONTAINER="ssh -p ${session_port} -A ${session_host}"
CONTAINER_CLEANUP="${CONTAINER_CLEANUP}"