Construct a new builder object and replace the old one, that is basically what the save button does.
/B 2014-07-31 9:05 GMT+02:00 Amos S <[email protected]>: > Hello, > > I'm trying to change the names of projects which will be triggered by a > build via the Groovy console. > > I got as far as being able to extract the field from the data structures > but didn't find a way to set it with a new value. > > Here is the code I got so far: > > import hudson.model.* > import hudson.model.FreeStyleProject > import jenkins.model.Jenkins > import hudson.plugins.parameterizedtrigger.TriggerBuilder > > def viewName = "v2.9" > > Jenkins jenkins = Jenkins.getInstance() > > jenkins.getView(viewName).getItems().each { item -> > def jobName = item.getName() > FreeStyleProject job = jenkins.getItem(jobName) > > job.builders.each { builder -> > if (builder.metaClass.respondsTo(builder, "getConfigs")) { > builder.getConfigs().each { config -> > println("projects to build: \"" + config.getProjects() + > "\"") > } > } > } > } > > so "getProjects()" returns to be the content of the field I want to > change, here is the field I want to change: > > > <https://lh6.googleusercontent.com/-RPzN50sJ3zo/U9nqhFHwV9I/AAAAAAAAL7I/z8_PfaWTw-o/s1600/Screen+Shot+2014-07-31+at+5.04.08+pm.png> > > How can I achieve this? > > Thanks. > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
