keeganwitt / docker-gradle

Docker images with Gradle
https://hub.docker.com/_/gradle/
Apache License 2.0
143 stars 73 forks source link

gradle:7.6-jdk11 #259

Closed NoxInmortus closed 11 months ago

NoxInmortus commented 11 months ago

Hello, I'm encountering an issue that may be caused by a change in the latest version of the docker image gradle:7.6-jdk11

Host specs:

Debian 11
Linux gitlab-runner-1 5.10.0-24-amd64 #1 SMP Debian 5.10.179-5 (2023-08-08) x86_64 GNU/Linux
Docker version 24.0.5, build ced0996

The previous build dated from the 26th of June went fine, and I noticed that the tag has been updated 17 days ago.

here is the .gitlab-ci.yml used:

image: gradle:7.6-jdk11

variables:
  GRADLE_USER_HOME: '.gradle'
  GRADLE: 'gradle -Dorg.gradle.jvmargs=-XX:MaxMetaspaceSize=512m'
  SONAR: 'https://sonarqube.dom.org'

cache:
  paths:
    - '$GRADLE_USER_HOME'

build:
  script:
    - $GRADLE build --debug

And here is the end of the job output (the previous job which succeed did not have any error nor failed):

> Task :asm:sonar
Error when running: 'node -v'. Is Node.js available during analysis?

> Task :asm-analysis:compileTestJava UP-TO-DATE

> Task :asm-analysis:sonar
Error when running: 'node -v'. Is Node.js available during analysis?

> Task :asm-commons:compileTestJava UP-TO-DATE

> Task :asm-commons:sonar
Error when running: 'node -v'. Is Node.js available during analysis?

> Task :asm-test:compileTestJava UP-TO-DATE
> Task :asm-test:sonar
> Task :asm-tree:compileTestJava UP-TO-DATE
Daemon will be stopped at the end of the build after running out of JVM memory

> Task :asm-tree:sonar
Error when running: 'node -v'. Is Node.js available during analysis?

> Task :asm-util:compileTestJava UP-TO-DATE
> Task :asm-util:sonar FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':asm-util:sonar'.
> Metaspace

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 24s
34 actionable tasks: 12 executed, 22 up-to-date

I tried to run the job either with --info, --debug or --scan without more details. Any idea ?

keeganwitt commented 11 months ago

Are you sure nothing changed in your build? For example, a plugin? The failure seems to be that whatever plugin is running the :asm:sonar tasks requires Node.js. Node.js has never been installed on any of these images.

NoxInmortus commented 11 months ago

It seems we upgraded our Sonarqube instance from 8.9 to 9.9 between the two occurences, and it seems that now nodejs is now required (https://docs.sonarsource.com/sonarqube/9.9/setup-and-upgrade/lts-to-lts-release-upgrade-notes/):

JavaScript, TypeScript, and CSS analysis now requires Node.js 14.17+ (9.7)
In order to analyze Javascript, Typescript, and CSS code, Node.js 14.17+ must be installed on the machine running the scan. We recommend that you use the latest Node.js LTS, which is currently Node.js 18.

Nodejs is already installed on the Sonarqube server, does it means that the "machine running the scan" is the docker-gradle container ?

keeganwitt commented 11 months ago

It sounds like it, yes. The SonarScanner CLI image has Node.js and Java on it, but not Gradle, so that image won't work (unless you change how you're scanning to use the scanner rather than the Gradle plugin).

Unfortunately, I can't think of a solution for this other than to create a new Docker image with this image as the base, and then copy the Node.js install stuff from somewhere like here.