Closed meodemsao closed 5 years ago
Please check whether your SonarQube is accessable. For example, request the url of sonar_host/batch/index in your localhost or Drone server.
@roganw i request sonar_host/batch/index return
sonar-scanner-engine-shaded-7.6-all.jar|993f707e3af7ba4f46f121039128516b
And if you do find that SonarQube is accessible, check to see if you're pulling the right drone-sonar-plugin image for your version of drone.
I'm using v1 of drone and I found out that I needed to pull a tagged version of this plugin, as below:
image: aosapps/drone-sonar-plugin:1.0
@fptiangco I using drone v1 with image: aosapps/drone-sonar-plugin:1.0
and have same error
02:27:27.962 DEBUG: Extract sonar-scanner-api-batch in temp...
15 | 02:27:27.977 DEBUG: Get bootstrap index...
16 | 02:27:27.978 DEBUG: Download: http://x.x.x.x:9001/batch/index
17 | 02:27:28.031 ERROR: SonarQube server [http://x.x.x.x:9001] can not be reached
18 | 02:27:28.031 INFO: ------------------------------------------------------------------------
19 | 02:27:28.031 INFO: EXECUTION FAILURE
20 | 02:27:28.031 INFO: ------------------------------------------------------------------------
21 | 02:27:28.032 INFO: Total time: 0.550s
22 | 02:27:28.064 INFO: Final Memory: 4M/151M
23 | 02:27:28.065 INFO: ------------------------------------------------------------------------
24 | 02:27:28.065 ERROR: Error during SonarQube Scanner execution
25 | 02:27:28.065 ERROR: Unable to execute SonarQube
26 | 02:27:28.065 ERROR: Caused by: Fail to get bootstrap index from server
27 | 02:27:28.065 ERROR: Caused by: Status returned by url [http://x.x.x.x:9001/batch/index] is not valid: [404]
28 | 02:27:28.065 ERROR:
29 | 02:27:28.065 ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.`
And my sonar docker-compose config
```yaml
version: "3"
services:
sonarqube:
image: sonarqube
ports:
- 9001:9000
networks:
- sonarnet
environment:
- sonar.jdbc.url=jdbc:postgresql://db:5432/sonar
volumes:
- sonarqube_conf:/opt/sonarqube/conf
- sonarqube_data:/opt/sonarqube/data
- sonarqube_extensions:/opt/sonarqube/extensions
db:
image: postgres
networks:
- sonarnet
environment:
- POSTGRES_USER=sonar
- POSTGRES_PASSWORD=sonar
volumes:
- postgresql:/var/lib/postgresql
# This needs explicit mapping due to https://github.com/docker-library/postgres/blob/4e48e3228a30763913ece952c611e5e9b95c8759/Dockerfile.template#L52
- postgresql_data:/var/lib/postgresql/data
networks:
sonarnet:
driver: bridge
volumes:
sonarqube_conf:
sonarqube_data:
sonarqube_extensions:
postgresql:
postgresql_data:`
I fixed this by using the following config
- name: code-analysis
image: aosapps/drone-sonar-plugin
environment:
SONAR_HOST:
from_secret: sonar_host
SONAR_TOKEN:
from_secret: sonar_token
That being said; The plugins.drone.io information definitely needs to be updated
Found the actual issue: https://hub.docker.com/r/aosapps/drone-sonar-plugin/tags
latest
has not been updated for 7 months, use the 1.0
tag
@meodemsao It's 404 while requesting [http://x.x.x.x:9001/batch/index] in your Drone Server.
Status returned by url [http://x.x.x.x:9001/batch/index] is not valid: [404]
@roganw i using browser return
sonar-scanner-engine-shaded-7.6-all.jar|993f707e3af7ba4f46f121039128516b
I have issue run lastest drone-sonar-plugin
my config