[JIRA] (JENKINS-58501) Metaprogramming with InvokerHelper and MethodMissing triggers CPS MisMatch log

22 views
Skip to first unread message

steventerrana@gmail.com (JIRA)

unread,
Jul 15, 2019, 3:32:02 PM7/15/19
to jenkinsc...@googlegroups.com
Steven Terrana created an issue
 
Jenkins / Task JENKINS-58501
Metaprogramming with InvokerHelper and MethodMissing triggers CPS MisMatch log
Issue Type: Task Task
Assignee: Unassigned
Components: workflow-cps-plugin
Created: 2019-07-15 19:31
Environment: workflow-cps:2.7.1
Priority: Minor Minor
Reporter: Steven Terrana

I currently work on a plugin ([Templating Engine Plugin|https://plugins.jenkins.io/templating-engine]) that relies on being able to leverage metaprogramming techniques such as using snippets like:
"

InvokerHelper.getMetaClass(impl).invokeMethod(impl, methodName, args)

or ``methodMissing`` to control program flow. 

 

The introduction of logging CPS mismatched method names has resulted in continuously logging these occurences. 

 

Is there a way to work around the CPS mismatch logs for instances such as leveraging ``methodMissing`` or the ``InvokerHelper`` to dynamically execute methods? 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

steventerrana@gmail.com (JIRA)

unread,
Jul 15, 2019, 3:32:02 PM7/15/19
to jenkinsc...@googlegroups.com
Steven Terrana updated an issue
Change By: Steven Terrana
I currently work on a plugin ([Templating Engine Plugin|[https://plugins.jenkins.io/templating-engine]]) that relies on being able to leverage metaprogramming techniques such as using snippets like:
"
{code:java}
InvokerHelper.getMetaClass(impl).invokeMethod(impl, methodName, args)
{code}
or
`` * methodMissing `` to control program flow. 

 

The introduction of logging CPS mismatched method names has resulted in continuously logging these
occurences occurrences

 

Is there a way to work around the CPS mismatch logs for instances such as leveraging
`` * methodMissing `` or the `` * InvokerHelper `` to dynamically execute methods? 

steventerrana@gmail.com (JIRA)

unread,
Jul 15, 2019, 3:33:02 PM7/15/19
to jenkinsc...@googlegroups.com
Steven Terrana updated an issue
I currently work on a plugin ([Templating Engine Plugin|[https://plugins.jenkins.io/templating-engine]]) that relies on being able to leverage metaprogramming techniques such as using snippets like:
"
{code:java}
InvokerHelper.getMetaClass(impl).invokeMethod(impl, methodName, args)
{code}
or *methodMissing* to control program flow. 

 

The introduction of logging CPS mismatched method names has resulted in continuously logging these occurrences. 

 

Is there a way to work around the CPS mismatch logs for instances such as leveraging *methodMissing* or the *InvokerHelper* to dynamically execute methods? 


 

*methodMissing log:*
{noformat}
expected to call org.boozallen.plugins.jte.binding.injectors.StepWrapper.doThing but wound up catching org.boozallen.plugins.jte.binding.injectors.StepWrapper.methodMissing; see: https://jenkins.io/redirect/pipeline-cps-method-mismatches/
expected to call org.boozallen.plugins.jte.hooks.Hooks.invoke but wound up catching script15632181891161818312862.call; see: https://jenkins.io/redirect/pipeline-cps-method-mismatches/{noformat}
*InvokerHelper log:*
{code:java}
expected to call groovy.lang.ExpandoMetaClass.invokeMethod but wound up catching script1563218188258613791966.doThing; see: https://jenkins.io/redirect/pipeline-cps-method-mismatches/
{code}

steventerrana@gmail.com (JIRA)

unread,
Jul 15, 2019, 3:34:02 PM7/15/19
to jenkinsc...@googlegroups.com

steventerrana@gmail.com (JIRA)

unread,
Jul 15, 2019, 3:44:02 PM7/15/19
to jenkinsc...@googlegroups.com
Steven Terrana updated an issue
I currently work on a plugin ([Templating Engine Plugin|[https://plugins.jenkins.io/templating-engine]]) that relies on being able to leverage metaprogramming techniques such as using snippets like:
"

{code:java}
InvokerHelper.getMetaClass(impl).invokeMethod(impl, methodName, args)
{code}
or *methodMissing* to control program flow. 

 

The introduction of logging CPS mismatched method names has resulted in continuously logging these occurrences. 

 

Is there a way to work around the CPS mismatch logs for instances such as leveraging *methodMissing* or the *InvokerHelper* to dynamically execute methods? 

 

*methodMissing log:*
{noformat}
expected to call org.boozallen.plugins.jte.binding.injectors.StepWrapper.doThing but wound up catching org.boozallen.plugins.jte.binding.injectors.StepWrapper.methodMissing; see: https://jenkins.io/redirect/pipeline-cps-method-mismatches/
expected to call org.boozallen.plugins.jte.hooks.Hooks.invoke but wound up catching script15632181891161818312862.call; see: https://jenkins.io/redirect/pipeline-cps-method-mismatches/{noformat}
*InvokerHelper log:*
{code:java}
expected to call groovy.lang.ExpandoMetaClass.invokeMethod but wound up catching script1563218188258613791966.doThing; see: https://jenkins.io/redirect/pipeline-cps-method-mismatches/
{code}

steventerrana@gmail.com (JIRA)

unread,
Jul 15, 2019, 3:49:02 PM7/15/19
to jenkinsc...@googlegroups.com

 

Simplest example to reproduce: 

 
{code:java}
import org.codehaus.groovy.runtime.InvokerHelper
c = {
    println "doing a thing"
}
InvokerHelper.getMetaClass(c).invokeMethod(c, "call", null)
{code}
 

steventerrana@gmail.com (JIRA)

unread,
Jul 17, 2019, 11:04:08 AM7/17/19
to jenkinsc...@googlegroups.com

steventerrana@gmail.com (JIRA)

unread,
Jul 17, 2019, 11:04:08 AM7/17/19
to jenkinsc...@googlegroups.com
Steven Terrana edited a comment on Task JENKINS-58501
I have implemented an approach to solving this problem and opened a pull request: 

jglick@cloudbees.com (JIRA)

unread,
Jul 17, 2019, 11:31:02 AM7/17/19
to jenkinsc...@googlegroups.com

jglick@cloudbees.com (JIRA)

unread,
Jul 17, 2019, 11:32:05 AM7/17/19
to jenkinsc...@googlegroups.com

jglick@cloudbees.com (JIRA)

unread,
Jul 17, 2019, 11:32:06 AM7/17/19
to jenkinsc...@googlegroups.com

jglick@cloudbees.com (JIRA)

unread,
Jul 17, 2019, 11:32:06 AM7/17/19
to jenkinsc...@googlegroups.com
Jesse Glick started work on Bug JENKINS-58501
 
Change By: Jesse Glick
Status: Open In Progress

jglick@cloudbees.com (JIRA)

unread,
Jul 18, 2019, 1:03:03 PM7/18/19
to jenkinsc...@googlegroups.com
Jesse Glick commented on Bug JENKINS-58501
 
Re: Metaprogramming with InvokerHelper and MethodMissing triggers CPS MisMatch log

With workflow-cps #306, probably falls on me or Devin Nusbaum to play with a groovy-cps patch that would resolve the issue.

One thing I should have done initially, but neglected to, was write unit tests in groovy-cps for this. Quicker to iterate than the full functional tests in workflow-cps, though we need at least some of those as well, since “things happen” when a library is being used in a complex context.

steventerrana@gmail.com (JIRA)

unread,
Jul 18, 2019, 5:30:03 PM7/18/19
to jenkinsc...@googlegroups.com

dnusbaum@cloudbees.com (JIRA)

unread,
Aug 1, 2019, 4:16:03 PM8/1/19
to jenkinsc...@googlegroups.com
Devin Nusbaum updated Bug JENKINS-58501
 

A fix for this issue was just released in version 2.73 of Pipeline: Groovy Plugin.

Change By: Devin Nusbaum
Status: In Review Resolved
Resolution: Fixed
Released As: workflow-cps 2.73
Reply all
Reply to author
Forward
0 new messages