Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-56313

stage process fails after accessing parsed xml childNodes

XMLWordPrintable

      It appears that if you execute a function in stage and that function accesses a child node that has been form by parsing XML the stage will fail after the function is complete and successful

       

      Example:

       def xmlData = "" +
      "<data>" +
        "<parent>" +
          "<child>foo</child>" +
        "</parent>" +
      "</data>" +
      ""
      node() {    
        stage( 'read' ) {
              
          echo "Testing nodeChildren"
          outputData()    
        }
      }
      
      @NonCPS
      def getLatestXML() {
          echo "Before parsed"
          def data = new XmlSlurper().parseText(xmlData)
          echo "parsed "
          value = "${data.parent.child}-0.4.0-"
          echo "I can access value" + value.getClass()
          return value 
      }def outputData () {
          def value = getLatestXML()
          echo "I can echo but I can't do anything with it"
          println "value: ${value}"
      }
      

      This will fail with a java.io.NotSerializableException: groovy.util.slurpersupport.NodeChildren

      even though the process was successful 

      This happens regardless if you use a seperate NonCPS or not.
      And yes I did approve the scripts

       

            vjuranek vjuranek
            sambodo7 Sam Stephenson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: