Jenkins方法太大

r7knjye2  于 2022-11-02  发布在  Jenkins
关注(0)|答案(1)|浏览(380)

稍微修改Jenkinfiles后,通过向

environment{

...

uuid = <256 char long uuid>

}

我收到错误:

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;

我已经搜索了这个问题,但没有发现任何问题,因为唯一的变化是添加了环境变量

vohkndzv

vohkndzv1#

Java的字节码大小限制为64K。这是pipeline块中的计数,因此,环境也包含在其中。
您可能需要将管道拆分为方法,如本例所述
对于环境,您可以创建一个返回所需值的自定义方法:

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

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

相关问题