[workflow-plugin] Warnings plugin not parsing console?

119 views
Skip to first unread message

Craig Rodrigues

unread,
Dec 22, 2015, 9:22:01 AM12/22/15
to Jenkins Users, Ullrich Hafner, Leon Leon
Hi,

I installed:
   workflow-plugin 1.12
   warnings plugin 4.51
    jenkins 1.641

I used the workflow snipper generator to generate code to
 invoke the warnings plugin.

I came up with the following example:

node {
    writeFile(file: "a.c", text: '''
#include <sys/types.h>
#include <stdlib.h>

void
func1(void)
{
}

int
main(int argc, char *argv[])
{
    char *a;
    int64_t *b;
    b = (int64_t *)a;
    printf("Hi");
    printf(NULL);
    printf("%s %d\\n", "35");
    func1();
}
'''
    )
    sh "cc -Wall -W -Wcast-align -o output a.c"

    step([$class: 'WarningsPublisher',
         canComputeNew: false,
         canResolveRelativePaths: false,
         consoleParsers: [[parserName: 'Clang (LLVM based)']],
         defaultEncoding: '',
         excludePattern: '',
         healthy: '',
         includePattern: '',
         messagesPattern: '',
         unHealthy: ''])
}

This code example triggers warnings with the clang compiler,
which I can see in the log, but the warnings plugin is reporting 0 warnings.

Any ideas how I can fix this?
Thanks.
--
Craig
consoleText.txt
nowarnings.txt

Ullrich Hafner

unread,
Dec 22, 2015, 12:37:54 PM12/22/15
to jenkins...@googlegroups.com
Hmm, seems that the workflow plug-in does not handle the console in the same way as for standard jobs. I’m not sure if this is a bug in the workflow plug-in or in the workflow implementation of the warnings-plug-in.

You can try to pipe the compiler output to a file and then parse the file.
 
Am 22.12.2015 um 18:27 schrieb Craig Rodrigues <rod...@FreeBSD.org>:

Hi,

Without workflow it works.
I copied and pasted the logs from my screen into two different files,
because they were on two different screens.

--
Craig


On Tue, Dec 22, 2015 at 9:20 AM, Ullrich Hafner <ullrich...@gmail.com> wrote:
The warnings should be parsed correctly by the parser. Maybe the input is not yet accessible when the warnings plugin runs.

Why is your log (or output) in two different files? (consoleText.txt and no warnings.txt))?

Did you try the same without workflow?
> <consoleText.txt><nowarnings.txt>



signature.asc

Craig Rodrigues

unread,
Dec 22, 2015, 1:21:35 PM12/22/15
to Jenkins Users, Ullrich Hafner
Hi,

Piping to a file works, but I don't want to do that, because I want the output to appear
in the normal Jenkins job console output screen.  Your guess was right, in that the output
doesn't seem to be fully available to the warnings plugin at the time that I called it.

I seemed to have fixed the problem by putting a sleep in between the sh invocation
and warnings plugin invocation like this:


node {
    writeFile(file: "a.c", text: '''
#include <sys/types.h>
#include <stdlib.h>

void
func1(void)
{
}

int
main(int argc, char *argv[])
{
    char *a;
    int64_t *b;
    b = (int64_t *)a;
    printf("Hi");
    printf(NULL);
    printf("%s %d\\n", "35");
    func1();
}
'''
    )
    sh "cc -Wall -W -Wcast-align -o output a.c"
    sleep 2

    step([$class: 'WarningsPublisher',
         canComputeNew: true,
         canResolveRelativePaths: false,
         consoleParsers: [[parserName: 'Clang (LLVM based)']],
         defaultEncoding: '',
         excludePattern: '',
         healthy: '',
         includePattern: '',
         messagesPattern: '',
         unHealthy: ''])
}

It is not ideal, but it seems to work for me.  Is there a way to flush the console output
before invoking the warnings plugin?  That would be "better" than a sleep.

--
Craig
Reply all
Reply to author
Forward
0 new messages