-
Bug
-
Resolution: Unresolved
-
Major
-
Jenkins version: 2.134
Plugins:
ace-editor 1.1 true
active-directory 2.8 true
analysis-core 1.95 true
ant 1.8 true
antisamy-markup-formatter 1.5 true
apache-httpcomponents-client-4-api 4.5.5-3.0 true
authentication-tokens 1.3 true
blueocean 1.7.1 true
blueocean-autofavorite 1.2.2 true
blueocean-bitbucket-pipeline 1.7.1 true
blueocean-commons 1.7.1 true
blueocean-config 1.7.1 true
blueocean-core-js 1.7.1 true
blueocean-dashboard 1.7.1 true
blueocean-display-url 2.2.0 true
blueocean-events 1.7.1 true
blueocean-git-pipeline 1.7.1 true
blueocean-github-pipeline 1.7.1 true
blueocean-i18n 1.7.1 true
blueocean-jira 1.7.1 true
blueocean-jwt 1.7.1 true
blueocean-personalization 1.7.1 true
blueocean-pipeline-api-impl 1.7.1 true
blueocean-pipeline-editor 1.7.1 true
blueocean-pipeline-scm-api 1.7.1 true
blueocean-rest 1.7.1 true
blueocean-rest-impl 1.7.1 true
blueocean-web 1.7.1 true
bouncycastle-api 2.16.3 true
branch-api 2.0.20 true
build-blocker-plugin 1.7.3 true
built-on-column 1.1 true
cloudbees-bitbucket-branch-source 2.2.12 true
cloudbees-folder 6.5.1 true
command-launcher 1.2 true
conditional-buildstep 1.3.6 true
configurationslicing 1.47 true
credentials 2.1.18 true
credentials-binding 1.16 true
date-parameter 0.0.3 true
display-url-api 2.2.0 true
docker-commons 1.13 true
docker-java-api 3.0.14 true
docker-plugin 1.1.4 true
docker-workflow 1.17 true
durable-task 1.22 true
email-ext 2.62 true
extended-choice-parameter 0.76 true
external-monitor-job 1.7 true
ez-templates 1.3.2 true
favorite 2.3.2 true
flexible-publish 0.15.2 true
git 3.9.1 true
git-client 2.7.2 true
git-server 1.7 true
github 1.29.2 true
github-api 1.92 true
github-branch-source 2.3.6 true
gitlab-plugin 1.5.8 true
global-variable-string-parameter 1.2 true
handlebars 1.1.1 true
handy-uri-templates-2-api 2.1.6-1.0 true
hidden-parameter 0.0.4 true
htmlpublisher 1.16 true
http_request 1.8.22 true
icon-shim 2.0.3 true
jackson2-api 2.8.11.3 true
javadoc 1.4 true
jdk-tool 1.1 true
jenkins-design-language 1.7.1 true
jira 3.0.0 true
jquery 1.12.4-0 true
jquery-detached 1.2.1 true
jsch 0.1.54.2 true
junit 1.24 true
ldap 1.20 true
mailer 1.21 true
mapdb-api 1.0.9.0 true
matrix-auth 2.3 true
matrix-project 1.13 true
maven-plugin 3.1.2 true
mercurial 2.4 true
metrics 4.0.2.2 true
momentjs 1.1.1 true
msbuild 1.29 true
multiple-scms 0.6 true
nodelabelparameter 1.7.2 true
pagerduty 0.3.0 true
pam-auth 1.3 true
parameterized-scheduler 0.6.2 true
parameterized-trigger 2.35.2 true
pipeline-build-step 2.7 true
pipeline-graph-analysis 1.7 true
pipeline-input-step 2.8 true
pipeline-milestone-step 1.3.1 true
pipeline-model-api 1.3.1 true
pipeline-model-declarative-agent 1.1.1 true
pipeline-model-definition 1.3.1 true
pipeline-model-extensions 1.3.1 true
pipeline-rest-api 2.10 true
pipeline-stage-step 2.3 true
pipeline-stage-tags-metadata 1.3.1 true
pipeline-stage-view 2.10 true
plain-credentials 1.4 true
powershell 1.3 true
pubsub-light 1.12 true
role-strategy 2.8.1 true
run-condition 1.0 true
schedule-build 0.5.1 true
scm-api 2.2.7 true
script-security 1.44 true
scriptler 2.9 true
sse-gateway 1.15 true
ssh-credentials 1.14 true
ssh-slaves 1.26 true
structs 1.14 true
subversion 2.11.1 true
token-macro 2.5 true
translation 1.16 true
uno-choice 2.1 true
variant 1.1 true
warnings 4.68 true
windows-slaves 1.3.1 true
workflow-aggregator 2.5 true
workflow-api 2.28 true
workflow-basic-steps 2.9 true
workflow-cps 2.54 true
workflow-cps-global-lib 2.9 true
workflow-durable-task-step 2.19 true
workflow-job 2.23 true
workflow-multibranch 2.20 true
workflow-scm-step 2.6 true
workflow-step-api 2.16 true
workflow-support 2.19 trueJenkins version: 2.134 Plugins: ace-editor 1.1 true active-directory 2.8 true analysis-core 1.95 true ant 1.8 true antisamy-markup-formatter 1.5 true apache-httpcomponents-client-4-api 4.5.5-3.0 true authentication-tokens 1.3 true blueocean 1.7.1 true blueocean-autofavorite 1.2.2 true blueocean-bitbucket-pipeline 1.7.1 true blueocean-commons 1.7.1 true blueocean-config 1.7.1 true blueocean-core-js 1.7.1 true blueocean-dashboard 1.7.1 true blueocean-display-url 2.2.0 true blueocean-events 1.7.1 true blueocean-git-pipeline 1.7.1 true blueocean-github-pipeline 1.7.1 true blueocean-i18n 1.7.1 true blueocean-jira 1.7.1 true blueocean-jwt 1.7.1 true blueocean-personalization 1.7.1 true blueocean-pipeline-api-impl 1.7.1 true blueocean-pipeline-editor 1.7.1 true blueocean-pipeline-scm-api 1.7.1 true blueocean-rest 1.7.1 true blueocean-rest-impl 1.7.1 true blueocean-web 1.7.1 true bouncycastle-api 2.16.3 true branch-api 2.0.20 true build-blocker-plugin 1.7.3 true built-on-column 1.1 true cloudbees-bitbucket-branch-source 2.2.12 true cloudbees-folder 6.5.1 true command-launcher 1.2 true conditional-buildstep 1.3.6 true configurationslicing 1.47 true credentials 2.1.18 true credentials-binding 1.16 true date-parameter 0.0.3 true display-url-api 2.2.0 true docker-commons 1.13 true docker-java-api 3.0.14 true docker-plugin 1.1.4 true docker-workflow 1.17 true durable-task 1.22 true email-ext 2.62 true extended-choice-parameter 0.76 true external-monitor-job 1.7 true ez-templates 1.3.2 true favorite 2.3.2 true flexible-publish 0.15.2 true git 3.9.1 true git-client 2.7.2 true git-server 1.7 true github 1.29.2 true github-api 1.92 true github-branch-source 2.3.6 true gitlab-plugin 1.5.8 true global-variable-string-parameter 1.2 true handlebars 1.1.1 true handy-uri-templates-2-api 2.1.6-1.0 true hidden-parameter 0.0.4 true htmlpublisher 1.16 true http_request 1.8.22 true icon-shim 2.0.3 true jackson2-api 2.8.11.3 true javadoc 1.4 true jdk-tool 1.1 true jenkins-design-language 1.7.1 true jira 3.0.0 true jquery 1.12.4-0 true jquery-detached 1.2.1 true jsch 0.1.54.2 true junit 1.24 true ldap 1.20 true mailer 1.21 true mapdb-api 1.0.9.0 true matrix-auth 2.3 true matrix-project 1.13 true maven-plugin 3.1.2 true mercurial 2.4 true metrics 4.0.2.2 true momentjs 1.1.1 true msbuild 1.29 true multiple-scms 0.6 true nodelabelparameter 1.7.2 true pagerduty 0.3.0 true pam-auth 1.3 true parameterized-scheduler 0.6.2 true parameterized-trigger 2.35.2 true pipeline-build-step 2.7 true pipeline-graph-analysis 1.7 true pipeline-input-step 2.8 true pipeline-milestone-step 1.3.1 true pipeline-model-api 1.3.1 true pipeline-model-declarative-agent 1.1.1 true pipeline-model-definition 1.3.1 true pipeline-model-extensions 1.3.1 true pipeline-rest-api 2.10 true pipeline-stage-step 2.3 true pipeline-stage-tags-metadata 1.3.1 true pipeline-stage-view 2.10 true plain-credentials 1.4 true powershell 1.3 true pubsub-light 1.12 true role-strategy 2.8.1 true run-condition 1.0 true schedule-build 0.5.1 true scm-api 2.2.7 true script-security 1.44 true scriptler 2.9 true sse-gateway 1.15 true ssh-credentials 1.14 true ssh-slaves 1.26 true structs 1.14 true subversion 2.11.1 true token-macro 2.5 true translation 1.16 true uno-choice 2.1 true variant 1.1 true warnings 4.68 true windows-slaves 1.3.1 true workflow-aggregator 2.5 true workflow-api 2.28 true workflow-basic-steps 2.9 true workflow-cps 2.54 true workflow-cps-global-lib 2.9 true workflow-durable-task-step 2.19 true workflow-job 2.23 true workflow-multibranch 2.20 true workflow-scm-step 2.6 true workflow-step-api 2.16 true workflow-support 2.19 true
Passing a map literal value to a custom step function inside of a shared library appears to cause an "UnsupportedOperationException" and gives the following error message
BUG! exception in phase 'semantic analysis' in source unit 'WorkflowScript' The lookup for foo.Foo caused a failed compilaton. There should not have been any compilation from this call.
I've reproduced this error for the following toy case:
Jenkinsfile:
/* Import the utility library that contains the Foo class. */ @Library('jenkins-build-utilities@debug') import foo.Foo def fooObj = new Foo(this) node('system') { stage('FooHello') { fooObj.sayHello() } }
Foo class in shared library:
// src/foo/Foo.groovy package foo class Foo implements Serializable { private def jenkins = null Foo(jenkinsfile) { this.jenkins = jenkinsfile } public def sayHello() { customEcho [message: "Hello from Foo!"] } public def customEcho(arg) { jenkins.echo arg.message } }
Note that this code only throws an exception when a literal map value is passed to customEcho. If I rewrite the method sayHello as given below, then no exception occurs:
// This version of sayHello will work and will print "Hello from Foo!" to the // console. public def sayHello() { def mapVariable = [message: "Hello from Foo!"] customEcho mapVariable }
Finally, I want to mention that we are pretty sure that the original code, which was directly passing literal map values to another method, was working in prior versions of Jenkins and the Pipeline: Groovy plugin. I've tried reverting the versions of both Jenkins and the plugin and this bug exists in the following versions:
Jenkins 2.124 - 2.134
Pipeline: Groovy plugin 2.53 - 2.54
I was not able to find a prior version in which this bug disappears, but I'm thinking that this might be caused by the Pipeline: Groovy plugin since that was recently upgraded several versions.
Console Output from failing example:
java.lang.UnsupportedOperationException
at com.cloudbees.groovy.cps.CpsTransformer.visitMapEntryExpression(CpsTransformer.java:944)
at org.codehaus.groovy.ast.expr.MapEntryExpression.visit(MapEntryExpression.java:39)
at com.cloudbees.groovy.cps.CpsTransformer.visit(CpsTransformer.java:346)
at com.cloudbees.groovy.cps.CpsTransformer$24.run(CpsTransformer.java:834)
at com.cloudbees.groovy.cps.CpsTransformer.makeChildren(CpsTransformer.java:435)
at com.cloudbees.groovy.cps.CpsTransformer.makeNode(CpsTransformer.java:398)
at com.cloudbees.groovy.cps.CpsTransformer.visitBinaryExpression(CpsTransformer.java:829)
at org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
at com.cloudbees.groovy.cps.CpsTransformer.visit(CpsTransformer.java:346)
at com.cloudbees.groovy.cps.CpsTransformer.visitExpressionStatement(CpsTransformer.java:577)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
at com.cloudbees.groovy.cps.CpsTransformer.visit(CpsTransformer.java:346)
at com.cloudbees.groovy.cps.CpsTransformer.visit(CpsTransformer.java:352)
at com.cloudbees.groovy.cps.CpsTransformer$5.run(CpsTransformer.java:503)
at com.cloudbees.groovy.cps.CpsTransformer.makeChildren(CpsTransformer.java:435)
at com.cloudbees.groovy.cps.CpsTransformer.makeNode(CpsTransformer.java:398)
at com.cloudbees.groovy.cps.CpsTransformer.visitBlockStatement(CpsTransformer.java:500)
at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
at com.cloudbees.groovy.cps.CpsTransformer.visit(CpsTransformer.java:346)
at com.cloudbees.groovy.cps.CpsTransformer$2.run(CpsTransformer.java:377)
at com.cloudbees.groovy.cps.CpsTransformer.makeChildren(CpsTransformer.java:435)
at com.cloudbees.groovy.cps.CpsTransformer.makeNode(CpsTransformer.java:398)
at com.cloudbees.groovy.cps.CpsTransformer.visitWithSafepoint(CpsTransformer.java:363)
at com.cloudbees.groovy.cps.CpsTransformer.visitMethod(CpsTransformer.java:222)
at com.cloudbees.groovy.cps.CpsTransformer.call(CpsTransformer.java:132)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1065)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:254)
at groovy.lang.GroovyClassLoader.recompile(GroovyClassLoader.java:761)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:718)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:787)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell$TimingLoader.loadClass(CpsGroovyShell.java:158)
at java.lang.ClassLoader.loadClass(Unknown Source)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:677)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:545)
at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:185)
at org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:170)
at org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:126)
at org.codehaus.groovy.control.ResolveVisitor.resolveToOuter(ResolveVisitor.java:676)
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:313)
at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1236)
at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:176)
at org.codehaus.groovy.control.CompilationUnit$12.call(CompilationUnit.java:663)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:943)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:554)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:131)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:125)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:560)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:521)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:330)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:254)
at groovy.lang.GroovyClassLoader.recompile(GroovyClassLoader.java:761)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:718)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:787)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell$TimingLoader.loadClass(CpsGroovyShell.java:158)
at java.lang.ClassLoader.loadClass(Unknown Source)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:677)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:545)
at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:185)
Caused: BUG! exception in phase 'semantic analysis' in source unit 'WorkflowScript' The lookup for foo.Foo caused a failed compilaton. There should not have been any compilation from this call.
at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:190)
at org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:170)
at org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:126)
at org.codehaus.groovy.control.ResolveVisitor.resolveToOuter(ResolveVisitor.java:676)
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:313)
at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1236)
at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:176)
at org.codehaus.groovy.control.CompilationUnit$12.call(CompilationUnit.java:663)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:943)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:554)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:131)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:125)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:560)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:521)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:330)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE