Skip to content

Instantly share code, notes, and snippets.

@willis7
Created July 11, 2018 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willis7/e5c74f4ca81fb7b2b4ed52ea66800ca0 to your computer and use it in GitHub Desktop.
Save willis7/e5c74f4ca81fb7b2b4ed52ea66800ca0 to your computer and use it in GitHub Desktop.
Add the Sonar installation
import jenkins.model.*
import hudson.plugins.sonar.*
import hudson.plugins.sonar.model.*
def inst = Jenkins.getInstance()
def desc = inst.getDescriptor("hudson.plugins.sonar.SonarPublisher")
def sinst = new SonarInstallation(
"[name of the sonar installation - I use the host name]",
[true or false to disable the sonar installation],
"[sonar server url]",
"[sonar database url]",
"[sonar database driver]",
"[sonar database user]",
"[sonar database password]",
"[version of sonar maven plugin - I don't use maven so leave this blank]",
"[additional properties to pass to maven - again I leave this blank]",
new TriggersConfig(),
"[sonar user]",
"[sonar password]"
)
desc.setInstallations(sinst)
desc.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment