ci deploy: set user agent

pull/6447/head
Niklas Fiekas 2020-04-22 21:51:29 +02:00
parent 66f0fec9b5
commit 416a29e159
1 changed files with 4 additions and 2 deletions

View File

@ -232,7 +232,8 @@ def tmux(ssh, script, *, dry_run=False):
def deploy_script(profile, session, run, url):
header = f"Authorization: {session.headers['Authorization']}"
auth_header = f"Authorization: {session.headers['Authorization']}"
ua_header = f"User-Agent: {session.headers['User-Agent']}"
deploy_dir = profile["deploy_dir"]
artifact_unzipped = f"{ARTIFACT_DIR}/{profile['artifact_name']}-{run['id']:d}"
artifact_zip = f"{artifact_unzipped}.zip"
@ -241,7 +242,7 @@ def deploy_script(profile, session, run, url):
"echo \\# Downloading ...",
f"mkdir -p {ARTIFACT_DIR}",
f"mkdir -p {deploy_dir}/application.home_IS_UNDEFINED/logs",
f"[ -f {artifact_zip} ] || wget --header={shlex.quote(header)} --no-clobber -O {artifact_zip} {shlex.quote(url)}",
f"[ -f {artifact_zip} ] || wget --header={shlex.quote(auth_header)} --header={shlex.quote(ua_header)} --no-clobber -O {artifact_zip} {shlex.quote(url)}",
"echo",
"echo \\# Unpacking ...",
f"unzip -q -o {artifact_zip} -d {artifact_unzipped}",
@ -270,6 +271,7 @@ def deploy(profile, repo, commit, github_api_token, dry_run):
session = requests.Session()
session.headers["Authorization"] = f"token {github_api_token}"
session.headers["User-Agent"] = "ornicar/lila"
try:
wanted_hash = hash_files(commit.tree, profile["files"])