-
Task
-
Resolution: Fixed
-
Blocker
-
None
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()