SAST spotbugs analyzer cannot set Java version to 11
Summary
Passing SAST_JAVA_VERSION: 11 can't set the version and falls back to 8.
This seems to happen because sdk install java 11 fails (already being installed) and is required before setting the default to 11:
╰─>$ docker run -it --entrypoint bash testspotbugs
bash-5.0# source /usr/local/sdkman/bin/sdkman-init.sh && sdk install java 11.0.6.hs-adpt && sdk default java 11.0.6.hs-adpt
Stop! java 11.0.6.hs-adpt is already installed.
bash-5.0# echo $$
1
Steps to reproduce
- Setup a Java 11 project that includes the SAST template.
- Pass SAST_JAVA_VERSION: 11
Example Project
Example configuration and the related job that fails because the release version is different.
Manually doing the default to java 11 without the install bit works
What is the current bug behavior?
SAST_JAVA_VERSION does not properly set the version to 11.
What is the expected correct behavior?
SAST_JAVA_VERSION should set the version to 11.
Possible fixes
Update the sdk install java to allow failing (since they are already installed)
Workaround
Current workaround in the meantime can be setting SAST_DISABLE_DIND to true, and manually setting the Java version to 11 like in this example script
Edited by Catalin Irimie