有没有办法让 gitlab-ci 管道不重复且易于维护?
Is there a way to make gitlab-ci pipeline not duplicate and easy to maintain?
我有几个具有相同生成文件目标的项目;
比方说:make init
、make compile
、make report
.
对于每个 repo 项目,我都有一个非常复杂的管道脚本,它定义了几个作业(这里是伪代码)
stage: one
script:
make init + make compile
stage: two
script:
make init + make report
stage: three
script:
make init TEST=true
...
事实是 yaml 脚本是相同的,并且对于我的所有项目都是相同的,但是维护起来非常痛苦(对于每个新功能我都必须更新所有 repos)...
我只想maintain/modify一个文件。
有没有简单的解决方法?
你总是可以使用include
标签在gitlab中重用代码-ci
https://docs.gitlab.com/ee/ci/yaml/includes.html
作为一个很好的例子,我喜欢 GitLab 代码管道本身
https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab-ci.yml
我有几个具有相同生成文件目标的项目;
比方说:make init
、make compile
、make report
.
对于每个 repo 项目,我都有一个非常复杂的管道脚本,它定义了几个作业(这里是伪代码)
stage: one
script:
make init + make compile
stage: two
script:
make init + make report
stage: three
script:
make init TEST=true
...
事实是 yaml 脚本是相同的,并且对于我的所有项目都是相同的,但是维护起来非常痛苦(对于每个新功能我都必须更新所有 repos)...
我只想maintain/modify一个文件。
有没有简单的解决方法?
你总是可以使用include
标签在gitlab中重用代码-ci
https://docs.gitlab.com/ee/ci/yaml/includes.html
作为一个很好的例子,我喜欢 GitLab 代码管道本身
https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab-ci.yml