Skip to content

Commit 3ea98cb

Browse files
committed
Return ssh-agent.
1 parent 3f7c80e commit 3ea98cb

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

entrypoint.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ log() {
88
log "Packing workspace into archive to transfer onto remote machine."
99
tar cjvf /tmp/workspace.tar.bz2 --exclude .git .
1010

11+
log "Launching ssh agent."
12+
eval `ssh-agent -s`
13+
cleanup() {
14+
log "Killing ssh agent."
15+
ssh-agent -k
16+
}
17+
trap cleanup EXIT
18+
19+
ssh-add <(echo "$SSH_PRIVATE_KEY")
20+
1121
remote_command=<< EOF
1222
set -e
1323
@@ -35,7 +45,6 @@ docker-compose up -d
3545
EOF
3646

3747
echo ">> [local] Connecting to remote host."
38-
ssh -i <(echo "$SSH_PRIVATE_KEY") \
39-
-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
48+
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
4049
"$SSH_USER@$SSH_HOST" -p "$SSH_PORT" \
4150
"$remote_command"

0 commit comments

Comments
 (0)