siamaksade / tekton-cd-demo

CI/CD demo with Tekton on OpenShift
62 stars 93 forks source link

Bugfix(mvn-builder) #8

Closed jkeam closed 3 years ago

jkeam commented 3 years ago

Bugfix - Mvn Builder

Fixes

  1. Documentation on how to get logs (in README)
  2. Fix failing Sonarqube step (in mvn-task.yaml)

Fix Details

Documentation Bug

This is pretty straightforward, the namespace param was being passed in with the incorrect option.

Sonarqube Bug

The Sonarqube step was failing due to an upgrade in the mvn builder.

Stacktrace:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.080 s
[INFO] Finished at: 2021-04-06T14:29:42Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.8.0.2131:sonar (default-cli) on project spring-petclinic: Unable to load component class org.sonar.plugins.javascript.JavaScriptSensor: ExceptionInInitializerError: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @6cfe48a4 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Sonarqube is pretty picky with the version of mvn/java it uses: https://community.sonarsource.com/t/maven-sonar-scanner-not-working-with-jdk-16/40699

And looks like latest's update broke it.

gcr.io/cloud-builders/mvn, so just pinning it to mvn v3.5 and jdk v8 did the trick.