-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-26481] More clearly report problem passing closures to binary methods #15
Conversation
… a CPS-transformed closure to a binary method.
…ally requested a Closure, and is thus likely to try to call it.
} | ||
}); | ||
} | ||
|
||
@Ignore("TODO JENKINS-31314: calls writeFile just once, echoes null (i.e., return value of writeFile), then succeeds") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still fails with the same behavior.
🐝 Happy to see this! |
private final ClassLoader scriptLoader; | ||
|
||
public GroovyClassLoaderWhitelist(GroovyClassLoader scriptLoader) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not expect other plugins to have classes in the org.jenkinsci.plugins.workflow.cps package, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right.
🐝 if there is no compatibility risk |
re- 🐝 |
re 🐝 as well. |
Will wait to see if @kohsuke has any concerns about this. Obviously it passes local tests, but there is some risk of inadvertently failing legitimate, previously working calls. |
@kohsuke asks for confirmation that this does not break usages of closures in global libraries, and I guess I would add |
…s defined in load’d scripts.
And I checked that diff --git a/src/test/java/org/jenkinsci/plugins/workflow/cps/global/WorkflowLibRepositoryTest.java b/src/test/java/org/jenkinsci/plugins/workflow/cps/global/WorkflowLibRepositoryTest.java
index b814207..b1845b8 100644
--- a/src/test/java/org/jenkinsci/plugins/workflow/cps/global/WorkflowLibRepositoryTest.java
+++ b/src/test/java/org/jenkinsci/plugins/workflow/cps/global/WorkflowLibRepositoryTest.java
@@ -116,6 +116,7 @@ public class WorkflowLibRepositoryTest {
" body.resolveStrategy = Closure.DELEGATE_FIRST",
" body.delegate = config",
" body()",
+ " [config.title].each {x -> echo x}",
" echo 'title was '+config.title",
"}")
, "\n")); then it fails with the expected |
re-re-:bee:! |
… but test does pass now.
JENKINS-26481
Tries to improve diagnostics until cloudbees/groovy-cps#24 can be fixed.
Before this patch,
SerializationTest.eachClosure
fails with cryptic script behavior:Note that there is no error in the build, it just does not run correctly. After the patch, the build fails:
@reviewbybees esp. @kohsuke