3

I have a simple Jenkinsfile with a recordIssues step. The relevant code looks like this:

   step([
        $class: 'recordIssues',
        aggregatingResults: true,
        enabledForFailure: true,
        tools: [pyLint()]
    ])

I have installed the latest version of the Warnings Next Generation plugin (https://plugins.jenkins.io/warnings-ng) but I run into the following issue:

[Pipeline] step
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.lang.UnsupportedOperationException: no known implementation of interface jenkins.tasks.SimpleBuildStep is named recordIssues
    at org.jenkinsci.plugins.structs.describable.DescribableModel.resolveClass(DescribableModel.java:478)

Is it somehow possible to check that the extension is installed correctly?

3 Answers 3

5

This is my working version for a Python project CI configuration in Jenkins to use JUnit, PEP8, Pylint and Coverage reports:

    ...

    stage('Test: Run') {
        steps {
            // Run my project tests.
            sh 'coverage run manage.py tests'

            // Dump coverage metrics to XML.
            sh 'coverage xml'

            // Run Pylint.
            sh 'pylint --rcfile=.pylintrc my_project > reports/pylint.report'

            // Run Pycodestyle (PEP8 checks).
            sh 'pycodestyle my_project > reports/pep8.report'
        }
        post {
            always{
                // Generate JUnit, PEP8, Pylint and Coverage reports.
                junit 'reports/*junit.xml'
                recordIssues(
                    tool: pep8(pattern: 'reports/pep8.report'),
                    unstableTotalAll: 200,
                    failedTotalAll: 220
                )
                recordIssues(
                    tool: pyLint(pattern: 'reports/pylint.report'),
                    unstableTotalAll: 20,
                    failedTotalAll: 30
                )
                cobertura coberturaReportFile: 'reports/coverage.xml'
            }
        }
    }
    ...

It works with Cobertura plugin, JUnit plugin and Warnings Next Generation. Python packages I used are the traditional coverage and pylint and for PEP8 I used pycodestyle.

Hope this helps somebody else, as finding good examples of this Jenkinsfile stuff is not easy.

2

Just for the record: Jenkins v2.204.2 Jenkins Warnings Next Generation Plugin v8.0.0

  stage('Static Analysis') {
    steps {
        recordIssues(
            tool: pyLint(pattern: '**/pylint.out'),
            unstableTotalAll: 100,
        )
    }
1

This works for me (Jenkins ver. 2.164.1):

    stage('Static Analysis') {

        recordIssues(
            tool: pyLint(pattern: '**/pylint.out'),
            unstableTotalAll: '100',
       )

        recordIssues(
            tool: pep8(pattern: '**/pep8.out'),
            unstableTotalAll: '100',
       )
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.