# Pastebin EyujZdGQ @SuppressWarnings("GroovyAssignabilityCheck") def call(body) { def config = [:] body.resolveStrategy = Closure.DELEGATE_FIRST body.delegate = config body() def creds = config.creds ? config.creds : [:] pipeline { stages { stage('Doing stuff') { steps { script { deployCreds.each { def paramProd = credentials("${it.value['prod']}") def paramDev = credentials("${it.value['dev']}") // Do stuff the creds } } } } } } }