npm-groovy-lint
npm-groovy-lint copied to clipboard
Error "unable to resolve class Library" with [email protected]
Since 15.0.1 we see this error validating our Jenkins script:
Jenkinsfile.groovy
0 error Unknown parsing error: "Jenkinsfile.groovy: 1: unable to resolve class Library for annotation\n @ line 1, column 1.\n @Library('ff-pipeline-lib@LKG') _\n ^\n" NglParseError
The problematic line of code looks like this:
@Library('ff-pipeline-lib@LKG') _
I am using the "recommended-jenkinsfile" configuration.
I tried against these currently available versions:
15.0.0 - Good 15.0.1 - Bad 15.0.2 - Bad
I am also seeing this issue when using the latest code/container image
We are facing the same issue.
@geoffswift @edwardtew @dahorak Until we find a fix, you can try with --no-parse as workaround
Thanks for your suggestion, we stick to the previous 15.0.0 version as a workaround.
We have pinned the version at 15.0.0 for now as well. Thanks for the suggestion @nvuillam
We faced the same issue, but using version 15.0.0 served as a workaround for us.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.
Bump. Don't close please
Same issue, using 15.0.0.
Yes, this issue prevents us from using a newer version. Please fix! Thank you!
I know I know... that's hard to find time these days ^^
Anyone is welcome to try bia a PR :)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.
I still would like to see this issue resolved
Running npm-groovy-lint via https://github.com/super-linter/super-linter bundle which has upgraded it to 15.0.2 yesterday and now we're hitting the below:
0 error Unknown parsing error: "/github/workspace/ami_build/Jenkinsfile: 2: unable to resolve class Library for annotation
@ line 2, column 1.
@Library('shared-library') _
^
" NglParseError
Is there any way to disable them via groovylintrc.json?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.
unstale
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.
unstale
Gonna throw this out there because I get notified about this issue every month, but not about any progress.
https://fvsch.com/stale-bots#:~:text=are%20not%20valued.-,Stale%20bots%20break%20your%20bug%20tracker,3%2C%206%20or%2012%20months.
I really don't like the stale bot.
It seems like the parseError at line 247 in codenarc-factory.js is now a String causing parseError.cause etc to fail.
I added some debug prints to codenarc-factory.js like this:
let msg = parseError.cause && parseError.cause.message ? parseError.cause.message : `Unknown parsing error: ${JSON.stringify(parseError)}`;
console.log(typeof parseError) //Debug log
console.log(parseError) //Debug log
Output of debug prints (anonymized hence the garbage names)
string
/home/user/tkint/src/jenkins_tkint_parking/src/com/vc/tkint/sqa.groovy: 12: unable to resolve class com.vc.tkint.utils.dh
@ line 12, column 1.
import com.vc.tkint.utils.dh
^
Causing the following error:
0 error Unknown parsing error: "/home/user/tkint/src/jenkins_tkint_parking/src/com/vc/tkint//sqa.groovy: 12: unable to resolve class com.vc.tkint.utils.dh\n @ line 12, column 1.\n import com.vc.tkint.utils.dh\n ^\n" NglParseError
To add to this. This is what the response from codenarc server looks like
About here in the groovy we are expecting parseErrors to be a list of strings https://github.com/nvuillam/npm-groovy-lint/blob/main/groovy/src/main/com/nvuillam/Request.groovy#L149
Which comes out as string from here https://github.com/nvuillam/npm-groovy-lint/blob/main/groovy/src/main/com/nvuillam/Request.groovy#L214
For now I can atleast say that parseFile in v15.0.0 looked different
https://github.com/nvuillam/npm-groovy-lint/blob/v15.0.0/groovy/src/main/com/nvuillam/Request.groovy#L214
It used to return a typeof List<Error> which is probably what the frontend codenarc-factory.js is expecting.
Which changed in this PR: https://github.com/nvuillam/npm-groovy-lint/pull/420
@nvuillam I think lots of us in here would appreciate it if we could get this looked at and released as soon as you can.
https://github.com/nvuillam/npm-groovy-lint/pull/444
Thank you ❤️ I appreciate the npm-groovy-lint project.
@joshzcold i understand, but my backlog on many projects is very high, and unfortunately npm-groovy-lint has less business impact for me than the others, especially those i am paid for ... I have to prioritize :/
You are more than welcome to investigate and find a solution before i finally find the time to do so without having to stop sleeping for that ^^
Codenarc released a new version... mayve upgrading npm-groovy-lint with it could help ?
@nvuillam the link in my previous comment is a PR to fix this current issue.
Sorry if I wasn't clear. Just looking for a review
Oh sorry ^^ I look right away :)
@joshzcold you can test with latest @beta version :) (please confirm it works well ^^)
And i have a 5 hours train tomorrow.... I'll make an official release then :)
@nvuillam I tested the new release and I believe we can close this.
My jenkins pipelines being linted are getting the correct diagnostics and npm-groovy-lint no longer has issues on Library() or imports
My jenkins pipelines being linted are getting the correct diagnostics and
npm-groovy-lintno longer has issues onLibrary()
+1 confirming no longer seeing issues with Jenkins' Library()
Great, thanks for your fix and your feedback 🥳