- # Try to download .gz from logs.fd.io
-
- file_name = spec.input["file-name"]
- url = "{0}/{1}".format(
- spec.environment["urls"]["URL[NEXUS,LOG]"],
- spec.input["download-path"].format(
- job=job, build=build["build"], filename=file_name))
- new_name = join(spec.environment["paths"]["DIR[WORKING,DATA]"],
- "{job}{sep}{build}{sep}{name}".format(
- job=job, sep=SEPARATOR, build=build["build"],
- name=file_name))
-
- logging.info("Downloading {0}".format(url))
-
- arch = True if spec.configuration.get("archive-inputs", True) else False
- success, downloaded_name = _download_file(url, new_name, log, arch=arch)
-
- if not success:
-
- # Try to download .gz from docs.fd.io
-
- file_name = spec.input["file-name"]
- url = "{0}/{1}".format(
- spec.environment["urls"]["URL[NEXUS,DOC]"],
- spec.input["download-path"].format(
- job=job, build=build["build"], filename=file_name))
- new_name = join(spec.environment["paths"]["DIR[WORKING,DATA]"],
- "{job}{sep}{build}{sep}{name}".format(
- job=job, sep=SEPARATOR, build=build["build"],
- name=file_name))
-
- logging.info("Downloading {0}".format(url))
-
- if spec.configuration.get("archive-inputs", True):
- arch = True
- success, downloaded_name = _download_file(url, new_name, log, arch=arch)
-
- if not success:
-
- # Try to download .zip from docs.fd.io
-
- file_name = spec.input["zip-file-name"]
- new_name = join(spec.environment["paths"]["DIR[WORKING,DATA]"],
- "{job}{sep}{build}{sep}{name}".format(
- job=job, sep=SEPARATOR, build=build["build"],
- name=file_name))
- release = re.search(REGEX_RELEASE, job).group(2)
- for rls in (release, "master"):
- nexus_file_name = "{job}{sep}{build}{sep}{name}". \
- format(job=job, sep=SEPARATOR, build=build["build"],
- name=file_name)
- try:
- rls = "rls{0}".format(int(rls))
- except ValueError:
- # It is 'master'
- pass
- url = "{url}/{release}/{dir}/{file}". \
- format(url=spec.environment["urls"]["URL[NEXUS,DOC]"],
- release=rls,
- dir=spec.environment["urls"]["DIR[NEXUS,DOC]"],
- file=nexus_file_name)
-
- logging.info("Downloading {0}".format(url))
-
- success, downloaded_name = _download_file(url, new_name, log)
- if success:
- break
-
- if not success:
-
- # Try to download .zip from jenkins.fd.io
-
- file_name = spec.input["zip-file-name"]
- download_path = spec.input["zip-download-path"]
- if job.startswith("csit-"):
- url = spec.environment["urls"]["URL[JENKINS,CSIT]"]
- elif job.startswith("hc2vpp-"):
- url = spec.environment["urls"]["URL[JENKINS,HC]"]
- else:
- raise PresentationError(
- "No url defined for the job '{}'.".format(job))
-
- full_name = download_path.format(
- job=job, build=build["build"], filename=file_name)
- url = "{0}/{1}".format(url, full_name)
- new_name = join(spec.environment["paths"]["DIR[WORKING,DATA]"],
- "{job}{sep}{build}{sep}{name}".
- format(job=job, sep=SEPARATOR, build=build["build"],
- name=file_name))
-
- logging.info("Downloading {0}".format(url))
-
- success, downloaded_name = _download_file(url, new_name, log)
-
- if success and downloaded_name.endswith(".zip"):