我的环境是下一个:
-Jenkins 2.46.1
-Gitlab插件1.4.5
-GitLab社区版8.14.3
我配置了一个多分支管道。我已经尝试过了:
pipeline {
agent any
options {
gitLabConnection('MY_GITLAB')
gitlabCommitStatus(name: 'jenkins')
}
triggers {
gitlab(triggerOnPush: true, triggerOnMergeRequest: true, branchFilterType: 'All')
}
stages {
stage("build") {
steps {
gitlabCommitStatus(name: 'build') {
withMaven(
maven: 'maven3', // Maven installation declared in the Jenkins "Global Tool Configuration"
mavenSettingsConfig: 'MY_ID', // Maven settings.xml file defined with the Jenkins Config File Provider Plugin
mavenLocalRepo: '.repository') {
// Run the maven build
sh "mvn clean install"
}
}
}
}
stage("paralelo") {
steps {
parallel (
phase1: { sh "echo phase1" },
phase2: { sh "echo phase2" }
)
}
}
}
}
它工作时没有错误,但我在Gitlab中看不到提交状态。在gitlab的production.log中没有错误。
感谢所有人!
发布于 2017-04-04 12:31:38
您需要将其包装在gitlabBuilds(build: ["jenkins", "build"]) { }
中。
这将传达即将到来的状态。请注意,该值需要与您在gitlabCommitStatus('..')
中使用的值完全相同。
布局应为:
checkout scm
gitlabBuilds(builds: ["1.", "2.",..."n."]) {
gitlabCommitSTatus(name: "1.") { ... }
gitlabCommitSTatus(name: "2.") { ... }
...
gitlabCommitSTatus(name: "n.") { ... }
}
当然,您可以随意选择名称,只要它与gitlabBuilds.builds
中的值匹配即可。
确保您的gitlabConnection
工作正常。
https://stackoverflow.com/questions/43206225
复制相似问题