I'm using the job dsl plugin to generate jenkins jobs. I'm running into some problem with the sonar implementation of the job dsl plugin. I'm using the Flexible Publish plugin to provide a conditional to running sonar; i.e. if we find pom.xml in workspace run sonar. The problem is that I want to set sonar variable 'jobAdditionalProperties', but that variable isn't supported by job dsl plugin yet. What I got so far:
publishers {
flexiblePublish {
condition {
fileExists('pom.xml', BaseDir.WORKSPACE)
}
publisher {
sonar {
branch('master')
}
}
}
}
I've tried to use the configure method like according to the documentation:
configure { project ->
project / publishers << 'hudson.plugins.sonar.SonarPublisher' {
jobAdditionalProperties('..')
}
But that won't work since the xml is nested with the flexible publish plugin using the conditional and the xml isn't generated in the right place. The XML-tree looks something like this:
<publishers>
<org.jenkins__ci.plugins.flexible__publish.FlexiblePublisher>
<publishers>
<org.jenkins__ci.plugins.flexible__publish.ConditionalPublisher>
<condition class='org.jenkins_ci.plugins.run_condition.core.FileExistsCondition'>
<file>pom.xml</file>
<baseDir class='org.jenkins_ci.plugins.run_condition.common.BaseDirectory$Workspace'></baseDir>
</condition>
<publisherList>
<hudson.plugins.sonar.SonarPublisher>
<branch></branch>
<jobAdditionalProperties></jobAdditionalProperties>
Anyone got a clue how to solve this?