• Icon: New Feature New Feature
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • warnings-plugin
    • None

      Hi all,

      I seem to have hit a possible bug with using the Checkstyle plugin for a pipeline project.

      I have checked that the plugins are all working OK for a freestyle project:

      https://groups.google.com/forum/#!topic/jenkinsci-users/RMyO5zYDABM

      (sorry for the cross post)

      Now if I use the following for a pipeline version of the same project:

      stage('RuboCop code analyzer') {
        node {
          sh '/var/lib/jenkins/ci-projects/test/build-scripts/run-rubocop-tests.sh'
      
          publishHTML(target: [
            allowMissing: false,
            alwaysLinkToLastBuild: true,
            keepAll: true,
            reportDir: '/var/lib/jenkins/ci-projects/test/build-reports/',
            reportFiles: 'rubocop-index.html',
            reportName: 'RuboCop HTML Report'
          ])
        }
      }
      
      stage('Scan for Rubocop compiler Warnings') {
        node {
          step([$class: 'WarningsPublisher',
            canResolveRelativePaths: false,
            consoleParsers: [[parserName: 'Rubocop']],
            defaultEncoding: '',
            excludePattern: '',
            healthy: '',
            includePattern: '',
            messagesPattern: '',
            unHealthy: '',
            useStableBuildAsReference: true
          ])
        }
      }
      
      stage('Rubocop CheckStyle Publisher') {
        node {
          step([$class: 'CheckStylePublisher',
            canRunOnFailed: true,
            defaultEncoding: '',
            healthy: '',
            pattern: '',
            unHealthy: '',
            useStableBuildAsReference: true
          ])
        }
      }
      

      When I do a build of the project, I get the following in the console output:

      [CHECKSTYLE] Collecting checkstyle analysis files...
      [CHECKSTYLE] Finding all files that match the pattern **/checkstyle-result.xml
      [CHECKSTYLE] Computing warning deltas based on reference build #95
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] End of Pipeline
      Finished: SUCCESS

      Now if I click on the build number, I see the following:

      Checkstyle: 0 warnings.
      No warnings since build 1.
      New zero warnings highscore: no warnings for 71 days!
      During parsing an error has been reported.

      So if I click on the error link I get the following message:

      Errors
      No report files were found. Configuration error?

      Yet the build logs tell me that checkstyle has found the report file above.

      Have i missed something here, such as a configuration parameter, or is this a possible bug?

      Kind Regards,

      Keith

      Update:

      If I compare the console output from the freestyle version of the project that generates the Checkstyle warnings OK, and the pipeline version of the same project I get these outputs:

      Freestyle project console output

      14:12:25 [CHECKSTYLE] Collecting checkstyle analysis files...
      14:12:26 [CHECKSTYLE] Finding all files that match the pattern **/rubocop-checkstyle-result.xml
      14:12:26 [CHECKSTYLE] Parsing 1 file in /var/lib/jenkins/workspace/test-freestyle
      14:12:26 [CHECKSTYLE] Successfully parsed file /var/lib/jenkins/workspace/test-freestyle/rubocop-checkstyle-result.xml with 4177 unique warnings and 0 duplicates.
      14:12:27 [CHECKSTYLE] Computing warning deltas based on reference build #65

      Pipeline version console output

      [CHECKSTYLE] Collecting checkstyle analysis files...
      [CHECKSTYLE] Finding all files that match the pattern **/checkstyle-result.xml
      [CHECKSTYLE] Computing warning deltas based on reference build #98

      So it looks like the pipeline version is NOT parsing the xml output file - but the freestyle version is.

      What do I need to do to make the pipeline version parse the said file please?

          [JENKINS-42095] Checkstyle plugin not working in pipeline

          Keith Roberts created issue -
          Keith Roberts made changes -
          Description Original: Hi all,

          I seem to have hit a possible bug with using the Checkstyle plugin for a pipeline project.

          I have checked that the plugins are all working OK for a freestyle project:

          https://groups.google.com/forum/#!topic/jenkinsci-users/RMyO5zYDABM

          (sorry for the cross post)

          Now if I use the following for a pipeline version of the same project:

          stage('RuboCop code analyzer') {
            node {
              sh '/var/lib/jenkins/ci-projects/test/build-scripts/run-rubocop-tests.sh'

              publishHTML(target: [
                allowMissing: false,
                alwaysLinkToLastBuild: true,
                keepAll: true,
                reportDir: '/var/lib/jenkins/ci-projects/test/build-reports/',
                reportFiles: 'rubocop-index.html',
                reportName: 'RuboCop HTML Report'
              ])
            }
          }

          stage('Scan for Rubocop compiler Warnings') {
            node {
              step([$class: 'WarningsPublisher',
                canResolveRelativePaths: false,
                consoleParsers: [[parserName: 'Rubocop']],
                defaultEncoding: '',
                excludePattern: '',
                healthy: '',
                includePattern: '',
                messagesPattern: '',
                unHealthy: '',
                useStableBuildAsReference: true
              ])
            }
          }

          stage('Rubocop CheckStyle Publisher') {
            node {
              step([$class: 'CheckStylePublisher',
                canRunOnFailed: true,
                defaultEncoding: '',
                healthy: '',
                pattern: '',
                unHealthy: '',
                useStableBuildAsReference: true
              ])
            }
          }

          When I do a build of the project, I get the following in the console output:

          [CHECKSTYLE] Collecting checkstyle analysis files...
          [CHECKSTYLE] Finding all files that match the pattern **/checkstyle-result.xml
          [CHECKSTYLE] Computing warning deltas based on reference build #95
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] End of Pipeline
          Finished: SUCCESS

          Now if I click on the build number, I see the following:

          Checkstyle: 0 warnings.
              No warnings since build 1.
              New zero warnings highscore: no warnings for 71 days!
              During parsing an *error has been reported*.

          So if I click on the error link I get the following message:

          Errors
              No report files were found. Configuration error?

          Yet the build logs tell me that checkstyle has found the report file above.

          Have i missed something here, such as a configuration parameter, or is this a possible bug?

          Kind Regards,

          Frederick
          New: Hi all,

          I seem to have hit a possible bug with using the Checkstyle plugin for a pipeline project.

          I have checked that the plugins are all working OK for a freestyle project:

          https://groups.google.com/forum/#!topic/jenkinsci-users/RMyO5zYDABM

          (sorry for the cross post)

          Now if I use the following for a pipeline version of the same project:

          stage('RuboCop code analyzer') {
            node {
              sh '/var/lib/jenkins/ci-projects/test/build-scripts/run-rubocop-tests.sh'

              publishHTML(target: [
                allowMissing: false,
                alwaysLinkToLastBuild: true,
                keepAll: true,
                reportDir: '/var/lib/jenkins/ci-projects/test/build-reports/',
                reportFiles: 'rubocop-index.html',
                reportName: 'RuboCop HTML Report'
              ])
            }
          }

          stage('Scan for Rubocop compiler Warnings') {
            node {
              step([$class: 'WarningsPublisher',
                canResolveRelativePaths: false,
                consoleParsers: [[parserName: 'Rubocop']],
                defaultEncoding: '',
                excludePattern: '',
                healthy: '',
                includePattern: '',
                messagesPattern: '',
                unHealthy: '',
                useStableBuildAsReference: true
              ])
            }
          }

          stage('Rubocop CheckStyle Publisher') {
            node {
              step([$class: 'CheckStylePublisher',
                canRunOnFailed: true,
                defaultEncoding: '',
                healthy: '',
                pattern: '',
                unHealthy: '',
                useStableBuildAsReference: true
              ])
            }
          }

          When I do a build of the project, I get the following in the console output:

          [CHECKSTYLE] Collecting checkstyle analysis files...
          [CHECKSTYLE] Finding all files that match the pattern **/checkstyle-result.xml
          [CHECKSTYLE] Computing warning deltas based on reference build #95
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] End of Pipeline
          Finished: SUCCESS

          Now if I click on the build number, I see the following:

          Checkstyle: 0 warnings.
              No warnings since build 1.
              New zero warnings highscore: no warnings for 71 days!
              During parsing an *error has been reported*.

          So if I click on the error link I get the following message:

          Errors
              No report files were found. Configuration error?

          Yet the build logs tell me that checkstyle has found the report file above.

          Have i missed something here, such as a configuration parameter, or is this a possible bug?

          Kind Regards,

          Keith
          Summary Original: Checksyle plugin New: Checksyle plugin not working in pipeline
          Keith Roberts made changes -
          Description Original: Hi all,

          I seem to have hit a possible bug with using the Checkstyle plugin for a pipeline project.

          I have checked that the plugins are all working OK for a freestyle project:

          https://groups.google.com/forum/#!topic/jenkinsci-users/RMyO5zYDABM

          (sorry for the cross post)

          Now if I use the following for a pipeline version of the same project:

          stage('RuboCop code analyzer') {
            node {
              sh '/var/lib/jenkins/ci-projects/test/build-scripts/run-rubocop-tests.sh'

              publishHTML(target: [
                allowMissing: false,
                alwaysLinkToLastBuild: true,
                keepAll: true,
                reportDir: '/var/lib/jenkins/ci-projects/test/build-reports/',
                reportFiles: 'rubocop-index.html',
                reportName: 'RuboCop HTML Report'
              ])
            }
          }

          stage('Scan for Rubocop compiler Warnings') {
            node {
              step([$class: 'WarningsPublisher',
                canResolveRelativePaths: false,
                consoleParsers: [[parserName: 'Rubocop']],
                defaultEncoding: '',
                excludePattern: '',
                healthy: '',
                includePattern: '',
                messagesPattern: '',
                unHealthy: '',
                useStableBuildAsReference: true
              ])
            }
          }

          stage('Rubocop CheckStyle Publisher') {
            node {
              step([$class: 'CheckStylePublisher',
                canRunOnFailed: true,
                defaultEncoding: '',
                healthy: '',
                pattern: '',
                unHealthy: '',
                useStableBuildAsReference: true
              ])
            }
          }

          When I do a build of the project, I get the following in the console output:

          [CHECKSTYLE] Collecting checkstyle analysis files...
          [CHECKSTYLE] Finding all files that match the pattern **/checkstyle-result.xml
          [CHECKSTYLE] Computing warning deltas based on reference build #95
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] End of Pipeline
          Finished: SUCCESS

          Now if I click on the build number, I see the following:

          Checkstyle: 0 warnings.
              No warnings since build 1.
              New zero warnings highscore: no warnings for 71 days!
              During parsing an *error has been reported*.

          So if I click on the error link I get the following message:

          Errors
              No report files were found. Configuration error?

          Yet the build logs tell me that checkstyle has found the report file above.

          Have i missed something here, such as a configuration parameter, or is this a possible bug?

          Kind Regards,

          Keith
          New: Hi all,

          I seem to have hit a possible bug with using the Checkstyle plugin for a pipeline project.

          I have checked that the plugins are all working OK for a freestyle project:

          https://groups.google.com/forum/#!topic/jenkinsci-users/RMyO5zYDABM

          (sorry for the cross post)

          Now if I use the following for a pipeline version of the same project:

          stage('RuboCop code analyzer') {
            node {
              sh '/var/lib/jenkins/ci-projects/test/build-scripts/run-rubocop-tests.sh'

              publishHTML(target: [
                allowMissing: false,
                alwaysLinkToLastBuild: true,
                keepAll: true,
                reportDir: '/var/lib/jenkins/ci-projects/test/build-reports/',
                reportFiles: 'rubocop-index.html',
                reportName: 'RuboCop HTML Report'
              ])
            }
          }

          stage('Scan for Rubocop compiler Warnings') {
            node {
              step([$class: 'WarningsPublisher',
                canResolveRelativePaths: false,
                consoleParsers: [[parserName: 'Rubocop']],
                defaultEncoding: '',
                excludePattern: '',
                healthy: '',
                includePattern: '',
                messagesPattern: '',
                unHealthy: '',
                useStableBuildAsReference: true
              ])
            }
          }

          stage('Rubocop CheckStyle Publisher') {
            node {
              step([$class: 'CheckStylePublisher',
                canRunOnFailed: true,
                defaultEncoding: '',
                healthy: '',
                pattern: '',
                unHealthy: '',
                useStableBuildAsReference: true
              ])
            }
          }

          When I do a build of the project, I get the following in the console output:

          [CHECKSTYLE] Collecting checkstyle analysis files...
          [CHECKSTYLE] Finding all files that match the pattern **/checkstyle-result.xml
          [CHECKSTYLE] Computing warning deltas based on reference build #95
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] End of Pipeline
          Finished: SUCCESS

          Now if I click on the build number, I see the following:

          Checkstyle: 0 warnings.
              No warnings since build 1.
              New zero warnings highscore: no warnings for 71 days!
              During parsing an *error has been reported*.

          So if I click on the error link I get the following message:

          Errors
              No report files were found. Configuration error?

          Yet the build logs tell me that checkstyle has found the report file above.

          Have i missed something here, such as a configuration parameter, or is this a possible bug?

          Kind Regards,

          Keith

          Update:

          If I compare the console output from the freestyle version of the project that generates the Checkstyle warnings OK, and the pipeline version of the same project I get these outputs:


          *Freestyle project console output*

          14:12:25 [CHECKSTYLE] Collecting checkstyle analysis files...
          14:12:26 [CHECKSTYLE] Finding all files that match the pattern **/rubocop-checkstyle-result.xml
          14:12:26 [CHECKSTYLE] Parsing 1 file in /var/lib/jenkins/workspace/test-freestyle
          14:12:26 [CHECKSTYLE] Successfully parsed file /var/lib/jenkins/workspace/test-freestyle/rubocop-checkstyle-result.xml with 4177 unique warnings and 0 duplicates.
          14:12:27 [CHECKSTYLE] Computing warning deltas based on reference build #65

          *Pipeline version console output*

          [CHECKSTYLE] Collecting checkstyle analysis files...
          [CHECKSTYLE] Finding all files that match the pattern **/checkstyle-result.xml
          [CHECKSTYLE] Computing warning deltas based on reference build #98

          So it looks like the pipeline version is NOT parsing the xml output file - but the freestyle version is.

          What do I need to do to make the pipeline version parse the said file please?
          Keith Roberts made changes -
          Issue Type Original: Bug [ 1 ] New: New Feature [ 2 ]

          Keith Roberts added a comment - - edited

          Hi Ulli,

          So reading the docs here:

          https://plugins.jenkins.io/checkstyle

          it looks like checkstyle does not support pipelines yet?

          Works with the freestyle and native m2 build option (activated on goal checkstyle:checkstyle or site)

          Could we have this implemented for pipelines as well please?

          TIA

          Keith

          Keith Roberts added a comment - - edited Hi Ulli, So reading the docs here: https://plugins.jenkins.io/checkstyle it looks like checkstyle does not support pipelines yet? Works with the freestyle and native m2 build option (activated on goal checkstyle:checkstyle or site) Could we have this implemented for pipelines as well please? TIA Keith
          Keith Roberts made changes -
          Summary Original: Checksyle plugin not working in pipeline New: Checkstyle plugin not working in pipeline

          Ulli Hafner added a comment -

          I need to update the wiki pages, the Checkstyle plugin has pipeline support.

          The pattern you are specifying in the pipeline is wrong: try **/rubocop-checkstyle-result.xml.

          Ulli Hafner added a comment - I need to update the wiki pages, the Checkstyle plugin has pipeline support. The pattern you are specifying in the pipeline is wrong: try **/rubocop-checkstyle-result.xml.

          Keith Roberts added a comment - - edited

          Hi Ulli,

          Thanks for your quick reply.

          I have tried the following pattern in the pipeline step:

          stage('Rubocop CheckStyle Publisher') {
            node {
              step([$class: 'CheckStylePublisher',
                canRunOnFailed: true,
                defaultEncoding: '',
                healthy: '100',
                pattern: '**/rubocop-checkstyle-result.xml',
                unHealthy: '90',
                useStableBuildAsReference: true
              ])
            }
          }
          

          When I do a build and click on the build number 104 I get the following output:

          Checkstyle: 0 warnings.
          No warnings since build 1.
          New zero warnings highscore: no warnings for 72 days!
          During parsing an error has been reported.

          If I click on the error link I get the following message:

          Errors

          No report files were found. Configuration error?

          Looking at the console output for build 104 I can see the following at the end of the build logs:

          Running on master in /var/lib/jenkins/workspace/test
          [Pipeline]

          { [Pipeline] step {color:#205081}

          [CHECKSTYLE] Collecting checkstyle analysis files...
          [CHECKSTYLE] Finding all files that match the pattern **/rubocop-checkstyle-result.xml
          [CHECKSTYLE] Computing warning deltas based on reference build #103
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] End of Pipeline
          Finished: SUCCESS

          Please kindly see the screenshots attached below.

          So it looks to me like the rubocop-checkstyle-result.xml is not getting parsed to create the output results?

          Regards,

          Keith

          Keith Roberts added a comment - - edited Hi Ulli, Thanks for your quick reply. I have tried the following pattern in the pipeline step: stage( 'Rubocop CheckStyle Publisher' ) { node { step([$class: 'CheckStylePublisher' , canRunOnFailed: true , defaultEncoding: '', healthy: '100' , pattern: '**/rubocop-checkstyle-result.xml' , unHealthy: '90' , useStableBuildAsReference: true ]) } } When I do a build and click on the build number 104 I get the following output: Checkstyle: 0 warnings. No warnings since build 1. New zero warnings highscore: no warnings for 72 days! During parsing an error has been reported. If I click on the error link I get the following message: Errors No report files were found. Configuration error? Looking at the console output for build 104 I can see the following at the end of the build logs: Running on master in /var/lib/jenkins/workspace/test [Pipeline] { [Pipeline] step {color:#205081} [CHECKSTYLE] Collecting checkstyle analysis files... [CHECKSTYLE] Finding all files that match the pattern **/rubocop-checkstyle-result.xml [CHECKSTYLE] Computing warning deltas based on reference build #103 [Pipeline] } [Pipeline] // node [Pipeline] } [Pipeline] // stage [Pipeline] End of Pipeline Finished: SUCCESS Please kindly see the screenshots attached below. So it looks to me like the rubocop-checkstyle-result.xml is not getting parsed to create the output results? Regards, Keith
          Keith Roberts made changes -
          Attachment New: Screen Shot 2017-02-17 at 09.53.04.png [ 36025 ]
          Keith Roberts made changes -
          Attachment New: Screen Shot 2017-02-17 at 09.53.56.png [ 36026 ]

            drulli Ulli Hafner
            sputnik1 Keith Roberts
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: