We gave up in the Sonar plugin as it was not working as intended, including crashing the pipelines IIRC. Instead we just embed Sonar Scanner into our CI container and call it as a regular process.
This has worked well for us for the past 5 years. The ‘downside’ is that we need to pass the sonar token explicitly to the step, but we are going to address that by writing a custom step that will get the creds and call the scanner in one line.
Note that for SonarCloud the Scanner does require JRE 17, even if you are scanning for java 11 code:
The scanner can be downloaded, with a compatible JRE here:
To test the network connectivity between your EC2 instance and Sonarcloud I would not use ping as ping is disabled on a lot of servers nowadays.
Try this:
curl https://sonarcloud.io/api/webservices/list
This should dump a big json document defining the SonarCloud API. If you can retrieve it with curl
or wget
then you know your EC2 instance is capable of communicating with the SonarCloud API.