GitLab CI-Build Artifacts命令行下载

问题描述 投票:0回答:1

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.
gitlab ubuntu-14.04 gitlab-ci
1个回答
1
投票

您的网址中存在错误。它应该是作业而不是构建:

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

© www.soinside.com 2019 - 2024. All rights reserved.