Run Sonarqube via Github Actions

Hi,

I am trying to use Github Actions to trigger an analysis on a Sonarqube server, but I am having an SSL certificate error:

Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

I know that I need to import the ssl certificate using openssl and Java Keytool, but I don’t kow how to do it in Github Actions. Could you help me with it?

Hey there.

If you’re using GitHub actions (on a runner hosted by GitHub), using a self-signed certificate (which is usually what this error indicates) for the services you’re connecting probably isn’t the right move.

Hi Colin,

Thanks for your answer, the scenario I have really is a Github on a runner hosted by Github and a Sonar Server with a self-signed certificate. Do you have any ideia how can i deal with that?

You can try using the SONAR_ROOT_CERT secret. See https://github.com/SonarSource/sonarqube-scan-action?tab=readme-ov-file#environment-variables:

  • SONAR_ROOT_CERT – Holds an additional root certificate (in PEM format) that is used to validate the SonarQube server certificate. You can set the SONAR_ROOT_CERT environment variable in the “Secrets” settings page of your repository, or you can add them at the level of your GitHub organization (recommended).