Hi Dan,
Why break out of the groovy code at that point? Why not just stay in groovy
mode?
<% if(build.result==hudson.model.Result.SUCCESS) { %>
CONSOLE OUTPUT
<% build.getLog(1000).each() { line ->
formatLine(line)
}%>
Does that not work?
Thanks,
slide
On Wed, Nov 27, 2013 at 2:28 PM, Daniel Barker <[email protected]> wrote:
> Hey Slide,
>
> Thanks for the rapid response.
>
> This is horribly embarrassing. I tried to delay posting here for several
> days while I worked on this on and off, but I finally got it to work. It
> essentially worked exactly as it was supposed to. I will post my solution
> for Groovy below and one gotcha.
>
> The below code works correctly with the import. I haven't tried it without
> the import, but I was under the impression based off of previous research
> that imports didn't work. There is a gotcha that caused me a problem. The
> line "formatLine(line)" will not work in place of "${formatLine(line)}"
> regardless of how the angle bracket and percent signs are placed. I'm not
> really sure why it won't work, but it didn't for this.
>
> <% import java.util.regex.*; %>
>
> <%def formatLine(line)
> {
> braceMatcher = (line =~ /\[/);
> line = braceMatcher.replaceAll("");
>
> braceMatcher = (line =~ /\]/);
> line = braceMatcher.replaceAll("");
> } %>
>
> <% if(build.result==hudson.model.Result.SUCCESS) { %>
> CONSOLE OUTPUT
> <% build.getLog(1000).each() { line -> %>
> ${formatLine(line)}
> <% } %>
>
>
> On Wed, Nov 27, 2013 at 1:12 PM, Slide <[email protected]> wrote:
>
>> Can you give examples of what you have tried? I would recommend using
>> Groovy for sure, Jelly is painful at best.
>>
>>
>> On Wed, Nov 27, 2013 at 11:52 AM, Daniel Barker <[email protected]>wrote:
>>
>>> At work, we use a social networking system based on Jive. We have the
>>> ability to email to the service, but it has sever limitations on what
>>> characters can be included. We currently manipulate the output via the
>>> actual programs we are running, but we want a plugin type solution for
>>> Jenkins. We need to be able to remove/replace characters like [, ], {, },
>>> --, etc. We want to output the entire log or parts of it depending on the
>>> particular job.
>>>
>>>
>>> I have tried both the Jelly script and Groovy script methods, but
>>> neither seem to support the parts I need. In Jelly, I used fn:replace, and
>>> in Groovy, I tried to use a matcher. I haven't been able to figure out what
>>> the limitations are for these scripts with this extension or how to extend
>>> them if possible.
>>>
>>>
>>> I have thought about adding some functionality to the actual plugin or
>>> creating a new plugin that can do some pre-processing. The first option
>>> wouldn't be too hard, but it has obvious drawbacks within the bounds of
>>> modifying well-established, working code. The second option would require a
>>> great deal more effort for limited functionality. Any advice would be much
>>> appreciated. Thanks in advance.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Jenkins Developers" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>
>> --
>> Website: http://earl-of-code.com
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Jenkins Developers" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/jenkinsci-dev/ABg9iqvDSVM/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
Website: http://earl-of-code.com
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.