My enviroment is the next:
-Jenkins 2.46.1
-Gitlab plugin 1.4.5
-GitLab Community Edition 8.14.3
I have a multibranch pipeline configured. I have tried with:
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" }
)
}
}
}
}
It works without erros but i dont see the commit status in my Gitlab. Without erros in production.log from gitlab.
Thanks to all!
You will need to wrap it in gitlabBuilds(build: ["jenkins", "build"]) { }.
This will communicate the statusses that are coming. Note that the value needs to be exactly the same as you are using in gitlabCommitStatus('..').
The layout should be:
checkout scm
gitlabBuilds(builds: ["1.", "2.",..."n."]) {
gitlabCommitStatus(name: "1.") { ... }
gitlabCommitStatus(name: "2.") { ... }
...
gitlabCommitStatus(name: "n.") { ... }
}
where off course the name you can choose whatever you like, as long as it matches the values in gitlabBuilds.builds.
Make sure your gitlabConnection is working correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With