-
Task
-
Resolution: Unresolved
-
Critical
-
None
for more complex variables that are annotated with @Field, the load step fails to bind the variable into the Script class.
For example:
// a.groovy import groovy.transform.Field @Field def LOADED_BUILD_NUMBER = ${env.BUILD_NUMBER} return this // Jenkinsfile node() { def a = load('a.groovy') echo(${env.BUILD_NUMBER}) echo(${a.LOADED_BUILD_NUMBER}) }
This example will fail. However, if you replace ${env.BUILD_NUMBER} with a simple type such as `3`, the load step will succeed.
This seems to be related to the security update in workflow-cps v2.64 and the subsequent regression fix for @Field in v2.71.
[JENKINS-63384] load step fails to bind "complex" @Field defined variables
Description |
Original:
for more complex variables that are annotated with @Field, the load step fails to bind the variable into the Script class. For example: {code:java} // a.groovy import groovy.transform.Field @Field def LOADED_BUILD_NUMBER = ${env.BUILD_NUMBER} return this // Jenkinsfile node() { def a = load('a.groovy') echo(${env.BUILD_NUMBER}) echo(${a.LOADED_BUILD_NUMBER}) } {code} {{}} This example will fail. However, if you replace ${env.BUILD_NUMBER} with a simple type such as `3`, the load step will succeed. This seems to be related to the security update in workflow-cps v2.64 and the subsequent regression fix for @Field in v2.71. |
New:
for more complex variables that are annotated with @Field, the load step fails to bind the variable into the Script class. For example: {code:java} // a.groovy import groovy.transform.Field @Field def LOADED_BUILD_NUMBER = ${env.BUILD_NUMBER} return this // Jenkinsfile node() { def a = load('a.groovy') echo(${env.BUILD_NUMBER}) echo(${a.LOADED_BUILD_NUMBER}) } {code} This example will fail. However, if you replace ${env.BUILD_NUMBER} with a simple type such as `3`, the load step will succeed. This seems to be related to the security update in workflow-cps v2.64 and the subsequent regression fix for @Field in v2.71. |
Priority | Original: Minor [ 4 ] | New: Critical [ 2 ] |