jenkinsci / templating-engine-plugin

create tool-agnostic, templated pipelines to be shared by multiple teams
https://jenkinsci.github.io/templating-engine-plugin/latest/
Apache License 2.0
170 stars 59 forks source link

JTE 2.2.2 - random serialization issues in pipeline at various stages #207

Closed tusharsisode closed 2 years ago

tusharsisode commented 3 years ago

Environment Information

Description

Trying to upgrade from JTE 1.7.1 to the most latest version 2.2.2. All the necessary changes to the pipeline are done as per 2.x upgrade instructions. The pipeline has been failing at several stages due to serialization errors after the upgrade. Please note that all of the pipeline code has been working with no issues on version 1.x Can you please help investigate and fix this issue? Thanks

hudson.remoting.ProxyException: java.lang.UnsupportedOperationException: Refusing to marshal org.codehaus.groovy.runtime.GStringImpl for security reasons; see https://jenkins.io/redirect/class-filter/
    at hudson.util.XStream2$BlacklistedTypesConverter.marshal(XStream2.java:540)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeBareItem(AbstractCollectionConverter.java:94)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:66)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeCompleteItem(AbstractCollectionConverter.java:81)
    at com.thoughtworks.xstream.converters.collections.MapConverter.marshal(MapConverter.java:79)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeBareItem(AbstractCollectionConverter.java:94)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:66)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeCompleteItem(AbstractCollectionConverter.java:81)
    at com.thoughtworks.xstream.converters.collections.MapConverter.marshal(MapConverter.java:79)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
    at com.thoughtworks.xstream.converters.reflection.SerializableConverter$1.writeToStream(SerializableConverter.java:139)
    at com.thoughtworks.xstream.core.util.CustomObjectOutputStream.writeObjectOverride(CustomObjectOutputStream.java:87)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
    at java.util.LinkedHashMap.internalWriteEntries(LinkedHashMap.java:333)
    at java.util.HashMap.writeObject(HashMap.java:1363)
    at sun.reflect.GeneratedMethodAccessor408.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
Caused: hudson.remoting.ProxyException: com.thoughtworks.xstream.converters.ConversionException: Failed calling method
---- Debugging information ----
message             : Failed calling method
cause-exception     : java.lang.UnsupportedOperationException
cause-message       : Refusing to marshal org.codehaus.groovy.runtime.GStringImpl for security reasons; see https://jenkins.io/redirect/class-filter/
method              : org.boozallen.plugins.jte.init.governance.config.dsl.PipelineConfigurationDsl$ConfigBlockMap.writeObject()
-------------------------------
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:158)
    at com.thoughtworks.xstream.converters.reflection.SerializableConverter.doMarshal(SerializableConverter.java:257)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:90)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:83)
    at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:275)
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:262)
Caused: hudson.remoting.ProxyException: java.lang.RuntimeException: Failed to serialize org.boozallen.plugins.jte.init.primitives.injectors.StepWrapper#config for class org.boozallen.plugins.jte.init.primitives.injectors.StepWrapper
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:266)
    at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:233)
    at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:150)
    at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:219)
    at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:158)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeBareItem(AbstractCollectionConverter.java:94)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:66)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeCompleteItem(AbstractCollectionConverter.java:81)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:83)
    at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:275)
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:262)
Caused: hudson.remoting.ProxyException: java.lang.RuntimeException: Failed to serialize org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveNamespace#primitives for class org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveNamespace
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:266)
    at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:233)
    at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:150)
    at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:219)
    at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:158)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeBareItem(AbstractCollectionConverter.java:94)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:66)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeCompleteItem(AbstractCollectionConverter.java:81)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:83)
    at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:275)
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:262)
Caused: hudson.remoting.ProxyException: java.lang.RuntimeException: Failed to serialize org.boozallen.plugins.jte.init.primitives.injectors.LibraryNamespace#libraries for class org.boozallen.plugins.jte.init.primitives.injectors.LibraryNamespace
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:266)
    at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:233)
    at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:150)
    at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:219)
    at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:158)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeBareItem(AbstractCollectionConverter.java:94)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:66)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeCompleteItem(AbstractCollectionConverter.java:81)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:83)
    at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:275)
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:262)
Caused: hudson.remoting.ProxyException: java.lang.RuntimeException: Failed to serialize org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveCollector#namespaces for class org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveCollector
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:266)
    at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:233)
    at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:150)
    at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:219)
    at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:158)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeBareItem(AbstractCollectionConverter.java:94)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:66)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeCompleteItem(AbstractCollectionConverter.java:81)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:83)
    at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:275)
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:262)
Caused: hudson.remoting.ProxyException: java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class org.jenkinsci.plugins.workflow.job.WorkflowRun
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:266)
    at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:233)
    at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:150)
    at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:219)
    at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:158)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1255)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1244)
    at com.thoughtworks.xstream.XStream.toXML(XStream.java:1217)
    at hudson.XmlFile.write(XmlFile.java:195)
Caused: hudson.remoting.ProxyException: java.io.IOException: java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class org.jenkinsci.plugins.workflow.job.WorkflowRun
    at hudson.XmlFile.write(XmlFile.java:202)
    at org.jenkinsci.plugins.workflow.support.PipelineIOUtils.writeByXStream(PipelineIOUtils.java:30)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.save(WorkflowRun.java:1210)
    at hudson.tasks.junit.JUnitResultArchiver.parseAndSummarize(JUnitResultArchiver.java:285)
    at hudson.tasks.junit.pipeline.JUnitResultsStepExecution.run(JUnitResultsStepExecution.java:63)
    at hudson.tasks.junit.pipeline.JUnitResultsStepExecution.run(JUnitResultsStepExecution.java:29)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
Caused: hudson.remoting.ProxyException: org.codehaus.groovy.runtime.InvokerInvocationException: java.io.IOException: java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class org.jenkinsci.plugins.workflow.job.WorkflowRun
    at org.boozallen.plugins.jte.init.primitives.injectors.StepWrapperCPS.invoke(script16202602129371562650911.groovy:69)
    at org.boozallen.plugins.jte.init.primitives.injectors.StepWrapperCPS.call(script16202602129371562650911.groovy:41)
    at org.boozallen.plugins.jte.init.primitives.injectors.StageCPS.call(script16202601827791433282508.groovy:50)
    at com.cloudbees.groovy.cps.CpsDefaultGroovyMethods.each(CpsDefaultGroovyMethods:2030)
    at com.cloudbees.groovy.cps.CpsDefaultGroovyMethods.each(CpsDefaultGroovyMethods:2015)
    at com.cloudbees.groovy.cps.CpsDefaultGroovyMethods.each(CpsDefaultGroovyMethods:2056)
    at org.boozallen.plugins.jte.init.primitives.injectors.StageCPS.call(script16202601827791433282508.groovy:43)
    at WorkflowScript.run(WorkflowScript:39)
Caused: hudson.remoting.ProxyException: org.codehaus.groovy.runtime.InvokerInvocationException: org.codehaus.groovy.runtime.InvokerInvocationException: java.io.IOException: java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class org.jenkinsci.plugins.workflow.job.WorkflowRun
    at org.boozallen.plugins.jte.init.primitives.injectors.StepWrapperCPS.invoke(script16202601825141562650911.groovy:69)
    at org.boozallen.plugins.jte.init.primitives.injectors.StepWrapperCPS.call(script16202601825141562650911.groovy:41)
    at WorkflowScript.run(WorkflowScript:35)
    at ___cps.transform___(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
    at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
    at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.constructorCall(DefaultInvoker.java:25)
    at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:97)
    at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83)
    at sun.reflect.GeneratedMethodAccessor610.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
    at com.cloudbees.groovy.cps.impl.LocalVariableBlock$LocalVariable.get(LocalVariableBlock.java:39)
    at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
    at com.cloudbees.groovy.cps.impl.LocalVariableBlock.evalLValue(LocalVariableBlock.java:28)
    at com.cloudbees.groovy.cps.LValueBlock$BlockImpl.eval(LValueBlock.java:55)
    at com.cloudbees.groovy.cps.LValueBlock.eval(LValueBlock.java:16)
    at com.cloudbees.groovy.cps.Next.step(Next.java:83)
    at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
    at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
    at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
    at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
    at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
    at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
    at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
    at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:185)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:400)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:312)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:276)
    at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139)
    at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
    at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
    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:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE
