user3617723 user3617723 - 26 days ago 10x
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?


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