Groovy web console

subscribe to the feed Subscribe
to this
site

test

Published 2 months ago by test
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def final DEFAULTS = [
        jobAbr : "",
        folderPath : "Provisioning",
        logRot : 10,
        labExp : "ansible",
        timeOutVar : 30,
        params : [ ],
        defaultValues : [ ],
        paramsDescription : [ ]
]

def final JOB_NAMES = [
        "provision-cekit-cacher"       : [
                jobAbr: "CekitCacher",
                params : [
                        [name: "IMAGE", default: "bxms-packer-rhel7-snapshot-updated", description: "The name of the image to be used for machine creation." ],
                        [name: "FLAVOUR", default: "m1.medium", description: "The name of the image to be used for machine creation." ],
                        [name: "DDNS_HOSTNAME", default: "ba-cekit-cacher", description: "The name of the image to be used for machine creation." ],
                        [name: "DDNS_HASH", default: "d1c2341602998809404776a93d354bd0", description: "The name of the image to be used for machine creation." ]
                ]
        ],
        "provision-docker-registry"    : [
                jobAbr: "DockerReg"
        ],
        "provision-smee-client"        : [
                jobAbr: "SmeeClient"
         ],
        "provision-verdaccio-service"  : [
                jobAbr: "VerdaccioServ"
        ]
]

for (jobNames in JOB_NAMES) {
    Closure<Object> get = { String key -> jobNames.value[key] ?: DEFAULTS[key] }

    String jobName = jobNames.key
    String folderPath = get("folderPath")
    String jobAbr = get("jobAbr")
    String labExp = get("labExp")
    Object[] params = [get("params")]
    def logRot = get("logRot")
    def timeOutVar = get("timeOutVar")

    if ( params != "" ) {
        for ( param in params ) {
            print(param.name + ", " + param.default + ", " + param.description)
        }
    }
}