steven-terrana commented 3 years ago

Hey @tusharsisode,

A few questions:

  1. Can you provide a minimal case that reproduces the problem?
  2. When during pipeline execution does this happen? while the configuration files are being loaded, when trying to execute a step, etc?
tusharsisode commented 3 years ago

Hey @steven-terrana,

  1. What I have observed is that this error occurs when a particular step is repeated in the same stage. For example, in our scripted pipeline we call junit step multiple times as part of unit testing stage. The pipeline fails with the said serialization errors during the 2nd call to junit. Similar behaviour is also observed when we try to execute rm -rf via sh. The pipeline fails on subsequent calls to rm -rf .
  2. All the libraries and configuration files are loaded successfully. This error just occurs midway while pipeline is executing the stages as explained in # 1 .
chrishiner commented 3 years ago

I added -Dhudson.remoting.ClassFilter=org.codehaus.groovy.runtime.GStringImpl to my startup options to work around this. I assumed that somewhere in our scripts were were doing something in a string that made it into a GString instead of a regular String.

tusharsisode commented 3 years ago

Yeah, I already tried adding -Dhudson.remoting.ClassFilter=org.codehaus.groovy.runtime.GStringImpl to the startup java options before posting this issue. However, it didn't quite help resolve the issue. Even if it would have, I am not quite comfortable adding this from security standpoint. Don't know if this class has any dangerous deserialisation semantics.

tusharsisode commented 3 years ago

Hey @steven-terrana ,

Do we have any feedback/updates on this issue yet?

cokieffebah commented 3 years ago

sorry just looked at this. @tusharsisode,

Can you provide a minimal case that reproduces the problem?

I see your setup, but could you give us some minimal code to reproduce, Jenkinsfile, pipeline_config.groovy, library code if needed.
Thanks

tusharsisode commented 3 years ago

Hi @cokieffebah ,

Sorry that it took so long to respond. I was able to reproduce this issue with some minimal code. You can see the pipeline code here - https://github.com/tusharsisode/pipeline

Detailed log from running this pipeline is attached below. jte2.2_run_log.txt

This issue occurs when an interpolated string value is set inside a library config as depicted here - https://github.com/tusharsisode/pipeline/blob/main/libraries/gradle/steps/code_build.groovy#L11

I request that this issue be prioritized and fixed soon.

Cheers.

mxkmp commented 3 years ago

Having the same issue while migrating from 1.7 to 2.2. I described my issue in: https://gitter.im/jenkinsci/templating-engine-plugin?at=60d0b5c8457e19611a0f1f96.

I'm also migrating from 1.7 to 2.2 and the pipeline works without any problems on the previous Version. Since the update I'm experience the error messages above without a clue what is wrong and how to fix it.

I have one global pipeline_config:

keywords {
  globals { //store global variables

  }
}

@merge libraries {
  service_metadata
  git_scm
  aquasec
  splunk
  pull_request
  validate_docker
  validate_kubernetes
}

and a separate config which is for java builds:

@merge jte {
  allow_scm_jenkinsfile = false
  pipeline_template = "build_pipeline_multibranch"
}

libraries {
  skip_deploy
  docker 
  sonar_java
}

build_pipeline_branch

withFolderProperties{

    node(env.PROJECT_NODE_NAME) {
      lock(resource: env.JOB_NAME, inversePrecedence: false) {   
        checkout_scm_dev()
        initialize_config()
        build_image()
        lint()
      }
    }
}

Everything works except the linting step. The step crashes after the docker inside is executed and does not print the env variables.

void createProjectIfNotExists(String TOKEN, String projectKey, String projectName, String lang, String host) {
    //create project
    println "creating project if not exists"
    def exec = 'curl -u $TOKEN --data "project=' + projectKey + '&name=' + projectName + '" ' + host + '/api/projects/create'
    println "exec: " + exec
    def ret = sh(returnStdout: true, script: exec)
    println "ret: " + ret
    sh 'curl -u $TOKEN --data "projectKey=' + projectKey + '&language=' + lang + '&qualityProfile=A7_SCM_Java_Standard" ' + host + '/api/qualityprofiles/add_project'
}

String getOrganization(String repo) {
    def regex = /(?<host>.*):(?<org>.*).git/
    def matcher = (repo =~ regex)
    if (!matcher.matches()) {
        error "cannot match host"
    }
    return matcher.group("org")
}

void lint() {
    def localBuildImage = globals.localBuildImage
    println "localBuildImage: " + localBuildImage
    assert localBuildImage?.trim() != false

    def projectKey = "A7:${globals.serviceName}"
    def projectName = "A7-${globals.serviceName}"

    println "ProjectKey: " + projectKey + " ProjectName:" + projectName
    println "Token: " + globals.sonarCubeToken
    assert globals.sonarCubeToken?.trim() != false

    withCredentials([string(credentialsId: globals.sonarCubeToken, variable: 'TOKEN')]) {
        //create project
        println "starting"
        createProjectIfNotExists(TOKEN, projectKey, projectName, "java", globals.sonarCubeHost)

        //copy build data out of docker
        def id = sh(returnStdout: true, script: "docker create ${localBuildImage}").trim()
        sh 'rm -rf target'
        sh "docker cp ${id}:/app/. ."
        sh "docker rm -v ${id}"

        def args = ["sonar.host.url=${globals.sonarCubeHost}",
                    "sonar.projectKey=${projectKey}",
                    "sonar.projectName=${projectName}",
                    "sonar.projectVersion=${commit}",
                    "sonar.scm.revision=${commit}",
                    "sonar.java.binaries=."
                ]

        if (env.isPR.toBoolean() && env.CHANGE_ID.trim() && env.CHANGE_TARGET?.trim()) {
            args.push("sonar.pullrequest.key=${env.CHANGE_ID}" as String)
            args.push("sonar.pullrequest.branch=${env.BRANCH_NAME}" as String)
            args.push("sonar.pullrequest.base=${env.CHANGE_TARGET}" as String)
            args.push("sonar.pullrequest.provider=GitHub")
            args.push("sonar.pullrequest.github.repository=${getOrganization(env.GIT_REPO)}" as String)
        } else {
            args.push("sonar.branch.name=${(env.BRANCH_NAME?.trim() ?: env.GIT_BRANCH)}" as String)
        } 

        println "args" + args

        println "image" + localBuildImage

        docker.image(localBuildImage).inside {
            //here is the crash
            sh 'printenv' //This does not load print
           // sh 'mvn -s settings.xml sonar:sonar ' // args.collect{"-D" + it }.join(' '))
        }

    }
}

void call() {
        println "building for commit: ${commit}"
        pipeline {
            stage('lint java') {
                println 'lint java with sonarcube'
                println "scanConfig: " + globals.scanConfig

                if (globals.scanConfig.lint == "block") {
                    println "lint scan configured to be blocking the pipeline"
                    lint()
                } else if (globals.scanConfig.lint == "skip") {
                    println "lint scan configured to skip"
                } else {
                    println "lint scan configured to be non-blocking"
                    catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
                        try {
                            lint()
                        } catch (Exception e) {
                            env.stepFailed = true
                            error("lint failed: " + e.getMessage())
                        }
                    }
                }
            }
    }
}

Errorlog of the linting step:

