Tekton task 'sonarqube-scanner' fails on jdk error

67 views Asked by At

The pipeline with git > maven > dockerbuild > etc ran well.

After inserting the 'sonarqube-scanner' task between maven and dockerbuild, I got this error:

Error: dl failure on line 631
Error: failed /usr/lib/jvm/java-11-openjdk/lib/server/libjvm.so, because Error loading shared library
/usr/lib/jvm/java-11-openjdk/lib/server/libjvm.so: Exec format error

The sonarqube-scanner version 0.4 is installed.

The 'sonar-properties-create' step was done succesfully.

This is the pipeline I fit the taskref in:

- name: code-analysis
  taskRef:
    name: sonarqube-scanner
  runAfter:
    - maven
  params:
    - name: SONAR_HOST_URL
      value: http://localhost:9000
    - name: SONAR_PROJECT_KEY
      value: quotes
  workspaces:
    - name: source
      workspace: source-workspace
    - name: sonar-settings
      workspace: sonar-settings

The source code uses JDK17.

1

There are 1 answers

0
tm1701 On BEST ANSWER

In many Tekton (default) tasks you can configure the specific Docker image to do the 'heavy lifting'. In this case you can specify a container as a parameter:

SONAR_SCANNER_IMAGE: The sonarqube scanner CLI image which will run the scan (Default: docker.io/sonarsource/sonar-scanner-cli:4.6)

In this case the default image refers to a quite old version of the Docker 'sonarsource/sonar-scanner-cli' image. The complete list of versions you can find in the image on Docker hub.

Just add something like this to your pipeline:

- name: code-analysis
  taskRef:
    name: sonarqube-scanner
  runAfter:
    - maven
  params:
    - name: SONAR_HOST_URL
      value: http://localhost:9000
    - name: SONAR_PROJECT_KEY
      value: quotes
    - name: SONAR_SCANNER_IMAGE
      value: sonarsource/sonar-scanner-cli:5
  workspaces:
    - name: source
      workspace: source-workspace
    - name: sonar-settings
      workspace: sonar-settings

Be sure to use a newer SonarQube Docker image, otherwise you will face Bootstrap (loading ... ) issues.