jenkins-library: No files found for pattern '*lint.xml'. Configuration error?

I’m trying to run an ESLint pipeline on Jenkins with the SAP Project Piper. To run a linting, I configured the following Jenkins file:

@Library('piper-lib-os') _

node() {
	stage('LINT_POC') {
		npmExecuteLint script: this
	}
}

According to the npmExecuteLint documentation, that should be enough, but when I run this code on Jenkins, I get the following error:

[LINT] [-ERROR-] No files found for pattern ‘*lint.xml’. Configuration error?

As far as I know, ESLint uses eslintrc.json as a config file, so how should I generate an *lint.xml file? And where should I put this file?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

OK, but is it possible to get an output right into console (e.g. into Jenkins’s Lint Warnings), without creating and writing into *lint.xml?

Hi @pubmikeb, this should be possible if you instead use the step npmExecuteScripts to execute the script you have defined in the package.json. With your example pipeline, e.g.:

@Library('piper-lib-os') _

node() {
	stage('LINT_POC') {
		npmExecuteScripts script: this, runScripts: ['ci-lint']
	}
}

I hope this helps.

Hi @pubmikeb,

this seems to be a problem in your ci-lint script. I guess it’s because you’re missing the parameter for which files or directories ESLint should be executed. In addition, I guess you cannot use node eslint. Instead, either use npx eslint or node ./node_modules/eslint/bin/eslint.js To execute ESLint in the current folder, e.g.,:

"scripts": {
-  "ci-lint": "node eslint -c .eslintrc -o 2022lint.xml"
+  "ci-lint": "npx eslint -c .eslintrc -o 2022lint.xml ."
}

In general, I would recommend to first write and test the script locally and when it works locally, use and test it in the pipeline.

Hi @KevinHudemann, do you have any thoughts?

jenkins uses this xml later here https://www.jenkins.io/doc/pipeline/steps/warnings-ng/#recordissues-record-compiler-warnings-and-static-analysis-results

    recordIssues blameDisabled: true,
        enabledForFailure: true,
        aggregatingResults: false,
        tool: script.checkStyle(id: "lint", name: "Lint", pattern: "*lint.xml")

Can it be the problem of permissions on Jenkins’s side?

it can, if the same script generate xml locally.