Groovy web console

subscribe to the feed Subscribe
to this
site
test (via #groovywebconsole)
tweet this snippet Tweet
this
script

test

Published 6 months ago by mds
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def JOBS = [
    [
        name: "trunk/regression/premium-sh", params: [
            [name: "SCHEDULE_LIN", value: "true"],
            [name: "SCHEDULE_WIN", value: "true"]
        ]
    ]
]


def tasks = [:]

for (int i = 0; i < JOBS.size(); i++) {
    def job = JOBS[i]
    def timeout = 600 * i
    print "Scheduling ${job} with timeout ${timeout}"
    tasks[job["name"]] = {
        def params = [
            [$class: 'StringParameterValue', name: 'BUILD', value: 111],
            [$class: 'BooleanParameterValue', name: 'COUNTCOVERAGE', value: true]
        ]
        if (job["params"]) {
            params.addAll(job["params"].collect { [$class: 'StringParameterValue', name: it["name"], value: it["value"]] })
        }
        return params;
    }
}

println tasks.collect { k,v -> ["$k": v()] }