GitLab CI-Build Artifacts命令行下载

时间:2019-04-10 04:54:37

标签: gitlab ubuntu-14.04 gitlab-ci

GitLab版本-11.8.1,并尝试在Ubuntu -14.04-LTS系统的终端上下载CI-Build工件zip文件。

使用以下命令

curl -XGET --header "PRIVATE-TOKEN:avxa_afdfouqernadfg" -o artifacts.zip https://gitlab.com/api/v4/projects/78/builds/artifacts/master/download?job=ci-build

命令已成功完成,但是在解压缩artifacts.zip文件时出现以下错误。

Archive:  artifacts.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of artifacts.zip or
        artifacts.zip.zip, and cannot find artifacts.zip.ZIP, period.

1 个答案:

答案 0 :(得分:1)

您的URL错误。应该是 职位 ,而不是 建筑

curl -X GET --header "PRIVATE-TOKEN:avxa_afdfouqernadfg" -o artifacts.zip "https://gitlab.com/api/v4/projects/78/jobs/artifacts/master/download?job=ci-build"

我还建议在您的curl调用中添加一个-v,这样您就会看到错误:HTTP/1.1 404 Not Found

请参阅:https://docs.gitlab.com/ee/api/jobs.html#download-the-artifacts-archive