Unable to download build wrapper as indicated in documentation

Sonarqube version : Docker developer edition–> sonarqube:8.4.1-developer
Licence activated with Features included

  • Analysis of ABAP
  • Analysis of C/C++
  • Analysis of Objective-C
  • Analysis of PL/SQL
  • Analysis of Swift
  • Analysis of T-SQL
  • Analysis of VB.NET
  • Branch Analysis
  • SonarLint Smart Notifications
  • Vulnerability Analysis

I try to install build wrapper on my debian machine but all I try indicate me that the “build-wrapper-linux-x86.zip” is not found.

Service is accessible from the internet AND locally and both failed to get me the zip with error “HTTP Status 404”

Step to reproduce :

  1. Read docuementation here : https://docs.sonarqube.org/latest/analysis/languages/cfamily/

  2. Enter adress : {SonarQube URL}/static/cpp/build-wrapper-linux-x86.zip as mentionned in the doc
    In my case at my local adress http://192.168.XX.YY:9000/static/cpp/build-wrapper-linux-x86.zip
    OR via my internet connection : https://myPublicAdress.com/sonarqube/static/cpp/build-wrapper-linux-x86.zip

  3. Expected result : Zip is downloaded locally
    Current result : "HTTP Status 404"

image

Extract form my docker-compose.yml :

version: '2'
services:
  sonarqube:
    image: 'sonarqube:8.4.1-developer'
    container_name: sonarqube

restart: always
hostname: 'sonarqube.publicAdresse.com'
environment:
  - SONARQUBE_JDBC_URL=jdbc:postgresql://localhost:5432/sonarqube_DB
  - SONARQUBE_JDBC_USERNAME=sonarqube
  - SONARQUBE_JDBC_PASSWORD=PWD


command: -Dsonar.web.context=/sonarqube

ports:
  - '9000:9000'
  - '9080:80'
  - '9443:443'

volumes:
  - '/srv/sonarqube/sonarqube_logs:/opt/sonarqube/logs'
  - '/srv/sonarqube/sonarqube_data:/opt/sonarqube/data'
  - '/srv/sonarqube/sonarqube_extentions:/opt/sonarqube/extensions'
  - '/srv/sonarqube/sonarqube_conf:/opt/sonarqube/conf'

network_mode: "host"   #to make link with localhost key word above and host machine

Do I miss Something ? Is this download working properly with a docker image of sonarqube ?

Hi @Vince3S ,

I tried to reproduce it but it is working as expected with this docker image.

In this case the sonar.web.context is missing from the url(which you can set via the environment variable SONAR_WEB_CONTEXT btw). so http://192.168.XX.YY:9000/sonarqube/static/cpp/build-wrapper-linux-x86.zip should work.

to what did you set the Server base URL in you sonarqube instance (Administration → Configuration → General → Server base URL)?

Hi Tobias,

My sonar.web.context is present in the extract I put in the initial post. The value is /sonarqube.

Please find the content of my Server base URL, which is empty.

Is it normal ?

Best regards,

Hi @Vince3S ,

yeah the context was missing from the URL you specified to download the build wrapper from. you wrote

And it should be

The base URL should not matter when accessing sonarqube via ip, so let’s not focus on it right now. i just wanted to make sure that nothing strange was going on there.
When you access sonarqube via IP, is there a reverse proxy in front of the application?

Ahh Ok. Yes I tried both in fact without success:
http://192.168.XX.YY:9000/static/cpp/build-wrapper-linux-x86.zip

and
http://192.168.XX.YY:9000/sonarqube/static/cpp/build-wrapper-linux-x86.zip

For the proxy as I am in local and http only I suppose it is not used. I Only set proxy for message over https (port 443). Please find an extract of the proxy conf :

    <VirtualHost *:443>
    DocumentRoot "/var/www"
    ServerAdmin webmaster@localhost
    SSLProxyEngine On
    ProxyPreserveHost On
    #Add by VDE for sonarqube conf
    ProxyRequests Off
    Servername www.mypublicIp.com

    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>


    #Sonarqube conf added by VDE 
    ProxyPass /sonarqube http://192.168.XX.YY:9000/sonarqube
    ProxyPassReverse /sonarqube http://192.168.XX.YY:9000/sonarqube

    #VDE for sonarqube 
    RequestHeader set X-Forwarded-Port "443"
    RequestHeader set X-Forwarded-Proto "https"

PS : I’m not an expert in Proxy or proxy settings

I try also locally on the server via command line following :

try to download with wget the file :

~/docker-sonarqube$  wget http://192.168.XX.YY:9000/static/cpp/build-wrapper-linux-x86.zip
--2020-09-25 10:46:52--  http://192.168.XX.YY:9000/static/cpp/build-wrapper-linux-x86.zip
Connexion à 192.168.XX.YY:9000… connecté.
requête HTTP transmise, en attente de la réponse… 404
2020-09-25 10:46:52 erreur 404 : (pas de description).