[JTE][Step - sonar_java/lint.call()]
[Pipeline] echo
building for commit: e346ff2733a9a5c1cfa5871568b635e72ee4aa77
[Pipeline] stage
[Pipeline] { (lint java)
[Pipeline] echo
lint java with sonarcube
[Pipeline] echo
scanConfig: [aquasec:ignore]
[Pipeline] echo
lint scan configured to be non-blocking
[Pipeline] catchError
[Pipeline] {
[Pipeline] echo
localBuildImage: mda/a7-token-service-build:e346ff2733a9a5c1cfa5871568b635e72ee4aa77
[Pipeline] echo
ProjectKey: A7:token-service ProjectName:A7-token-service
[Pipeline] echo
Token: sonarcube-token
[Pipeline] withCredentials
Masking supported pattern matches of $TOKEN
[Pipeline] {
[Pipeline] echo
starting
[Pipeline] echo
creating project if not exists
[Pipeline] echo
exec: curl -u $TOKEN --data "project=A7:token-service&name=A7-token-service" https://xxxx/api/projects/create
[Pipeline] sh
+ curl -u **** --data 'project=A7:token-service&name=A7-token-service' https://xxxx/api/projects/create
Enter host password for user ****:
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   131  100    85  100    46    583    315 --:--:-- --:--:-- --:--:--   586
[Pipeline] echo
ret: {"errors":[{"msg":"Could not create Project, key already exists: A7:token-service"}]}
[Pipeline] sh
+ curl -u **** --data 'projectKey=A7:token-service&language=java&qualityProfile=A7_SCM_Java_Standard' https://xxxxx/api/qualityprofiles/add_project
Enter host password for user ****:
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100    77    0     0  100    77      0    591 --:--:-- --:--:-- --:--:--   587
[Pipeline] sh
+ docker create mda/a7-token-service-build:e346ff2733a9a5c1cfa5871568b635e72ee4aa77
[Pipeline] sh
+ rm -rf target
[Pipeline] sh
+ docker cp 65b4b868fa7b807ea30f5f066408f066d6ade0d42cfca8911fdb289a6e0aed54:/app/. .
[Pipeline] echo
args[sonar.host.url=https://sonarcubexxx, sonar.projectKey=A7:token-service, sonar.projectName=A7-token-service, sonar.projectVersion=e346ff2733a9a5c1cfa5871568b635e72ee4aa77, sonar.scm.revision=e346ff2733a9a5c1cfa5871568b635e72ee4aa77, sonar.java.binaries=., sonar.branch.name=develop]
[Pipeline] echo
imagemda/a7-token-service-build:e346ff2733a9a5c1cfa5871568b635e72ee4aa77
[Pipeline] isUnix
[Pipeline] sh
+ docker inspect -f . mda/a7-token-service-build:e346ff2733a9a5c1cfa5871568b635e72ee4aa77
.
[Pipeline] withDockerContainer
A7-MDA does not seem to be running inside a container
$ docker run -t -d -u 1002:1002 -w /home/jenkins/workspace/lytics_a7-tokenservice_develop_2 -v /home/jenkins/workspace/lytics_a7-tokenservice_develop_2:/home/jenkins/workspace/lytics_a7-tokenservice_develop_2:rw,z -v /home/jenkins/workspace/lytics_a7-tokenservice_develop_2@tmp:/home/jenkins/workspace/lytics_a7-tokenservice_develop_2@tmp:rw,z -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** mda/a7-token-service-build:e346ff2733a9a5c1cfa5871568b635e72ee4aa77 cat
$ docker top cf520df94047f80afb1373f28b3e40bd9a4e963826692aff86e88bd96f77c0f8 -eo pid,comm
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
java.lang.UnsupportedOperationException: Refusing to marshal org.codehaus.groovy.runtime.GStringImpl for security reasons; see https://jenkins.io/redirect/class-filter/
    at hudson.util.XStream2$BlacklistedTypesConverter.marshal(XStream2.java:541)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.reflection.SerializableConverter$1.writeToStream(SerializableConverter.java:140)
    at com.thoughtworks.xstream.core.util.CustomObjectOutputStream.writeObjectOverride(CustomObjectOutputStream.java:84)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
    at java.util.LinkedHashMap.internalWriteEntries(LinkedHashMap.java:333)
    at java.util.HashMap.writeObject(HashMap.java:1363)
    at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker.callWriteObject(SerializationMethodInvoker.java:135)
Caused: com.thoughtworks.xstream.converters.ConversionException: Could not call org.boozallen.plugins.jte.init.governance.config.dsl.PipelineConfigurationDsl$ConfigBlockMap.writeObject() : Refusing to marshal org.codehaus.groovy.runtime.GStringImpl for security reasons; see https://jenkins.io/redirect/class-filter/
---- Debugging information ----
message             : Could not call org.boozallen.plugins.jte.init.governance.config.dsl.PipelineConfigurationDsl$ConfigBlockMap.writeObject()
cause-exception     : java.lang.UnsupportedOperationException
cause-message       : Refusing to marshal org.codehaus.groovy.runtime.GStringImpl for security reasons; see https://jenkins.io/redirect/class-filter/
-------------------------------
    at com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker.callWriteObject(SerializationMethodInvoker.java:141)
    at com.thoughtworks.xstream.converters.reflection.SerializableConverter.doMarshal(SerializableConverter.java:259)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:83)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:272)
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:259)
Caused: java.lang.RuntimeException: Failed to serialize org.boozallen.plugins.jte.init.primitives.injectors.Keyword#value for class org.boozallen.plugins.jte.init.primitives.injectors.Keyword
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:263)
    at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:231)
    at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
    at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:217)
    at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:158)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:272)
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:259)
Caused: java.lang.RuntimeException: Failed to serialize org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveNamespace#primitives for class org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveNamespace
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:263)
    at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:231)
    at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
    at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:217)
    at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:158)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:272)
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:259)
Caused: java.lang.RuntimeException: Failed to serialize org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveCollector#namespaces for class org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveCollector
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:263)
    at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:231)
    at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
    at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:217)
    at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:158)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:272)
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:259)
Caused: java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class org.jenkinsci.plugins.workflow.job.WorkflowRun
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:263)
    at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:231)
    at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
    at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:217)
    at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:158)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1026)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1015)
    at com.thoughtworks.xstream.XStream.toXML(XStream.java:988)
    at hudson.XmlFile.write(XmlFile.java:195)
