[英]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.