Valid Jenkins syntax rejected as NglParseError
CarlInglisBJSS opened this issue · 2 comments
First, thanks for a fantastic tool.
I've found a bit of an edge case, which I fully appreciate is outside of the scope of a groovy parser, but I was wondering if you have any thoughts on how to address it.
// ...
lock(lockValue) {
// do stuff
}
// ...
This is valid Jenkins syntax (because the pre-parser turns it into something more groovy-ish) but NGL is reporting:
31 error Unexpected input: '{' @ line 31, column 19. NglParseError
I'm working my way through our files with NGL, and so for this file I can just not NGL it as it's a small file that doesn't change. However we use this construct in several places in much bigger and more complex pipelines.
Any thoughts would be appreciated.
Thanks.
Hi @CarlInglisBJSS , NGL parse error is caused by the default groovy parser, so maybe it's related to the groovy version?
NGL is still needs to upgrade because it's stuck on groovy 3 for the moment
Maybe u could share the full jenkinsfile?
Hi @nvuillam,
Unfortunately I can't share the full file as it's client-confidential - however commenting out the lock and digging deeper into the resulting errors has shown that the actual problem was a missing comma on this block - which was inside the lock code:
resultsMap = readJSON(
text: awsResults['stdout'] // missing comma at the end here
returnPOJO: true
)
I guess it was reporting the issue on the lock line since that was the start of the block that it fell over on.
This sample file produces a similar problem (although not quite the same):
void doStuffInALock(String lockValue) {
String dummyVariable
lock(lockValue) {
Object resultsMap = readJSON(
text: dummyVariable
returnPOJO: true
)
}
}
Thanks for the rapid response and for causing me to try and create a sample, which didn't do what I expected, and thus caused me to dig deeper. :)