Skip to content
Snippets Groups Projects
Commit afe1dbf9 authored by Nico's avatar Nico
Browse files

use WGET for downloading

WGET can retry automatically, so use it.
parent 04ef4022
Branches
No related tags found
No related merge requests found
...@@ -84,11 +84,12 @@ pipeline_jobs_request.raise_for_status() ...@@ -84,11 +84,12 @@ pipeline_jobs_request.raise_for_status()
pipeline_jobs = pipeline_jobs_request.json() pipeline_jobs = pipeline_jobs_request.json()
for job in pipeline_jobs: for job in pipeline_jobs:
if job["name"] == "package": if job["name"] == "package":
with tempfile.TemporaryFile() as artifact_temp: with tempfile.NamedTemporaryFile() as artifact_temp:
with requests.get("{}/projects/{}/jobs/{}/artifacts".format(GITLAB_API_BASE, PROJECT_ID, job["id"]), stream=True) as artifact_request: artifact_url = "{}/projects/{}/jobs/{}/artifacts".format(GITLAB_API_BASE, PROJECT_ID, job["id"])
artifact_request.raise_for_status() logging.debug("Starting download via wget of URL '{}'".format(artifact_url))
for chunk in artifact_request.iter_content(chunk_size=1024*1024): wget_process = subprocess.run(["wget", "-O" + artifact_temp.name, artifact_url], encoding='utf-8')
artifact_temp.write(chunk) if wget_process.returncode != 0:
print(wget_process.stdout)
downloaded_version = extract_zip(artifact_temp) downloaded_version = extract_zip(artifact_temp)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment