In order to get the build going, the tokens need to be put into the
.travis.yml. This is done using the
travis command unless you want the tokens exposed in your source code. To install this, you need to have Ruby Gems installed so it’s a matter of running the following to install Travis CLI.
gem install travis
In case you get a SSL certificate problem, you can use the following commands to temporarily disable certificate checks then update to get the latest certificates and restore the certificates afterwards.
gem source -r https://rubygems.org/
gem source -a http://rubygems.org/
gem update --system
gem source -r http://rubygems.org/
gem source -a https://rubygems.org/
Once you have the CLI installed run the following (substitute with the proper tokens from earlier steps)
travis encrypt SONAR_TOKEN=<token from sonarqube.com>
travis encrypt SONAR_GITHUB_TOKEN=<token from github.com>
Finally, push your changes and Travis should start working and hook up with SonarQube look at the log to get the URL for SonarQube for your project. You can them do a push in a pull request to see it analyzed by SonarQube as well.