Search code examples
jenkinssonarqubeparameterized

Output sonarqube result to different server locations


Is there a way to output SonarQube results to 2 different server locations through a Jenkins configuration, using a single Jenkins build for each SonarQube output?

I know Jenkins has a concept of parameterized build where the build could be parameterized by the Sonar Server name.


Solution

  • I guess that you are talking about the parameterized plugin: https://wiki.jenkins.io/display/JENKINS/Parameterized+Trigger+Plugin

    This plugin let you provide data when you trigger the build. This is a great plugin when your builds trigger each others, and you need data from a previous build executed on another slave.

    If you want a single build, and the Sonar Server Name is determined inside the build, you will need to find your way using Shell.

    Get it at some point:

    SONAR_NAME=$( .... )
    

    and re-use it within the same build:

    ssh $SONAR_NAME@....