Use an ssh config file to configure package uploading

[skip ci]
This commit is contained in:
Daniele Varrazzo 2020-01-04 14:24:54 +01:00
parent 9bfde497e5
commit 8a6b280d86

View File

@ -497,7 +497,7 @@ def setup_ssh():
# Write SSH Private Key file from environment variable
pkey = pkey.replace(' ', '\n')
with (opt.clone_dir / 'id_rsa').open('w') as f:
with (opt.clone_dir / 'data/id_rsa-psycopg-upload').open('w') as f:
f.write(
f"""\
-----BEGIN RSA PRIVATE KEY-----
@ -516,16 +516,11 @@ def upload_packages():
# Upload built artifacts
logger.info("uploading artifacts")
ssh_cmd = (
r"C:\MinGW\msys\1.0\bin\ssh -i %s "
"-o UserKnownHostsFile=%s -o StrictHostKeyChecking=yes"
% (opt.clone_dir / "id_rsa", opt.clone_dir / 'known_hosts')
)
os.chdir(opt.package_dir)
os.chdir(opt.clone_dir)
run_command(
[r"C:\MinGW\msys\1.0\bin\rsync", "-avr"]
+ ["-e", ssh_cmd, "dist/", "psycopg@upload.psycopg.org:"]
+ ["-e", r"C:\MinGW\msys\1.0\bin\ssh -F data/ssh_config"]
+ ["psycopg2/dist/", "upload:"]
)