[英]Webhook| Gitlab | jenkins pipeline |Declarative syntax
I'm trying to integrate Webhook with gitlab and jenkins. 我正在尝试将Webhook与gitlab和jenkins集成。 I have done it via upstream downstream jobs using the URL.
我已经通过使用URL的上游下游作业完成了它。 While trying to rece=reate the same via declarative pipeline, I'm in a stanstill
尝试通过声明式管道接收相同内容时,我处于停滞状态
pipeline {
agent any
stages {
stage('fetchcodeFromGit') {
steps {
timeout(time: 30) {
git(url: 'http:<<>>/JenkinsPipeline.git', branch: 'master', credentialsId: 'QualityAssurance', poll: true)
}
}
}
Can anyone help with documents or any sample snippets? 任何人都可以提供文档或示例代码片段的帮助吗?
If you choose pipeline script instead declarative pipeline, this post could be help you : 如果选择管道脚本而不是声明性管道,则此文章可能对您有帮助:
https://jrichardsz.github.io/devops/devops-with-git-and-jenkins-using-webhooks https://jrichardsz.github.io/devops/devops-with-git-and-jenkins-using-webhooks
Steps: 脚步:
You can use this snippet: 您可以使用以下代码段:
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 {
...
more details here: https://github.com/jenkinsci/gitlab-plugin 此处有更多详细信息: https : //github.com/jenkinsci/gitlab-plugin
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.