Caused: java.io.IOException
    at hudson.XmlFile.write(XmlFile.java:202)
    at org.jenkinsci.plugins.workflow.support.PipelineIOUtils.writeByXStream(PipelineIOUtils.java:30)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.save(WorkflowRun.java:1210)
    at org.jenkinsci.plugins.workflow.cps.EnvActionImpl.setProperty(EnvActionImpl.java:128)
    at org.codehaus.groovy.runtime.InvokerHelper.setProperty(InvokerHelper.java:197)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setProperty(ScriptBytecodeAdapter.java:484)
    at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.setProperty(DefaultInvoker.java:44)
    at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawSet(PropertyAccessBlock.java:24)
Caused: java.lang.RuntimeException
    at org.jenkinsci.plugins.workflow.cps.EnvActionImpl.setProperty(EnvActionImpl.java:130)
    at org.codehaus.groovy.runtime.InvokerHelper.setProperty(InvokerHelper.java:197)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setProperty(ScriptBytecodeAdapter.java:484)
    at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.setProperty(DefaultInvoker.java:44)
    at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawSet(PropertyAccessBlock.java:24)
    at WorkflowScript.call(WorkflowScript:92)
    at ___cps.transform___(Native Method)
    at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.set(PropertyishBlock.java:88)
    at com.cloudbees.groovy.cps.impl.AssignmentBlock$ContinuationImpl.assignAndDone(AssignmentBlock.java:70)
    at sun.reflect.GeneratedMethodAccessor488.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
    at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
    at com.cloudbees.groovy.cps.Next.step(Next.java:83)
    at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
    at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
    at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
    at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
    at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
    at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
    at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
    at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:185)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:400)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:312)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:276)
    at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:136)
    at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
    at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
    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:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Hope that is enough code and information to clarify the issue.

cokieffebah commented 3 years ago

@mxkmp thanks for the submission

mxkmp commented 3 years ago

I think there is a problem with the writeObject of the GString Objects in general. In the build step two different image names are defined.

    imageName = "${pipelineConfig.globals.artifactorySubFolder}/${pipelineConfig.globals.artifactoryDockerPrefix}-${pipelineConfig.globals.serviceName}" 
    pipelineConfig.globals.localBuildImage = "${imageName}-build:${commit}"
    pipelineConfig.globals.localImageName = "${imageName}:${commit}"

If I change the localBuildImage and localImageName to a String there are no errors in the next step (lint). Before running the docker inside step jenkins maybe tries to persists its pipelineConfig variables and is not allowed to persist the GString. How can I avoid this behavior?

cokieffebah commented 3 years ago

@mxkmp try pipelineConfig.globals.localBuildImage = "${imageName}-build:${commit}".toString() basically toString() your GString

mxkmp commented 3 years ago

Yes I tried it before and it works. Is there a better way or will the security plugin block every GString in the memory?