The error message "NotSerializableException: groovy.json.internal.Lazymap" usually occurs in Jenkins pipelines when the pipeline code tries to serialize an object that is not serializable. This error typically indicates that the pipeline is trying to pass a non-serializable object to another stage or job, or store it in a workspace.
In this particular case, it seems that the error is caused by attempting to serialize a Lazymap object from the Groovy JSON library, which is not serializable. To fix this issue, you can try one or more of the following:
Avoid using Lazymap objects in your pipeline code. Instead, use regular Groovy maps or other data structures that are serializable.
If you need to use Lazymap objects, you can try converting them to regular maps using the toJson() method before serializing them. For example, you can try the following code:
def myMap = new JsonSlurper().parseText(jsonString)
def serializedMap = myMap.toJson()
If you need to pass non-serializable objects between stages or jobs in your pipeline, you can use the stash/unstash steps or the shared library to store the objects in a shared location, and then retrieve them in the next stage or job.
You can also try upgrading to the latest version of the Groovy JSON library or Jenkins, as newer versions may have fixed this issue.
Comments (0)