Jenkins Pipeline NotSerializableException: groovy.json.internal.LazyMap

后端 未结 12 775
长发绾君心
长发绾君心 2020-11-27 03:08

Solved: Thanks to below answer from S.Richmond. I needed to unset all stored maps of the groovy.json.internal.LazyMap type whi

12条回答
  •  醉酒成梦
    2020-11-27 03:47

    I want to upvote one of the answer: I would recommend just using the Pipeline Utility Steps plugin, as it has a readJSON step that can support either files in the workspace or text: https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/#readjson-read-json-from-files-in-the-workspace

    script{
      def foo_json = sh(returnStdout:true, script: "aws --output json XXX").trim()
      def foo = readJSON text: foo_json
    }
    

    This does NOT require any whitelisting or additional stuff.

提交回复
热议问题