An implementation of one of the simple Global Libraries outlined in the Workflow Global Libraries Plugin README fails to run `steps.sh "echo ..."` and also ends the pipeline with a NotSerializableException, failing the build.

      Pictures are attached of the source code for the library, the configuration of the global library within Jenkins, and the pipeline script being executed.

      The console output of the build is:

      Started by user Lee Fowler
      Loading library pipelineLibrary@feature/jenkins-pipeline-library
       > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
       > /usr/bin/git config remote.origin.url https://github.datapipe.net/lfowler/jenkins-pipeline-library.git # timeout=10
      Fetching upstream changes from https://github.datapipe.net/lfowler/jenkins-pipeline-library.git
       > /usr/bin/git --version # timeout=10
      using GIT_ASKPASS to set credentials 
       > /usr/bin/git fetch --tags --progress https://github.datapipe.net/lfowler/jenkins-pipeline-library.git +refs/heads/*:refs/remotes/origin/*
       > /usr/bin/git rev-parse refs/remotes/origin/feature/jenkins-pipeline-library^{commit} # timeout=10
       > /usr/bin/git rev-parse refs/remotes/origin/refs/heads/feature/jenkins-pipeline-library^{commit} # timeout=10
      Checking out Revision ca6de682d24fda3c505b37fac4b2420396ca84b3 (refs/remotes/origin/feature/jenkins-pipeline-library)
       > /usr/bin/git config core.sparsecheckout # timeout=10
       > /usr/bin/git checkout -f ca6de682d24fda3c505b37fac4b2420396ca84b3
       > /usr/bin/git rev-list b96474109250438a1291b2ac3c37f2785ab24688 # timeout=10
      [Pipeline] node
      Running on master in /var/jenkins_home/workspace/pipeline-library-test@5
      [Pipeline] End of Pipeline
      java.io.NotSerializableException: com.datapipe.Templater
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)
      	at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
      	at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
      	at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
      	at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
      	at java.util.HashMap.internalWriteEntries(HashMap.java:1785)
      	at java.util.HashMap.writeObject(HashMap.java:1362)
      	at sun.reflect.GeneratedMethodAccessor197.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
      	at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
      	at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
      	at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
      	at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
      	at java.util.HashMap.internalWriteEntries(HashMap.java:1785)
      	at java.util.HashMap.writeObject(HashMap.java:1362)
      	at sun.reflect.GeneratedMethodAccessor197.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
      	at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
      	at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
      	at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:132)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:429)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:408)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:356)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224)
      	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
      	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: an exception which occurred:
      	in field locals
      	in field capture
      	in field def
      	in field closures
      	in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@709c8b49
      Finished: FAILURE
      

      The Templater.test() call does not execute the shell command, and the build finishes with a NotSerializableException

          [JENKINS-38868] Pipeline Global Library example fails

          Jesse Glick added a comment -

          The class must be declared implements Serializable. I will check if the doc needs to be updated.

          Jesse Glick added a comment - The class must be declared implements Serializable . I will check if the doc needs to be updated.

          Lee Fowler added a comment -

          Thanks jglick. That resolved the issue.

          Lee Fowler added a comment - Thanks jglick . That resolved the issue.

          Code changed in jenkins
          User: R. Tyler Croy
          Path:
          content/doc/book/pipeline/shared-libraries.adoc
          http://jenkins-ci.org/commit/jenkins.io/7d675196927a6ee000e4143ee7ec5228a6ecad31
          Log:
          When describing classes in a Pipeline Shared Library that have "data" they must be Serializable

          Fixes JENKINS-38868

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: R. Tyler Croy Path: content/doc/book/pipeline/shared-libraries.adoc http://jenkins-ci.org/commit/jenkins.io/7d675196927a6ee000e4143ee7ec5228a6ecad31 Log: When describing classes in a Pipeline Shared Library that have "data" they must be Serializable Fixes JENKINS-38868

          Liam Newman added a comment -

          Liam Newman added a comment - jglick https://github.com/jenkinsci/workflow-cps-global-lib-plugin/pull/23

          Jesse Glick added a comment -

          Please do not duplicate documentation! If you want to move documentation to a more official place, fine—delete the original content and add a redirect.

          Jesse Glick added a comment - Please do not duplicate documentation! If you want to move documentation to a more official place, fine—delete the original content and add a redirect.

            bitwiseman Liam Newman
            lfowler Lee Fowler
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: