[英]Webhook| Gitlab | jenkins pipeline |Declarative syntax
我正在尝试将Webhook与gitlab和jenkins集成。 我已经通过使用URL的上游下游作业完成了它。 尝试通过声明式管道接收相同内容时,我处于停滞状态
pipeline {
agent any
stages {
stage('fetchcodeFromGit') {
steps {
timeout(time: 30) {
git(url: 'http:<<>>/JenkinsPipeline.git', branch: 'master', credentialsId: 'QualityAssurance', poll: true)
}
}
}
任何人都可以提供文档或示例代码片段的帮助吗?
如果选择管道脚本而不是声明性管道,则此文章可能对您有帮助:
https://jrichardsz.github.io/devops/devops-with-git-and-jenkins-using-webhooks
脚步:
您可以使用以下代码段:
pipeline {
options {
gitLabConnection('your-gitlab-conn')
}
triggers {
gitlab(
triggerOnPush: false,
triggerOnMergeRequest: true, triggerOpenMergeRequestOnPush: "both",
triggerOnNoteRequest: true,
noteRegex: "Jenkins please retry a build",
skipWorkInProgressMergeRequest: false,
ciSkip: false,
setBuildDescription: true,
addNoteOnMergeRequest: true,
addCiMessage: true,
addVoteOnMergeRequest: true,
acceptMergeRequestOnSuccess: false,
branchFilterType: "All",
secretToken: "NOTVERYSECRET")
}
stages {
...
此处有更多详细信息: https : //github.com/jenkinsci/gitlab-plugin
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.