Latest sonar-scanner-cli with "shell not found" error

  • Latest version of sonar-scanner-cli image with sonarqube 10.4.1
  • sonar-scanner-cli integrated in a gitlab pipeline

With the latest version of sonar-scanner-cli image, we got the following error

Checking out 12345678 as refs/merge-requests/1400/head...
Skipping Git submodules setup
Checking cache for sonarqubeCheck-1...
No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted. 
Successfully extracted cache
Downloading artifacts for unitTest (75225)...
Downloading artifacts from coordinator... ok        id=75225 responseStatus=200 OK token=xxxxxxxx
shell not found
shell not found
ERROR: Job failed: exit code 1

It stop working on 24th september, when reverting the image from “latest” to the “5.0.1” version, it works fine.

This is our gitlab yaml file

sonarqubeCheck:
  stage: sonarqube
  dependencies:
    - unitTest
  image:
    name: sonarsource/sonar-scanner-cli:latest
  tags:
    - docker
  variables:
    SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" 
    GIT_DEPTH: "0" 
  cache:
    key: "${CI_JOB_NAME}"
    paths:
      - .sonar/cache
  script:
    - git -c http.sslVerify=false clone  https://**MASKED__A_GIT_REPO_WITH_CONFIG_FILES**

    [...]
    
    - sonar-scanner -Dsonar.qualitygate.wait=true

Hi @sarbyn

I just gave a quick try with a simple pipeline, and this is working fine:

sonarqubeCheck:
  stage: test
  image:
    name: sonarsource/sonar-scanner-cli:latest
  variables:
    SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" 
    GIT_DEPTH: "0" 
  cache:
    key: "${CI_JOB_NAME}"
    paths:
      - .sonar/cache
  script:
    - git -v
    - sonar-scanner -Dsonar.qualitygate.wait=true

I suspect one of your operations in your script […] is causing the issue. We have changed the base Docker image from Alpine to AmazonLinux, and we have also removed root access, so maybe one of those is responsible for the issue.
Can you try to pinpoint the exact command causing the shell not found?

Best,

This is my script block, the first command is a GIT checkout, the following are some “echo” of custom variables to a file
Maybe the “echo” command is not available on AmazonLinux image?

script:
    - git -c http.sslVerify=false clone  https://**MASKED__A_GIT_REPO_WITH_CONFIG_FILES**
    - echo "sonar.projectKey=$SONARQUBE_PROJECT_KEY" >> xxx/yyy/zzz/android.properties
    - echo "sonar.projectName=$SONARQUBE_PROJECT_NAME" >> xxx/yyy/zzz/android.properties
    - echo "sonar.projectVersion=$VERSION" >> xxx/yyy/zzz/android.properties
    - echo "sonar.login=$SONARQUBE_TOKEN" >> xxx/yyy/zzz/android.properties
    - cp xxx/yyy/zzz/android.properties sonar-project.properties
    - sonar-scanner -Dsonar.qualitygate.wait=true

I found a suggestion here:

Can you try adding an entrypoint maybe:

  image:
    name: sonarsource/sonar-scanner-cli:latest
    entrypoint: [ '/bin/bash', '-c' ]

Using this image config

  image:
    name: sonarsource/sonar-scanner-cli:latest
    entrypoint: [ '/bin/bash', '-c' ]

The error now is the following (the first script test, git -c http.sslVerify=false clone https://MASKED__A_GIT_REPO_WITH_CONFIG_FILES)

Cloning into 'xxxyyyy'...
 fatal: unable to access 'https://repo_server/repo.git/': getaddrinfo() thread failed to start

Could this be helpful?