[JIRA] (JENKINS-59920) JsonSlurper errors within Jenkins Pipeline

1 view
Skip to first unread message

krish2vinno@gmail.com (JIRA)

unread,
Oct 24, 2019, 9:30:03 AM10/24/19
to jenkinsc...@googlegroups.com
Vinod Radhakrishnan created an issue
 
Jenkins / Bug JENKINS-59920
JsonSlurper errors within Jenkins Pipeline
Issue Type: Bug Bug
Assignee: vjuranek
Attachments: Pipeline-error.docx
Components: groovy-plugin, pipeline
Created: 2019-10-24 13:29
Labels: pipeline jenkins
Priority: Blocker Blocker
Reporter: Vinod Radhakrishnan

I am trying to use jsonslurper class within my Jenkinsfile and pipeline and it throws the below error.
Caused: java.io.NotSerializableException: groovy.json.internal.LazyMap
 

My jenkins file given below.

#!groovy​
import groovy.json.JsonSlurper

def json_str = '''{
"name": "Foo Bar",
"year": 2018,
"timestamp": "2018-03-08T00:00:00",
"tags": [ "person", "employee" ],
"grade": 3.14 }'''

def jsonSlurper = new JsonSlurper()
cfg = jsonSlurper.parseText(json_str)
println(cfg)

pipeline

{ agent \{ label 'python' }

options

{ timestamps() buildDiscarder(logRotator(numToKeepStr: '15', artifactNumToKeepStr: '15')) }

environment

{ teamName = "devops" appName = "demo" packageName = 'demo' }

stages {

stage ('Deploy to dev') {
steps

{ echo 'Deploying Testtt' }

}
}

}

The moment it enters the pipeline part, the job errors out. I have attached the detailed logs as an attachment. I went through many blogs and people recommend to use jsonslurperclassic as a workaround and I get that. The same code works fine through our prodcution Jenkins Ecosystem. Is this something related to any plugin version. Why does the job fail even though the am not using the method inside the pipeline. I read an interesting blog post where it mentions Jenkins job tries to save the state of a job in each step by serializing all globally declared variables and since the above one was already serliazed, it errors out.  I am not trying to get a workaorund, if we can get to know why this happens or what are the plugins or configurations in Jenkins that we need to check to get past this issue, that would be of great help.

 

https://medium.com/@dinanjanagunaratne_93368/when-jenkins-pipeline-fails-unexpectedly-d1d22461b16a

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages