user3617723 user3617723 - 1 year ago 345
Groovy Question

Jenkins Workflow groovy.json.internal.LazyMap in Closure

I've got the following function in a workflow script that results in the error groovy.json.internal.LazyMap

def getParentTagForCurrentBranch(appWorkspace) {

def parentTag = null

dir("${appWorkspace.getPath()}") {

parentTag = bat(script:"git describe --abbrev=0 --tags", returnStdout:true)

return parentTag

What I don't understand about the error is where I am using a LazyMap?

I've tried quite a few different variations of this block but all result in the error, I've also tried using the
but that just results in the whole method being skipped.

Can anyone help me understand why this produces the error and how to resolve it?

Answer Source

Thanks the problem was with JsonSlurperswitching to JsonSlurperClassicdid the trick as mentioned here Jenkins Pipeline NotSerializableException: groovy.json.internal.LazyMap

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download