gitlab - Gitlab:无法使用 URL 下载工件
问题描述
我正在尝试使用 URL 方法下载工件。在GitLab,我收到以下错误:
117$ https://gitlab.myserver.com/mynamespace/jt/-/jobs/artifacts/master/download?job=job_make_patch
118/bin/bash: line 100: https://gitlab.myserver.com/mynamespace/jt/-/jobs/artifacts/master/download?job=job_make_patch: No such file or directory
代码:
job_make:
tags:
- test123
image: node:10.19
stage: build
script:
- npm install
- make
- make source-package
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
artifacts:
when:
paths:
- test.tar.bz2
expire_in: 2 days
job_test_patch:
tags:
- test123
stage: deploy
image: mycustomerdockerimage
script:
- https://gitlab.myserver.com/mynamespace/jt/-/jobs/artifacts/master/download?job=job_make
- ls -lah
我的项目是内部的,每个有权访问的人都可以看到它。我也确保在项目设置中检查“公共管道”。
当我手动尝试 curl 调用时,这就是我得到的:
PS C:\Users\jj\> curl -v https://gitlab.myserver.com/mynamespace/jt/-/jobs/artifacts/master/download?job=job_make
VERBOSE: GET https://gitlab.myserver.com/mynamespace/jt/-/jobs/artifacts/master/download?job=job_make with 0-byte payload
VERBOSE: received -1-byte response of content type text/html; charset=utf-8
PS C:\Users\jj\> curl -v https://gitlab.myserver.com/mynamespace/jt/-/jobs/artifacts/master/download?job=job_make
VERBOSE: GET https://gitlab.myserver.com/mynamespace/jt/-/jobs/artifacts/master/download?job=job_make with 0-byte payload
VERBOSE: received -1-byte response of content type text/html; charset=utf-8
StatusCode : 200
StatusDescription : OK
Content : <!DOCTYPE html>
<html class="devise-layout-html">
<head prefix="og: http://ogp.me/ns#">
<meta charset="utf-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="object" property="o...
RawContent : HTTP/1.1 200 OK
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Referrer-Policy: strict-origin-when-cross-origin,strict-origin-when-cross-origin
X-Content-Type-Options: no...
Forms : {new_user}
Headers : {[Transfer-Encoding, chunked], [Connection, keep-alive], [Vary, Accept-Encoding], [Referrer-Policy, strict-origin-when-cross-origin,strict-origin-when-cross-origin]...}
Images : {}
InputFields : {@{innerHTML=; innerText=; outerHTML=<input name="utf8" type="hidden" value="✓">; outerText=; tagName=INPUT; name=utf8; type=hidden; value=✓}, @{innerHTML=; innerText=;
outerHTML=<input name="authenticity_token" type="hidden" value="OncopKrJ1jOr+BsMQdWIPNaJjoWvkAia6rHR6hUexNoyHJiBUfMVPm+ww0HqAn7h9oRtRqVdcoLgSxZYotJsxg==">; outerText=; tagName=INPUT;
name=authenticity_token; type=hidden; value=OncopKrJ1jOr+BsMQdWIPNaJjoWvkAia6rHR6hUexNoyHJiBUfMVPm+ww0HqAn7h9oRtRqVdcoLgSxZYotJsxg==}, @{innerHTML=; innerText=; outerHTML=<input
name="user[login]" title="This field is required." class="form-control top" id="user_login" autofocus="autofocus" required="required" type="text" data-qa-selector="login_field"
autocorrect="off" autocapitalize="off">; outerText=; tagName=INPUT; name=user[login]; title=This field is required.; class=form-control top; id=user_login; autofocus=autofocus;
required=required; type=text; data-qa-selector=login_field; autocorrect=off; autocapitalize=off}, @{innerHTML=; innerText=; outerHTML=<input name="user[password]" title="This field is
required." class="form-control bottom" id="user_password" required="required" type="password" data-qa-selector="password_field">; outerText=; tagName=INPUT; name=user[password];
title=This field is required.; class=form-control bottom; id=user_password; required=required; type=password; data-qa-selector=password_field}...}
Links : {@{innerHTML=Sign in; innerText=Sign in; outerHTML=<a class="nav-link active" role="tab" href="#login-pane" data-qa-selector="sign_in_tab" data-toggle="tab">Sign in</a>;
outerText=Sign in; tagName=A; class=nav-link active; role=tab; href=#login-pane; data-qa-selector=sign_in_tab; data-toggle=tab}, @{innerHTML=Forgot your password?; innerText=Forgot
your password?; outerHTML=<a href="/users/password/new">Forgot your password?</a>; outerText=Forgot your password?; tagName=A; href=/users/password/new}, @{innerHTML=Explore;
innerText=Explore; outerHTML=<a href="/explore">Explore</a>; outerText=Explore; tagName=A; href=/explore}, @{innerHTML=Help; innerText=Help; outerHTML=<a href="/help">Help</a>;
outerText=Help; tagName=A; href=/help}...}
ParsedHtml : System.__ComObject
RawContentLength : 9914
我想要获取的工件存储库中基本上有一个 zip 文件。谢谢。
解决方案
问题中显示的脚本似乎缺少curl
部分:
script:
- curl -kL https://....
^^^^^^^^
文档提到
下载整个工件存档的 URL 结构如下:
https://example.com/<namespace>/<project>/-/jobs/artifacts/<ref>/download?job=<job_name>
因此,只要您在所述脚本中使用 curl,您的 URL 应该可以工作。
推荐阅读
- ios - 设置 maximumDate 时,Datepicker 返回错误的日期
- ios - 无法在 iOS Angular 应用程序中保存自动填充密码
- javascript - 如何将 PHP 数组作为参数传递给 JavaScript 函数
- c# - 列表不显示 JSON 文件中的元素
- fancybox-3 - Fancybox 3 单击“THIS”元素 ID 从 v2 到 v3 读取问题
- android - Amazon S3 托管的视频无法在 iPhone 浏览器上播放,但可以在 android 上播放
- linux - 脚本未通过 crontab 运行
- c# - 即使套接字服务器正在运行,客户端也无法在一定时间后建立连接
- .htaccess - 可以在未找到的消息中注入文本
- ios - 获取接入点列表及其信号强度