sonar-scanner-cli sonar-scanner-cli

Invokes scan using Sonarqube, step is not compatible with C/C++/Objective-C projects. Requires sonar-project.properties file with Project Name and Key defined. Documentation - https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/


  • SONAR_CLI_IMAGE - The Docker image registry/image for step.
  • SONAR_HOST_URL - the server URL
  • SONAR_LOGIN - The login or authentication token of a SonarQube user with Execute Analysis permission on the project.
  • SONAR_PASSWORD - The password that goes with the sonar.login username. This should be left blank if an authentication token is being used.
  • SONAR_PROJECT_BASE_DIR - Use this property when you need analysis to take place in a directory other than the one from which it was launched. E.G. analysis begins from jenkins/jobs/myjob/workspace but the files to be analyzed are in ftpdrop/cobol/project1. The path may be relative or absolute. Specify not the the source directory, but some parent of the source directory. The value specified here becomes the new 'analysis directory', and other paths are then specified as though the analysis were starting from the specified value of sonar.projectBaseDir. Note that the analysis process will need write permissions in this directory; it is where the sonar.working.directory will be created.
  • SONAR_SCANNER_CLI_VERSION - Version of Sonar Scanner CLI to use, Docker image tag.
  type: sonar-scanner-cli
    SONAR_HOST_URL: 'http://foo.acme:9000'
    SONAR_LOGIN: username or key
    SONAR_PASSWORD: password if username is used
    SONAR_PROJECT_BASE_DIR: set working directory for analysis

Dustin Van Buskirk
Feb 19, 2021