我已经将我的 Gitlab CE 版本 9.3.5 与 jenkins 版本 2.60.1 集成在一起。
我能够使用 Gitlab webhook 触发构建,并使用 jenkins freestyle 作业将结果发布回提交。
我想知道如何使用 jenkins pipeline job 实现相同的效果,因为关于上述集成的每篇文章都适用于 jenkins freestyle job。
最佳答案
如果我遵循有关 Gitlab Jenkins plugin 的文档,您应该能够使用 gitlabCommitStatus
方法,该方法将发布之后声明的构建步骤的状态(这里是来自文档的示例):
node() {
stage 'Checkout'
checkout <your-scm-config>
gitlabCommitStatus {
<script that builds, tests, etc. your project>
}
}
如果这还不够,您还可以使用 updateGitlabCommitStatus name: 'build', state: 'pending'
来更精确地控制您发送到 gitlab 实例的状态。
关于git - 使用 Jenkins 管道作业将 Jenkins 作业构建状态发布到 Gitlab 提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46342869/