diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-05-30 10:05:02 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-05-30 10:05:06 +0200 |
commit | c0a8181f5d0b4119a94df729cae4e935db547932 (patch) | |
tree | bbc45343d62ceada46523742621f6bee65a8ad38 /test | |
parent | requirements.txt: bump dependencies (diff) | |
download | cgitize-c0a8181f5d0b4119a94df729cae4e935db547932.tar.gz cgitize-c0a8181f5d0b4119a94df729cae4e935db547932.zip |
t/i/docker: always spawn ssh-agent
I had some weird errors on my machine where my primary ssh-agent would
get killed. No idea why I didn't just spawn a new ssh-agent from the
very beginning.
Diffstat (limited to 'test')
-rwxr-xr-x | test/integration/docker/test.sh | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/test/integration/docker/test.sh b/test/integration/docker/test.sh index 0cd523f..7cb02a0 100755 --- a/test/integration/docker/test.sh +++ b/test/integration/docker/test.sh @@ -99,24 +99,28 @@ remove_ssh_keys() { } kill_ssh_agent() { - [ -n "${SSH_AGENT_PID:+x}" ] || return 0 - dump "killing ssh-agent with PID $SSH_AGENT_PID" - kill "$SSH_AGENT_PID" + [ -n "${this_ssh_agent_pid:+x}" ] || return 0 + dump "killing ssh-agent with PID $this_ssh_agent_pid" + kill "$this_ssh_agent_pid" } spawn_ssh_agent() { - [ -n "${SSH_AGENT_PID:+x}" ] && return 0 if ! command -v ssh-agent > /dev/null 2>&1; then dump "could not find ssh-agent" >&2 return 1 fi + local output output="$( ssh-agent -s )" + eval "$output" + if [ -z "${SSH_AGENT_PID:+x}" ]; then dump "could not start ssh-agent" >&2 return 1 fi + + this_ssh_agent_pid="$SSH_AGENT_PID" } setup_ssh_agent() { @@ -143,7 +147,7 @@ setup_ssh_agent() { echo_password="$( printf -- 'echo %q' "$client_key_password" )" echo "$echo_password" > "$askpass_path" - SSH_ASKPASS="$askpass_path" SSH_ASKPASS_REQUIRE=force DISPLAY= ssh-add "$key" > /dev/null 2>&1 < /dev/null + SSH_ASKPASS="$askpass_path" SSH_ASKPASS_REQUIRE=force DISPLAY= ssh-add "$key" < /dev/null } docker_build() { |