continuous-integration - Download GitLab Generic Package File using Deploy Token
问题描述
I have a project (A), with CI pipeline, in GitLab. This pipeline has a dependency on a package from another project (B). During the build of project A, I want to download the package from project B's package registry. The packages are uploaded as (zip files) generic packages. The projects are all private so I need some kind of access token to authenticate.
I'm trying to use Deploy Tokens as these seem to provide the required read_package_registry access scope. However, I cannot find any documentation describing how to authenticate with a deploy token when downloading generic package files.
I'm using the following request, described in the previous link.
GET https://gitlab.com/api/v4/projects/<project_B_id>/packages/generic/<package_name>/<package_version>/<package_file>
I have tried
- adding the deploy token username and password to the URL, basic/digest authentication
- Adding a header to the request
PRIVATE-TOKEN: [deploy-token]
- Adding a header to the request
DEPLOY-TOKEN: [deploy-token]
- Adding a header to the request
Authorization: Bearer [deploy-token]
- I've also tried each of the above headers but with
[deploy-token-username][deploy-token]
as the value
I can't find documentation stating that I can't use a deploy token.
Does anyone have a working example of how to do this, or does anyone know if this is/isn't possible?
I can switch to a private access token, but I'd prefer to use the correct tool for the job, and that seems to be deploy tokens.
解决方案
该问题已在 gitlab 上提出。部署令牌暂时不起作用。目前在此处跟踪:
https://gitlab.com/gitlab-org/gitlab/-/issues/284397
解决方法是使用个人访问令牌。
推荐阅读
- c# - 在 ASP.NET Core 标识中只允许数字密码
- python - 如何安装 requirements.txt 并忽略未找到的模型
- java - Android sqlite数据库在更新查询时没有这样的列
- javascript - 移除水平滚动条并使表格更宽
- elasticsearch - ELK logstash 无法在 ES 中创建索引
- jenkins - 在 Jenkins 管道中超时后重试 - 解决方法
- javascript - 动态选择 React 组件并将数据应用为 props
- google-maps - Google Maps API - 折线作为图像
- python - 在 Matplotlib 中自定义轴
- javascript - napi 中的字符串返回限制