[JIRA] [log-parser-plugin] (JENKINS-32866) Log Parser Plugin does not parse Pipeline console outputs

437 views
Skip to first unread message

recena@gmail.com (JIRA)

unread,
Feb 12, 2016, 11:20:01 AM2/12/16
to jenkinsc...@googlegroups.com
Manuel Jesús Recena Soto updated an issue
 
Jenkins / Bug JENKINS-32866
Log Parser Plugin does not parse Pipeline console outputs
Change By: Manuel Jesús Recena Soto
Summary: Log Parser Plugin does not parse  workflow  Pipeline  console outputs
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

jglick@cloudbees.com (JIRA)

unread,
Feb 18, 2016, 9:15:07 AM2/18/16
to jenkinsc...@googlegroups.com

sorin.sbarnea@gmail.com (JIRA)

unread,
Apr 1, 2016, 3:52:01 PM4/1/16
to jenkinsc...@googlegroups.com
Sorin Sbarnea commented on Bug JENKINS-32866
 
Re: Log Parser Plugin does not parse Pipeline console outputs

Is this working? It would be quite useful to enable it for pipelines, we are all moving to them now.

jenkins@mockies.de (JIRA)

unread,
May 12, 2016, 2:25:03 PM5/12/16
to jenkinsc...@googlegroups.com

IMHO this is the expected behavior. The log parser step only has access to the log to the point where it is called. If called in "finally" (as some sort of post build actions in the pipeline build) this works well:

try {
  node {
       echo 'Error: oh no'
  }
} finally {
  node {
   step([$class: 'LogParserPublisher', parsingRulesPath: '/var/lib/jenkins/jenkins-rule-logparser', useProjectRule: false])
  }
}

In order to fail the build add "failBuildOnError: true" (and maybe you need another try/catch block around the log parser step to catch the error and set the build result to FAILURE explicitly (not tested)).

prince96raj@gmail.com (JIRA)

unread,
Apr 30, 2018, 2:54:02 AM4/30/18
to jenkinsc...@googlegroups.com
Prince Raj Kumar updated an issue
 
Change By: Prince Raj Kumar
Priority: Minor Major
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

jeoppy@gmail.com (JIRA)

unread,
Aug 2, 2018, 5:16:02 AM8/2/18
to jenkinsc...@googlegroups.com
danniel hughes commented on Bug JENKINS-32866
 
Re: Log Parser Plugin does not parse Pipeline console outputs

so, assuming the file of rules is {{/var/lib/jenkins/ParsingRuleFiles/Generic_Verify }}than fail a build it should be something like : 

 finally {
        node('<same agent you run on >') {
            try {
                     step([$class: 'LogParserPublisher', parsingRulesPath: '/var/lib/jenkins/ParsingRuleFiles/Generic_Verify', useProjectRule: false, *failBuildOnError: true, unstableOnWarning: true*])
         } catch(all) {
{{          print "E LogParserPublisher failed: \n" +all }}
         }
       }//node
}//finally

tested - and working , me very happy

This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

jeoppy@gmail.com (JIRA)

unread,
Aug 2, 2018, 5:17:02 AM8/2/18
to jenkinsc...@googlegroups.com
danniel hughes edited a comment on Bug JENKINS-32866
so, assuming the file of rules is {{{color:#00875a}/var/lib/jenkins/ParsingRuleFiles/Generic_Verify {color}}}than to fail a build , it should be something like : 
{quote}{{ finally {}}
{{        node('_<same agent you run on >_') {}}
{{            try {}}
{{                     step([$class: '{color:#00875a}LogParserPublisher{color}', parsingRulesPath: '{color:#00875a}/var/lib/jenkins/ParsingRuleFiles/Generic_Verify{color}', useProjectRule: false, *{color:#403294}failBuildOnError{color}: {color:#de350b}true{color}, {color:#403294}unstableOnWarning{color}: {color:#de350b}true{color}*])}}
{{         } catch(all) {}}
{{          print "-E- LogParserPublisher failed: \n" +all }}
{{         }}}
{{       }//node}}
{{}//finally}}

{quote}
{quote}{{tested - and working , me very happy :)}}

{quote}

jeoppy@gmail.com (JIRA)

unread,
Aug 2, 2018, 5:17:04 AM8/2/18
to jenkinsc...@googlegroups.com
danniel hughes edited a comment on Bug JENKINS-32866
so, assuming the file of rules is {{{color:#00875a}/var/lib/jenkins/ParsingRuleFiles/Generic_Verify {color}}}than to fail a build, it should be something like : 

{quote}{{ finally {}}
{{        node('_<same agent you run on >_') {}}
{{            try {}}
{{                     step([$class: '{color:#00875a}LogParserPublisher{color}', parsingRulesPath: '{color:#00875a}/var/lib/jenkins/ParsingRuleFiles/Generic_Verify{color}', useProjectRule: false, *{color:#403294}failBuildOnError{color}: {color:#de350b}true{color}, {color:#403294}unstableOnWarning{color}: {color:#de350b}true{color}*])}}
{{         } catch(all) {}}
\ {{          print " -E- ERROR: LogParserPublisher failed: \n" +all }}

{{         }}}
{{       }//node}}
{{}//finally}}
{quote}
{quote}{{tested - and working , me very happy :)}}
{quote}

jeoppy@gmail.com (JIRA)

unread,
Aug 2, 2018, 5:18:02 AM8/2/18
to jenkinsc...@googlegroups.com
danniel hughes edited a comment on Bug JENKINS-32866
so, assuming the file of rules is {{{color:#00875a}/var/lib/jenkins/ParsingRuleFiles/Generic_Verify {color}}}than to fail a build, it should be something like : 
{quote}{{ finally {}}
{{        node('_<same agent you run on >_') {}}
{{            try {}}
{{                     step([$class: '{color:#00875a}LogParserPublisher{color}', parsingRulesPath: '{color:#00875a}/var/lib/jenkins/ParsingRuleFiles/Generic_Verify{color}', useProjectRule: false, *{color:#403294}failBuildOnError{color}: {color:#de350b}true{color}, {color:#403294}unstableOnWarning{color}: {color:#de350b}true{color}*])}}
{{         } catch(all) {}}
\{{                       print "ERROR: LogParserPublisher failed: \n" +all }}
{{         }}}
{{       }//node}}
{{}//finally}}
{quote}
{quote}{{tested - and working , me very happy :)}}
{quote}

dublawrence@gmail.com (JIRA)

unread,
Aug 3, 2018, 11:36:02 AM8/3/18
to jenkinsc...@googlegroups.com

How could I get to work if I have multiple stages, like the following and I want it to parse everything

pipeline {
    agent { label 'testmachine'}
    stages {
        stage('Level 1'){
            steps {
                      bat '''
                          call "%VS120COMNTOOLS%\\vsvars32.bat"
                          devenv testlevel1.sln /build "Profile|x64"'''
        }
        stage('Level 2'){
            steps {
                     bat '''
                         call "%VS120COMNTOOLS%\\vsvars32.bat" 
                         devenv testlevel2.sln /build "Profile|x64"
                         '''
       }
   }
}

 

 

 

dublawrence@gmail.com (JIRA)

unread,
Aug 3, 2018, 11:38:02 AM8/3/18
to jenkinsc...@googlegroups.com
Lawrence Dubé edited a comment on Bug JENKINS-32866
How could I get to work if I have multiple stages, like the following and I want it to parse everything
{code:java}

pipeline {
    agent { label 'testmachine'}
    stages {
        stage('Level 1'){
            steps {
                     bat '''
                     call "%VS120COMNTOOLS%\\vsvars32.bat"
                     devenv testlevel1.sln /build "Profile|x64"'''
        }
        }
        stage('Level 2'){
            steps {
                     bat '''
                     call "%VS120COMNTOOLS%\\vsvars32.bat"
                     devenv testlevel2.sln /build "Profile|x64"

                     '''
       }
   }
}

}
{code}
 

 

 

pierre.marton@clearstream.com (JIRA)

unread,
Aug 7, 2018, 8:16:02 AM8/7/18
to jenkinsc...@googlegroups.com

The given solution works for all stages, you just need to set the parser as the last stage.

jakemdoran@gmail.com (JIRA)

unread,
Aug 15, 2018, 12:58:02 PM8/15/18
to jenkinsc...@googlegroups.com
Jake D commented on Bug JENKINS-32866

Can I ask if this is tailored for Declarative Pipelines?

pierre.marton@clearstream.com (JIRA)

unread,
Aug 21, 2018, 8:55:02 AM8/21/18
to jenkinsc...@googlegroups.com

You can of course

I don't see why it wouldn't work, just try.

mr.danielyan55@yahoo.com (JIRA)

unread,
Sep 30, 2018, 3:38:02 AM9/30/18
to jenkinsc...@googlegroups.com

Hi all!
In my pipeline i have problem. Job failed in this stage(log-parser)

pipeline {
agent

{ label 'master' }

triggers

{ pollSCM('* * * * *') }

environment

{ ANSIBLE_CONFIG = "Jenkins-LTS/ansible.cfg" }

..........

stage('Log-parser') {
steps {
logparser([$class: 'LogParserPublisher',
parsingRulesPath: '/var/lib/jenkins/minimal-rules',
useProjectRule: false,
failBuildOnError: true,
unstableOnWarning: false,
Logparsergraphs: true ])

error:
java.lang.NoSuchMethodError: No such DSL method 'logparser' found among steps ....... and more string

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

pierre.marton@clearstream.com (JIRA)

unread,
Oct 1, 2018, 8:07:02 AM10/1/18
to jenkinsc...@googlegroups.com

Well what about the end of the stage?

} catch(all)

{ print "ERROR: LogParserPublisher failed: \n" +all }

}
}

Would be easier to help you if you put the all code in (at least the complete stage).

mr.danielyan55@yahoo.com (JIRA)

unread,
Oct 2, 2018, 4:54:04 PM10/2/18
to jenkinsc...@googlegroups.com

Hi! Thx for answer. her is cod

pipeline

{ agent \{ label 'master'}

triggers

{ pollSCM('* * * * *') }

environment

{ ANSIBLE_CONFIG = "Jenkins-LTS/ansible.cfg" }

stages{
stage('Checkout') {
steps

{ checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'Jenkins-LTS'], [$class: 'WipeWorkspace']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'fd864bf0-5e33-4cf1-a130-67ac2c22bf17', url: 'https://github.com/MRDO5/jenkins-lts.git']]]) }

}
stage('Deploy') {
parallel {
stage('Syntax check') {
steps {
ansiColor('gnome-terminal')

{ ansiblePlaybook become: true, colorized: true, credentialsId: '7980492c-7fa3-41b6-9c8e-b44d3f7ce236', extras: '--syntax-check' , inventory: 'Jenkins-LTS/inventory', playbook: 'Jenkins-LTS/main.yml' }

}
}
stage('Check provision for virtual machines') {
steps {
ansiColor('gnome-terminal')

{ ansiblePlaybook become: true, colorized: true, credentialsId: '7980492c-7fa3-41b6-9c8e-b44d3f7ce236', installation: 'ansible', inventory: 'Jenkins-LTS/inventory', playbook: 'Jenkins-LTS/main.yml' }

}
}
}
}
stage('Log-parser') {
steps

{ logparser([$class: 'LogParserPublisher', parsingRulesPath: '/var/lib/jenkins/minimal-rules', useProjectRule: false, failBuildOnError: true, unstableOnWarning: false, Logparsergraphs: true ]) }

}
}

 

pierre.marton@clearstream.com (JIRA)

unread,
Oct 5, 2018, 12:23:02 PM10/5/18
to jenkinsc...@googlegroups.com

Well I'm using 2 differents ways for pipeline code:

in Jenkins job as last stage:

stage("Parser") {
node('master') {
try {
step([$class: 'LogParserPublisher', parsingRulesPath: 'YOUR_PARSING_FILE', useProjectRule: false, failBuildOnError: true, unstableOnWarning: true])
{color:#FF0000}} catch(all) {{color}


print "ERROR: LogParserPublisher failed: \n" +all
}
}
}

in Jenkinsfile:
@Library('pipelib@master')
import […]

timestamps {
try { // For finally LogParserPublisher

[…]

{color:#FF0000}} finally {{color}
node

{ step([$class: 'LogParserPublisher', parsingRulesPath: 'YOUR_PARSING_FILE', useProjectRule: false]) }

{color:#FF0000}}
}

I've put in red the only difference with your code.

Also not sure how Ansible affects it as I'm not using it.

pierre.marton@clearstream.com (JIRA)

unread,
Oct 5, 2018, 12:28:03 PM10/5/18
to jenkinsc...@googlegroups.com
Pierre Marton edited a comment on Bug JENKINS-32866
Well I'm using 2 differents different ways for pipeline code:


in Jenkins job as last stage:

stage("Parser") {
node('master') {
{color:#FF0000} try   { {color}
step([$class: 'LogParserPublisher', parsingRulesPath: 'YOUR_PARSING_FILE', useProjectRule: false, failBuildOnError: true, unstableOnWarning: true])

{color:#FF0000
} }

catch(all) {{color}

{ color:#FF0000} print "ERROR: LogParserPublisher failed: \n" +all {color }
{color:#FF0000} }{color}
}
}

in Jenkinsfile:
@Library('pipelib@master')
import […]


timestamps {
{color:#FF0000} try

{ // For finally LogParserPublisher {color}

[…] }

{color:#FF0000}} finally { {color}
node {
step([$class: 'LogParserPublisher', parsingRulesPath: 'YOUR_PARSING_FILE', useProjectRule: false])
}
{color:#FF0000 } }{color}
}

I've put in red the The only difference with your code . is that your parsing step is missing
try {} / catch(all) {}

or try {} / finally {}

Also not sure how Ansible affects it as I'm not using it.

hypery2k@web.de (JIRA)

unread,
Jul 3, 2019, 10:51:35 PM7/3/19
to jenkinsc...@googlegroups.com
Martin Reinhardt assigned an issue to Martin Reinhardt
 
Change By: Martin Reinhardt
Assignee: Manuel Recena Soto Martin Reinhardt
Reply all
Reply to author
Forward
0 new messages