~/docker-sonarqube$ wget http://192.168.XX.YY:9000/sonarqube/static/cpp/build-wrapper-linux-x86.zip
--2020-09-25 10:48:01--  http://192.168.XX.YY:9000/sonarqube/static/cpp/build-wrapper-linux-x86.zip
Connexion à 192.168.XX.YY:9000… connecté.
requête HTTP transmise, en attente de la réponse… 404
2020-09-25 10:48:01 erreur 404 : (pas de description).

~/docker-sonarqube$  wget http://localhost:9000/sonarqube/static/cpp/build-wrapper-linux-x86.zip
--2020-09-25 10:48:18--  http://localhost:9000/sonarqube/static/cpp/build-wrapper-linux-x86.zip
Résolution de localhost (localhost)… 127.0.0.1
Connexion à localhost (localhost)|127.0.0.1|:9000… connecté.
requête HTTP transmise, en attente de la réponse… 404
2020-09-25 10:48:18 erreur 404 : (pas de description).

~/docker-sonarqube$  wget http://localhost:9000/static/cpp/build-wrapper-linux-x86.zip
--2020-09-25 10:48:23--  http://localhost:9000/static/cpp/build-wrapper-linux-x86.zip
Résolution de localhost (localhost)… 127.0.0.1
Connexion à localhost (localhost)|127.0.0.1|:9000… connecté.
requête HTTP transmise, en attente de la réponse… 404
2020-09-25 10:48:23 erreur 404 : (pas de description).

Still 404 error … I do not understand why it does not work even on the server itself. I can only think of an issue or something that goes wrong in the docker… @Tobias_Trabelsi, any suggestion or test to do ?

okay let’s step back for a second and try to recreate the problem. i have this docker-compose.yml here and confirmed that this is working.

version: "3"

services:
  sonarqube:
    image: sonarqube:8.4.2-developer
    depends_on:
      - db
    environment:
      SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
      SONAR_JDBC_USERNAME: sonar
      SONAR_JDBC_PASSWORD: sonar
      SONAR_WEB_CONTEXT: /sonarqube
    volumes:
      - sonarqube_data:/opt/sonarqube/data
      - sonarqube_extensions:/opt/sonarqube/extensions
      - sonarqube_logs:/opt/sonarqube/logs
      - sonarqube_temp:/opt/sonarqube/temp
    ports:
      - "9000:9000"
  db:
    image: postgres:12
    environment:
      POSTGRES_USER: sonar
      POSTGRES_PASSWORD: sonar
    volumes:
      - postgresql:/var/lib/postgresql
      - postgresql_data:/var/lib/postgresql/data

volumes:
  sonarqube_data:
  sonarqube_extensions:
  sonarqube_logs:
  sonarqube_temp:
  postgresql:
  postgresql_data:
wget http://localhost:9000/sonarqube/static/cpp/build-wrapper-linux-x86.zip

--2020-09-25 11:18:48--  http://localhost:9000/sonarqube/static/cpp/build-wrapper-linux-x86.zip
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:9000... connected.
HTTP request sent, awaiting response... 200 
Length: unspecified [application/zip]
Saving to: ‘build-wrapper-linux-x86.zip’

build-wrapper-linux-x86.zip                                                         [ <=>                                                                                                                                                                                                   ] 538.34K  --.-KB/s    in 0.02s   

2020-09-25 11:18:48 (27.9 MB/s) - ‘build-wrapper-linux-x86.zip’ saved [551260]

now let’s take a look at your setup.
First think that comes into my mind would be that your directory mounts are not cleaned (which btw you should not use anyway). i could recreate this by using the compose file first with a community image and the developer image afterwards. this resulted in the extensions volume already populated with the plugins from the community edition and a 404 on the download on the build wrapper, so please check that.
The second thing that i already noted is that you set the sonar.web.context via a command, so please switch this to the environment variable SONAR_WEB_CONTEXT to not interfere with something here.
The last thing that i could think of is a /static rule in your reverse proxy somewhere, so please try to download the file for debugging purposes without it.

hope that gives some clarity on this issue :slight_smile:

1 Like

Ok I’ll try it now and will let you know, thanks !

Hi @Tobias_Trabelsi,

Your first point was the correct one :
First think that comes into my mind would be that your directory mounts are not cleaned (which btw you should not use anyway). i could recreate this by using the compose file first with a community image and the developer image afterwards. this resulted in the extensions volume already populated with the plugins from the community edition and a 404 on the download on the build wrapper, so please check that.

I change my bind mounts to volume as you suggest and it works fine now !

Zip is accessible from my public adress correctly !

Thanks a lot !

1 Like

you are welcome. glad that it’s working for you now :slight_smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.