简体   繁体   中英

Jenkins Method too large

After modifying Jenkinfiles slightly, by adding 1 more environment variables to

environment{



...

uuid = <256 char long uuid>

}

I get error:

7:37:34  Library piper-lib-os@v1.221.0 is cached. Copying from home.
17:37:35  org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
17:37:35  General error during class generation: Method too large: WorkflowScript.___cps___18504794 ()Lcom/cloudbees/groovy/cps/impl/CpsFunction;
17:37:35  
17:37:35  groovyjarjarasm.asm.MethodTooLargeException: Method too large: WorkflowScript.___cps___18504794 ()Lcom/cloudbees/groovy/cps/impl/CpsFunction;

I've searched for this, but cannot find any issue, as the only change is adding environment variable

Java has a 64K size limit on bytecode. This is count in the pipeline block, therefore, environment is included there.

You might need to break your pipeline into method as stated in this example

For environment you can create a custom method that returns the value you need:


pipeline { 
 environment { ...
   MYENV = getEnvUUID()
   ...
 }
...
}


def getEnvUUID() {
  return 'really-long-uuid'
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM