All Downloads are FREE. Search and download functionalities are using the official Maven repository.

au.com.centrumsystems.hudson.plugin.buildpipeline.ProjectJSONBuilder.groovy Maven / Gradle / Ivy

Go to download

This plugin provides build pipeline functionality to Hudson and Jenkins. This allows a chain of jobs to be visualised in a new view. Manual jobs in the pipeline can be triggered by a user with the appropriate permissions manually confirming.

The newest version!
package au.com.centrumsystems.hudson.plugin.buildpipeline

import groovy.json.JsonBuilder

class ProjectJSONBuilder {

    static String asJSON(ProjectForm projectForm) {
        def entries = new ArrayList()
        projectForm.lastSuccessfulBuildParams?.each() { key, value ->
            entries.add({
                paramName(key)
                paramValue(value)
            })
        }

        def builder = new JsonBuilder()
        def root = builder {
            id(projectForm.id)
            name(projectForm.name)
            health(projectForm.health)
            url(projectForm.url)
            lastSuccessfulBuildNumber(projectForm.lastSuccessfulBuildNumber)
            lastSuccessfulBuildParams(entries.toArray())
        }
        return builder.toString()
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy