[英]How can I download gitlab CI/CD artifacts with curl?
Our gitlab CI/CD web interface lets us download "artifacts" (eg executables, shared libraries) after a successful run, as in the screenshot below:我们的 gitlab CI/CD web 接口允许我们在成功运行后下载“工件”(例如可执行文件、共享库),如下面的屏幕截图所示:
Question: Is there a way the artifact can be downloaded from a shell?问:有没有办法可以从 shell 下载工件? (solution using curl is preferred)
(使用curl的方案是首选)
The " Copy Link Location
" right-click menu option gives me something like https://git.my_company.com/namespace/project/-/jobs/987134/artifacts/download
so I tried the following: “
Copy Link Location
”右键菜单选项给了我类似https://git.my_company.com/namespace/project/-/jobs/987134/artifacts/download
的东西,所以我尝试了以下操作:
$ curl -O -L https://git.my_company.com/namespace/project/-/jobs/987134/artifacts/download
But that doesn't download the right thing: it gives me a vomit of html, but I'm expecting a.zip file.但这并没有下载正确的东西:它让我呕吐了 html,但我期待一个 .zip 文件。
If I try to download the file from the web UI, the filename defaults to artifacts.zip
, so I also tried:如果我尝试从 web UI 下载文件,文件名默认为
artifacts.zip
,所以我也尝试了:
$ curl -O -L https://git.my_company.com/namespace/project/-/jobs/987134/artifacts/download/artifacts.zip
That does create a file named artifacts.zip
but it's still not the expected file: it's still html, though different from the first described attempt.这确实创建了一个名为
artifacts.zip
的文件,但它仍然不是预期的文件:它仍然是 html,尽管与第一次描述的尝试不同。
For public repository,对于公共存储库,
Go to Settings > General > Permissions > Pipelines must be "Everyone with access".
Go 到
Settings > General > Permissions > Pipelines must be "Everyone with access".
Your answer is described here: https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html#downloading-artifacts您的答案在这里描述: https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html#downloading-artifacts
The structure of the URL to download the whole artifacts archive is the following:下载整个工件存档的 URL 的结构如下:
https://example.com/<namespace>/<project>/-/jobs/artifacts/<ref>/download?job=<job_name>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.