nvuillam / npm-groovy-lint

Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle files using command line
https://nvuillam.github.io/npm-groovy-lint/
MIT License
205 stars 63 forks source link

Error running npm-groovy-lint in Docker container: GroovyLint: Unable to start CodeNarc Server. #370

Closed CliveUnger closed 3 months ago

CliveUnger commented 5 months ago

I am trying to run npm-groovy-lint as a Docker container in a GitLab CI pipeline (similar to CircleCI). My CI config looks something like:

groovy_lint:
  stage: lint
  image: 
    name: nvuillam/npm-groovy-lint
    entrypoint: 
      - /bin/bash
  script:
    - node -v
    - java --version
    - npm-groovy-lint --version
    - npm-groovy-lint --noserver --config ".groovylintrc.json" --failon warning --verbose

However, it fails with the following error:

$ node -v
v18.19.1
$ java --version
openjdk 17.0.10 2024-01-16
OpenJDK Runtime Environment (build 17.0.10+7-alpine-r0)
OpenJDK 64-Bit Server VM (build 17.0.10+7-alpine-r0, mixed mode, sharing)
$ npm-groovy-lint --version
GroovyLint: Unable to start CodeNarc Server. Use --noserver if you do not even want to try
GroovyLint: Successfully processed CodeNarc: 
npm-groovy-lint version 14.4.0
Embeds:
Error collecting CodeNarc version
- Groovy version 3.0.9 (superlite)
$ npm-groovy-lint --noserver --config ".groovylintrc.json" --failon warning --verbose
Unable to use CodeNarc JSON result
undefined
Unexpected error: Cannot convert undefined or null to object
TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at processOutput (/usr/local/lib/node_modules/npm-groovy-lint/lib/output.js:109:37)
    at NpmGroovyLint.postProcess (/usr/local/lib/node_modules/npm-groovy-lint/lib/groovy-lint.js:335:39)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async NpmGroovyLint.run (/usr/local/lib/node_modules/npm-groovy-lint/lib/groovy-lint.js: f69:13)
    at async /usr/local/lib/node_modules/npm-groovy-lint/lib/index.js:12:9

I tried different permutations of the command: no flags, different path, different entry point, different image version, but it was always the same issue with CodeNarc unable to start. Any guidance on this would be greatly appreciated.

nvuillam commented 4 months ago

@CliveUnger please can you test with latest version ?

github-actions[bot] commented 3 months ago

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.