add symlink for atomic switch

pull/6179/head
Niklas Fiekas 2020-03-18 22:07:02 +01:00
parent 8c4992c39c
commit eeffc8380a
1 changed files with 6 additions and 2 deletions

View File

@ -146,8 +146,12 @@ def main():
header = f"Authorization: {session.headers['Authorization']}"
artifact_target = f"/home/lichess-artifacts/lila-assets-{run['id']:d}.zip"
command = ";".join([
f"mkdir -p /home/lichess-artifacts; wget --header={shlex.quote(header)} -O {shlex.quote(artifact_target)} --no-clobber {shlex.quote(url)}",
f"unzip -o {shlex.quote(artifact_target)} -d /home/lichess-stage",
f"mkdir -p /home/lichess-artifacts",
f"mkdir -p /home/lichess-deploy",
f"wget --header={shlex.quote(header)} -O {shlex.quote(artifact_target)} --no-clobber {shlex.quote(url)}",
f"unzip -q -o {shlex.quote(artifact_target)} -d /home/lichess-artifacts/lila-assets-{run['id']:d}",
f"cat /home/lichess-artifacts/lila-assets-{run['id']:d}/commit.txt",
f"ln -f -s /home/lichess-artifacts/lila-assets-{run['id']:d}/public /home/lichess-deploy/public",
"/bin/bash",
])
return subprocess.call(["ssh", "-t", "root@khiaw.lichess.ovh", "tmux", "new-session", "-s", "lila-deploy", f"/bin/sh -c {shlex.quote(command)}"], stdout=sys.stdout, stdin=sys.stdin)