简体   繁体   English

从 gitlab 存储库中获取最新的 package

[英]Fetch the latest package from gitlab repository

I need to get the latest package from my gitlab repository我需要从我的 gitlab 存储库中获取最新的 package

My repo's packages url is in this format <BASE_URL>/-/packages/<version-id>我的仓库的包 url 采用这种格式<BASE_URL>/-/packages/<version-id>

And the download url as <BASE_URL>/-/packages/<version-id>/download并将 url 下载为<BASE_URL>/-/packages/<version-id>/download

In my docker file I refer it (hardcode version) for example as:在我的 docker 文件中,我将其称为(硬代码版本),例如:

ARG BUNDLE_URL="<BASE_URL>/-/packages/210/download"
RUN curl ${BUNDLE_URL} -o /app/bundle.tar.gz

So my question is, there is any way to download the latest version directly from gitlab, for example to download a url like this <BASE_URL>/-/packages/latest/download or something similar?所以我的问题是,有什么方法可以直接从 gitlab 下载最新版本,例如下载 url 这样的<BASE_URL>/-/packages/latest/download或类似的东西?

Also if the above is not possible there is a way to get in the dockerfile the latest version number and put it on this url format <BASE_URL>/-/packages/<version-id>/download ?此外,如果上述情况不可行,是否有办法在 dockerfile 中获取最新版本号并将其放在此 url 格式<BASE_URL>/-/packages/<version-id>/download

I need this to make the docker file more generic我需要这个来使 docker 文件更通用

Thanks in advance,提前致谢,

To your first question, the easiest I guess would be to use the GitLab packages API .对于您的第一个问题,我想最简单的方法是使用GitLab 包 API The first one lists packages from a project/a group, sorted from most recent to oldest.第一个列出了项目/组中的包,从最新到最旧排序。

If your group/project is public, you won't need any token to access the API.如果您的组/项目是公开的,则无需任何令牌即可访问 API。 Else you might provide a Group Access Token with read_api scope only.否则,您可能只提供带有read_api scope 的组访问令牌

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将 jar 文件发布到 GitLab package 存储库 - Publish a jar file to GitLab package repository 如何直接从 gitlab 服务器存储库获取 git 参考名称? - How to get the git refs name directly from gitlab server repository? 在 gitlab 存储库中启用合并选项 - enable the merge option in gitlab repository 检查 gitlab 中的其他人存储库 - Check other people repository in gitlab gitlab - 使用 access_token 推送到存储库 - gitlab - Push to a repository using access_token AWS Lambda GitLab CI/CD 部署 package 大小比从我的本地环境部署大得多 - AWS Lambda GitLab CI/CD deployment package size is much bigger than deploy from my local environment 除非我以 root 身份运行,否则从内部 gitlab 存储库克隆 git 不起作用 - git clone from internal gitlab repository doesn't work unless I'm running as root 来自守护程序的错误响应:registry.gitlab.com 存储库不存在或可能需要“docker login”的请求访问被拒绝 - Error response from daemon: pull access denied for registry.gitlab.com repository does not exist or may require 'docker login' GCP Cloud Build 突然无法从 Github Package 获取 npm package - GCP Cloud Build suddenly cannot fetch npm package from Github Package GitLab ci 取消发布 npm package - GitLab ci unpublish npm package
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM