我正在尝试将Webhook与gitlab和jenkins集成。我已经通过使用URL的上游下游作业完成了它。 尝试通过声明式管道重新接收rece = rease时,我处于停滞状态
pipeline {
agent any
stages {
stage('fetchcodeFromGit') {
steps {
timeout(time: 30) {
git(url: 'http:<<>>/JenkinsPipeline.git', branch: 'master', credentialsId: 'QualityAssurance', poll: true)
}
}
}
任何人都可以提供文档或示例代码片段的帮助吗?
答案 0 :(得分:1)
如果您选择管道脚本而不是声明性管道,那么这篇文章可能会对您有所帮助:
https://jrichardsz.github.io/devops/devops-with-git-and-jenkins-using-webhooks
步骤:
答案 1 :(得分:0)
您可以使用以下代码段:
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 {
...