Following Reuben's comments I came up a util function. Posting here so 
other people can see a working example.

import hudson.model.*

// sets build parameters based on the given map
// only supports StringParameterValue
def setBuildParameters(map) {
    def npl = new ArrayList<StringParameterValue>()
    for (e in map) {
        npl.add(new StringParameterValue(e.key.toString(), 
e.value.toString()))
    }
    def newPa = null
    def oldPa = build.getAction(ParametersAction.class)
    if (oldPa != null) {
        build.actions.remove(oldPa)
        newPa = oldPa.createUpdated(npl)
    } else {
        newPa = new ParametersAction(npl)
    }
    build.actions.add(newPa)
}

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to