nvuillam/npm-groovy-lint

Jenkins pipeline stucks

thib-info opened this issue ยท 15 comments

Hello @nvuillam !

Thank you for the powerful linter you've proposed to everybody. I'm using it locally to check the integrity and the conformity of my pipelines and I'm really happy concerning it.

Little problem, when I'm trying to use it on my Jenkins pipeline (to check that the pipeline is well written), the stage of the linter rests on the loading parts and is automatically killed by Jenkins after 10min because it's too long.

Did you ever face that kind of error ? Why the linter isn't responding fine on the pipeline ? What could be the factors ?

Does the linter need some requirements ?

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.

@thib-info a new version is coming, fixed by @stevenh , and it should work much better :)

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.

@thib-info please can you check with v13.0.0 ? :)

Version 14 would be the one to test now @thib-info, look forward to hearing if this is now addressed?

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.

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.

Hello @stevenh, @nvuillam,

Just trying to implement the linter on one of our project. Locally, it running like a charm. But, trying to implement the CI solution on Jenkins, then facing this issue. The linting step is hanging.

I'm able to call the npm-groovy-lint -v or npm-groovy-lint -h from Jenkins. It works correctly:

15:13:12  + npm-groovy-lint -v
15:13:15  GroovyLint: Successfully processed CodeNarc: 
15:13:15  CodeNarc version 3.3.0
15:13:15  npm-groovy-lint version 14.4.0
15:13:15  
15:13:15  Embeds:
15:13:15  CodeNarc version 3.3.0
15:13:15  - Groovy version 3.0.9 (superlite)

Do you know if anyone else is getting this issue ? Do you think it can be a memory or cpu issue alocated to the docker container running on the Jenkins agent ? (I'm not owner of the Jenkins platform, don't know about this kind of config).

Thanks for your help

Can you try with --no-server argument in CI ?

And you also have a npm-groovy-lint docker image that you can use in Jenkins :)

npm-groovy-lint is also embedded in MegaLinter if you need other linters

Thanks for this very quick feedback :)

Already tried with the --noserver. And it's the same. No problem on local env, but stuck on Jenkins.

I didn't precise that, but yes I'm using the official docker image you provide. Here is an extract of the pipeline, which is very simple for the moment:

node {
    ROOT_DIR = pwd()

    checkout scm

    docker.image('nvuillam/npm-groovy-lint').inside() {
        sh(script: """
            npm-groovy-lint -v
            npm-groovy-lint -h
            npm-groovy-lint "${ROOT_DIR}/my-file.groovy" --loglevel warning --failon error
        """,
        returnStatus: true)
    }
}

Also, I tried to focus the lint on a unique short file to avoid potential perf issue.

Got it !
Even with the --noserver you have an infinite process with no output ?

I don't personnally use the docker image, what if you try with npm i npm-groovy-lint -g instead of using the image ?

Might be good to try enabling debug logging to see where it's getting stuck

@nvuillam, yes, also stuck with the --noserver option.

Unfortunatly, I don't have the npm command on the Jenkins agent where the pipeline runs. And no possibility to install it. I'm forced to use a docker image. So, I could start a linux based image and then install the package, but it will be the same that using the npm-groovy-lint docker image I guess.

One point, because I did some extra tests. I was finally able to launch the process by changing a bit my pipeline. Instead of using the built in docker, I switch to a script that runs a docker run command to start the container based on the official npm-groovy-lint docker image. Something like that:

node {
    ROOT_DIR = pwd()

    checkout scm

    sh(script: """
        docker run --rm -v ${ROOT_DIR}:/src -w /src \
            nvuillam/npm-groovy-lint --loglevel warning --failon error
    """, returnStatus: true, encoding: 'UTF-8')
}

With this config, linter is executed:

[Pipeline] sh
19:05:26  + docker run --rm -v /home/jenkins/workspace/src:/src -w /src nvuillam/npm-groovy-lint --loglevel warning --failon error
19:05:31  
19:05:31  npm-groovy-lint results in 0 linted files:
19:05:31  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
19:05:31  โ”‚ (index) โ”‚ Severity  โ”‚ Total found โ”‚
19:05:31  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
19:05:31  โ”‚    0    โ”‚  'Error'  โ”‚      0      โ”‚
19:05:31  โ”‚    1    โ”‚ 'Warning' โ”‚      0      โ”‚
19:05:31  โ”‚    2    โ”‚  'Info'   โ”‚      0      โ”‚
19:05:31  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // timestamps
[Pipeline] End of Pipeline
Finished: SUCCESS

So, I don't know what can be the problem, but the way the container is launch seems to affect the npm-groovy-lint process.
I will do extra test to try to identify the issue.

@stevenh, thanks for your feedback. How can I enable debug logging ?

Details on how to enable logging in the server can be found here.

If not running directly you'll want to pass these via --javaoptions.