From 36dabd454bf137f74ab7c3e372b060a4ded7f284 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 14 Oct 2026 15:59:48 +0500 Subject: t/i/docker: move SSH setup to git_server --- test/integration/docker/test.sh | 79 ----------------------------------------- 1 file changed, 79 deletions(-) (limited to 'test/integration/docker/test.sh') diff --git a/test/integration/docker/test.sh b/test/integration/docker/test.sh index ae43b71..a82f3b1 100755 --- a/test/integration/docker/test.sh +++ b/test/integration/docker/test.sh @@ -12,8 +12,6 @@ readonly script_name # This is still required with older Compose versions to use TARGETARCH: export DOCKER_BUILDKIT=1 -readonly ssh_dir="$script_dir/ssh_keys" -readonly client_key_password='password' readonly output_dir="$script_dir/output" readonly frontend_host=127.0.0.1 @@ -40,8 +38,6 @@ cleanup() { echo Cleaning up echo ---------------------------------------------------------------------- - remove_ssh_keys - kill_ssh_agent docker_cleanup rm -rf -- "$output_dir" @@ -85,74 +81,6 @@ curl_check_code() { fi } -generate_ssh_keys() { - echo - echo ---------------------------------------------------------------------- - echo Generating SSH keys - echo ---------------------------------------------------------------------- - - mkdir -p -- "$ssh_dir" - - ssh-keygen -t rsa -b 4096 -f "$ssh_dir/client_key" -N "$client_key_password" - ssh-keygen -t rsa -b 4096 -f "$ssh_dir/server_key" -N '' -} - -remove_ssh_keys() { - rm -rf -- "$ssh_dir" -} - -kill_ssh_agent() { - [ -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() { - 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() { - echo - echo ---------------------------------------------------------------------- - echo Setting up ssh-agent - echo ---------------------------------------------------------------------- - - spawn_ssh_agent - - local key="$ssh_dir/client_key" - chmod 0600 -- "$key" - - local askpass_path - askpass_path="$( mktemp --tmpdir="$script_dir" )" - - local askpass_rm - askpass_rm="$( printf -- 'rm -- %q; trap - RETURN' "$askpass_path" )" - trap "$askpass_rm" RETURN - - chmod 0700 -- "$askpass_path" - - local echo_password - 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 -} - docker_build() { echo echo ---------------------------------------------------------------------- @@ -169,8 +97,6 @@ docker_cleanup() { } setup() { - generate_ssh_keys - setup_ssh_agent docker_build } @@ -189,11 +115,6 @@ run_cgitize() { echo Running cgitize echo ---------------------------------------------------------------------- - if [ -z "${SSH_AUTH_SOCK:+x}" ]; then - dump 'SSH_AUTH_SOCK is not defined' >&2 - return 1 - fi - dump "SSH_AUTH_SOCK: $SSH_AUTH_SOCK" docker compose run --rm cgitize } -- cgit v1.3