Moi*_*ame 4 yaml gitlab gitlab-ci
鉴于我有一个包含此文件的私人存储库:
https://gitlab.com/myuser/snippets/-/raw/main/snippets.yml
.my-snippet:
before_script:
- one command here...
- another thing here...
Run Code Online (Sandbox Code Playgroud)
我想在.gitlab-ci.yml另一个私人存储库的文件中执行此操作:
https://gitlab.com/myuser/coderepo/-/raw/main/.gitlab-ci.yml
include:
remote: https://gitlab.com/myuser/snippets/-/raw/main/snippets.yml
mycijob:
extends: .my-snippet
script:
- does a thing...
- probably does something else...
Run Code Online (Sandbox Code Playgroud)
一个人会怎么做这样的事情呢?我尝试了部署令牌,但在获取文件的原始内容时似乎不起作用。我得到了 503。这可能吗?
即使使用更好、更简单的方法来处理这个问题也可以实现。
您可以对 gitlab 使用特殊语法,只要它们位于同一实例上即可。您可以使用以下语法指定项目和可选的引用以及文件,例如
include:
- project: 'myuser/snippets'
# optional ref, can point to a tag or branch, if not specified the default branch of the target repository is used
# ref: <git ref>
file:
- 'snippets.yml'
Run Code Online (Sandbox Code Playgroud)
有关更多信息,请查看文档:https://docs.gitlab.com/ee/ci/yaml/includes.html
| 归档时间: |
|
| 查看次数: |
5246 次 |
| 最近记录: |