Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-56048

Configuring Sonar Quality gate through programmatic (init.d scripts)

XMLWordPrintable

      Trying to configure the plugin configuration as code 

       

      Below was the groovy script , but it is not updating any thing.

      import java.lang.System
      import java.io.File
      import hudson.model.*
      import jenkins.model.*

      import net.sf.json.JSONObject
      import org.kohsuke.stapler.StaplerRequest
      import quality.gates.jenkins.plugin.*

      def instance = Jenkins.getInstance()

      def sonarQualityGate = instance.getDescriptor(GlobalConfig.class)

      JSONObject sonarQualityGateProperties = new JSONObject()

      sonarQualityGateProperties.put("name", "sonarQube")
      sonarQualityGateProperties.put("timeToWait", 10)
      sonarQualityGateProperties.put("maxWaitTime", 10)
      sonarQualityGateProperties.put("url", "http://localhost:9000")
      sonarQualityGateProperties.put("token", "b035c32db2405002e72d4d6ee02b5a98e2d2548c")

      sonarQualityGate.configure(null,sonarQualityGateProperties)

      instance.save()

            santosh3702 goru santosh
            santosh3702 goru santosh
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: