J'ai un simple fichier Jenkins avec une étape recordIssues. Le code correspondant ressemble à ceci:
[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)
J'ai installé la dernière version du plugin Warnings Next Generation ( https://plugins.jenkins.io/warnings-ng ) mais je rencontre le problème suivant:
step([ $class: 'recordIssues', aggregatingResults: true, enabledForFailure: true, tools: [pyLint()] ])
Est-ce en quelque sorte possible de vérifier que l'extension est installée correctement?
3 Réponses :
Cela fonctionne pour moi (Jenkins ver. 2.164.1):
stage('Static Analysis') { recordIssues( tool: pyLint(pattern: '**/pylint.out'), unstableTotalAll: '100', ) recordIssues( tool: pep8(pattern: '**/pep8.out'), unstableTotalAll: '100', ) }
Ceci est ma version de travail pour une configuration CI de projet Python dans Jenkins pour utiliser les rapports JUnit, PEP8, Pylint et Coverage:
... 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' } } } ...
Cela fonctionne avec Plug-in Cobertura , Plug-in JUnit a> et Warnings Next Generation . Les packages Python que j'ai utilisés sont la couverture et la pylint et pour PEP8 j'ai utilisé pycodestyle .
J'espère que cela aidera quelqu'un d'autre, car trouver de bons exemples de ce truc de Jenkinsfile
n'est pas facile.
Pour mémoire: Jenkins v2.204.2 Plugin de nouvelle génération Jenkins Warnings v8.0.0
stage('Static Analysis') { steps { recordIssues( tool: pyLint(pattern: '**/pylint.out'), unstableTotalAll: 100, ) }