[英]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.