Seems like there is more shit apart from the security!!! The if you are using the java file writer, in a distributed env it doesn't work. I can generate some nice xml's on the master but not in the slave. What a shame!
On Tue, Mar 21, 2017 at 4:01 PM, André Lanouette <[email protected]> wrote: > Hello, > > Sorry to hijack this thread, but I am attempting to use the MarkupBuilder > to generate POM aggregators project on the fly from my Jenkins Pipeline. > However, I am also having a security issue when instantiating the > MarkupBuilder: > > Scripts not permitted to use new groovy.xml.MarkupBuilder java.io.Writer > > > You say you have been able to override this. Would you be willing to share > with me how to achieve this? > > Thank you > > On Tuesday, November 15, 2016 at 12:24:48 PM UTC-5, David Karr wrote: >> >> In my Jenkinsfile, I'm trying to use MarkupBuilder to construct a simple >> XML message. I first discovered that there are default security >> restrictions preventing the use of this class, which I was able to override. >> >> Next, I'm seeing errors that make it seem like the "methodMissing" calls >> for XML elements within the MarkupBuilder DSL are going to the Pipeline DSL >> instead. I'm able to verify my method works in groovyConsole, but when I >> run the job in Jenkins, I get an error like this: >> >> java.lang.NoSuchMethodError: No such DSL method 'statement' found among >> steps [VersionNumber, archive, ... >> >> >> Where my method looks like this: >> def constructMessageXML(String qid, String qpassword, String contactID, >> String text, boolean isMeeting) { >> def writer = new StringWriter() >> MarkupBuilder mb = new MarkupBuilder(writer) >> mb.message (type:"contact.send.message", id:qid, password:qpassword, >> contactId:contactID) { >> statement (isMeeting ? [from:qid, to:contactID, text:text, type: >> "meeting"] : [from:qid, to:contactID, text:text]) {} >> } >> return writer.toString() >> } >> >> >> The list of steps from the error message are clearly from the Pipeline >> DSL, not the MarkupBuilder DSL. >> > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/jenkinsci-users/63d4680d-4ae5-4920-9a5c-5facb4486eee%40googlegroups. > com > <https://groups.google.com/d/msgid/jenkinsci-users/63d4680d-4ae5-4920-9a5c-5facb4486eee%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- Regards nirish okram -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPzcO4jsmMf2pcZGwto6h5JMbpSp2_B1St8hMFO2s0MZ0H%3DWOA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
