如何在.gitlab-ci.yml中使用模板中的脚本
我使用脚本为gitlab-ci创建模板
.test-script: &test
- echo "hello"
如何在.gitlab-ci.yml中使用此脚本?我尝试过这样的
include: '/templates/test-template.yml'
example-stage:
script:
- *test
错误发生“此gitlab ci配置无效:未知别名:测试。” ,因为在合并的yaml中没有此脚本的别名。
Gitlab版本:GitLab社区版14.6.0
I create template for gitlab-ci with script
.test-script: &test
- echo "hello"
How to use this script in .gitlab-ci.yml? I tried like this
include: '/templates/test-template.yml'
example-stage:
script:
- *test
Error occurs "This GitLab CI configuration is invalid: Unknown alias: test." because there is no alias for this script in the merged YAML.
GitLab version: GitLab Community Edition 14.6.0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不使用GitLab的扩展或参考关键字?
或者
Why not use GitLab's extends or reference keywords?
or
也许您可以尝试此语法:
对于您的示例阶段作业:
Maybe you could try this syntax :
For your example-stage job :