I've got the following function in a workflow script that results in the error java.io.NotSerializableException: 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 @NonCPS
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?