From 7fc0018bc5cfc7cd7e2c015fb0e6c449f9ffc45c Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Sun, 30 Jun 2019 14:38:13 +0900 Subject: [PATCH] [Release] Avoid duplicated known host SSH error in dev/release/03-binary.sh --- dev/release/03-binary.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/dev/release/03-binary.sh b/dev/release/03-binary.sh index fa1119a3b99..74602cda749 100755 --- a/dev/release/03-binary.sh +++ b/dev/release/03-binary.sh @@ -88,13 +88,22 @@ docker_run() { docker_gpg_ssh() { local ssh_port=$1 shift - ssh \ - -o StrictHostKeyChecking=no \ - -i "${docker_ssh_key}" \ - -p ${ssh_port} \ - -R "/home/arrow/.gnupg/S.gpg-agent:${gpg_agent_extra_socket}" \ - arrow@127.0.0.1 \ - "$@" + local known_hosts_file=$(mktemp -t "arrow-binary-gpg-ssh-known-hosts.XXXXX") + local exit_code= + if ssh \ + -o StrictHostKeyChecking=no \ + -o UserKnownHostsFile=${known_hosts_file} \ + -i "${docker_ssh_key}" \ + -p ${ssh_port} \ + -R "/home/arrow/.gnupg/S.gpg-agent:${gpg_agent_extra_socket}" \ + arrow@127.0.0.1 \ + "$@"; then + exit_code=$?; + else + exit_code=$?; + fi + rm -f ${known_hosts_file} + return ${exit_code} } docker_run_gpg_ready() {