简体   繁体   English

Jenkins 方法太大

[英]Jenkins Method too large

After modifying Jenkinfiles slightly, by adding 1 more environment variables to稍微修改一下 Jenkinsfiles 后,通过添加 1 个环境变量到

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. Java 的字节码大小限制为 64K。 This is count in the pipeline block, therefore, environment is included there.这是pipeline块中的计数,因此,其中包含环境。

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'
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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