FindBugs Plugin issue with scripted pipeline

296 views
Skip to first unread message

Steffen Elste

unread,
Aug 21, 2017, 1:11:11 PM8/21/17
to Jenkins Users
Hi,
i've run into a problem with the FindBugs Plugin, and maybe this is a known issue and there's a workaround/fix.

Happens regardless of the OS - i have acccess to Windows 2008 Server and Ubuntu Linux - and from Jenkins 2.60 LTS upwards, FindBugs version is 4.71
To reproduce this problem i cloned a (Maven) test project originally created by Jessie Glick and modified it to run the FindBugs code analysis (https://github.com/selste/simple-maven-project-with-tests, Branch 'findbugs').

When i use declarative pipeline syntax, everything works as expected - and it doesn't matter whether i use the 'Jenkinsfile' or the 'Pipeline script' approach. After at least two successful builds the trend graph is displayed, as shown in the 'declarative.png' screenshot.
Switching to scripted pipeline syntax leads to a couple of strange effects (see 'scripted.png' screenshot):
  • the trend graph is displayed twice after at least two successful builds
  • the test coverage trend graph is displayed as well even though i did NOT configure this
Has someone else experienced this problem, and is there a workaround and/or fix available?
At the moment i'm pretty much stuck with scripted pipeline syntax, there's no easy way to convert all the projects to declarative syntax.
Cheers,

S. Elste
declarative.png
scripted.png

Ullrich Hafner

unread,
Aug 23, 2017, 5:27:39 PM8/23/17
to Jenkins Users
It is hard to guess if you do not share the script you use. Are you using the multibranch plug-in? (Then https://issues.jenkins-ci.org/browse/JENKINS-43155 might be related.)

I have several test cases using the scripted Jenkinsfile so it makes sense to strip down your script to see if I can reproduce it.

--
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 jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/c922166b-0ffd-4c5c-8a0e-c36a78025e5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<declarative.png><scripted.png>

signature.asc

Steffen Elste

unread,
Aug 25, 2017, 2:29:07 AM8/25/17
to Jenkins Users
Hi,
well, the Jenkinsfile for use with declarative pipeline and a Jenkinsfile.scripted for scripted pipeline are in the repository ... i probably should have mentioned this.
I had a look at the issue - doesn't really fit as in this case i'm not using a multibranch pipeline.

Scripted:
#!groovy

stage
'Checkout'
node
{
  wrap
([$class: 'TimestamperBuildWrapper']) {
    checkout
([$class: 'GitSCM', branches: [[name: 'findbugs']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/selste/simple-maven-project-with-tests']]])
 
}
}

stage
'Build'
node
{
  wrap
([$class: 'TimestamperBuildWrapper']) {
    withMaven
(jdk: 'openjdk 1.8.0', maven: 'maven 3.5.0') {
      sh
'mvn clean compile'
   
}
 
}
}

stage
'Test'
node
{
  wrap
([$class: 'TimestamperBuildWrapper']) {
    withMaven
(jdk: 'openjdk 1.8.0', maven: 'maven 3.5.0') {
      sh
'mvn test'

      findbugs canComputeNew
: false, defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', pattern: '**/target/findbugsXml.xml', unHealthy: ''
   
}
 
}
}


Declarative:
pipeline {
  agent any

  tools {
    maven 'maven 3.5.0'
    jdk 'openjdk 1.8.0'
  }

  stages {
    stage('Checkout') {
      steps {
        checkout([$class: 'GitSCM', branches: [[name: 'findbugs']], userRemoteConfigs: [[url: 'https://github.com/selste/simple-maven-project-with-tests']]])
      }
    }

    stage('Build') {
      steps {
        bat 'mvn clean compile'
      }
    }

    stage('Test') {
      steps {
        bat 'mvn test'
        findbugs canComputeNew: false, defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', pattern: '**/target/findbugsXml.xml', unHealthy: ''
      }
    }
  } 
}


I did some tests with more or less the same maven project using multibranch pipeline - and got the same results: scripted pipeline leads to duplicate findbugs graphs plus the test results graph (not configured), declarative pipeline works as expected.
Regards,

S. Elste

Ullrich Hafner

unread,
Aug 25, 2017, 7:37:19 AM8/25/17
to Jenkins Users
Ok, I think there is enough information to get the problem reproduced. I’ll write an ATH test case in order to reproduce it locally. Can you please file a corresponding issue in Jira? Otherwise important information might get lost...

--
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 jenkinsci-use...@googlegroups.com.
signature.asc

Steffen Elste

unread,
Aug 25, 2017, 8:59:17 AM8/25/17
to Jenkins Users
Hi,
thanks - i'm not sure if i'm allowed to open an issue (yet) - but i'll get it done over the weekend.
Cheers,

Steffen 

Steffen Elste

unread,
Aug 25, 2017, 3:05:46 PM8/25/17
to Jenkins Users
... i've created an issue: JENKINS-46469
Regards,

Steffen
Reply all
Reply to author
Forward
0 new messages