github.com/jaylevin/jenkins-library@v1.230.4/resources/metadata/sonarExecuteScan.yaml (about) 1 metadata: 2 name: sonarExecuteScan 3 description: Executes the Sonar scanner 4 longDescription: "The step executes the [sonar-scanner](https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner) 5 cli command to scan the defined sources and publish the results to a SonarQube instance." 6 spec: 7 inputs: 8 secrets: 9 - name: sonarTokenCredentialsId 10 type: jenkins 11 description: "Jenkins 'Secret text' credentials ID containing the token used to authenticate 12 with the Sonar Server." 13 - name: githubTokenCredentialsId 14 type: jenkins 15 description: "Jenkins 'Secret text' credentials ID containing the token used to authenticate 16 with the Github Server." 17 params: 18 - name: instance 19 type: string 20 description: "Jenkins only: The name of the SonarQube instance defined in the Jenkins settings. 21 DEPRECATED: use serverUrl parameter instead" 22 scope: 23 - PARAMETERS 24 - STAGES 25 - STEPS 26 - name: serverUrl 27 aliases: 28 - name: host 29 - name: sonarServerUrl 30 type: string 31 description: "The URL to the Sonar backend." 32 scope: 33 - PARAMETERS 34 - STAGES 35 - STEPS 36 - name: token 37 type: string 38 description: "Token used to authenticate with the Sonar Server." 39 scope: 40 - PARAMETERS 41 secret: true 42 resourceRef: 43 - type: vaultSecret 44 name: sonarVaultSecretName 45 default: sonar 46 - name: sonarTokenCredentialsId 47 type: secret 48 aliases: 49 - name: sonarToken 50 - name: organization 51 type: string 52 description: "SonarCloud.io only: Organization that the project will be assigned to in SonarCloud.io." 53 scope: 54 - PARAMETERS 55 - STAGES 56 - STEPS 57 - name: customTlsCertificateLinks 58 type: "[]string" 59 description: "List of download links to custom TLS certificates. 60 This is required to ensure trusted connections to instances with custom certificates." 61 scope: 62 - PARAMETERS 63 - STAGES 64 - STEPS 65 - name: sonarScannerDownloadUrl 66 type: string 67 description: "URL to the sonar-scanner-cli archive." 68 default: "https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-linux.zip" 69 scope: 70 - PARAMETERS 71 - STAGES 72 - STEPS 73 - name: versioningModel 74 type: string 75 description: "The versioning model used for the version when reporting the results for the project." 76 scope: [GENERAL, STAGES, STEPS, PARAMETERS] 77 default: "major" 78 possibleValues: 79 - major 80 - major-minor 81 - semantic 82 - full 83 - name: version 84 aliases: 85 - name: projectVersion 86 deprecated: true 87 type: string 88 description: "The project version that is reported to SonarQube." 89 scope: 90 - PARAMETERS 91 - STAGES 92 - STEPS 93 resourceRef: 94 - name: commonPipelineEnvironment 95 param: artifactVersion 96 - name: customScanVersion 97 type: string 98 description: "A custom version used along with the uploaded scan results." 99 longDescription: |- 100 Defines a custom version for the Sonar scan which deviates from the typical versioning pattern using [`version`](#version) and [`versioningModel`](#versioningModel). 101 It allows to set non-numeric versions as well and supersedes the value of [`version`](#version) which is calculated automatically. 102 The parameter is also used by other scan steps (e.g. Detect, Fortify, WhiteSource) and thus allows a common custom version across scan tools. 103 scope: [GENERAL, STAGES, STEPS, PARAMETERS] 104 - name: projectKey 105 type: string 106 description: "The project key identifies the project in SonarQube." 107 scope: 108 - PARAMETERS 109 - STAGES 110 - STEPS 111 - name: coverageExclusions 112 type: "[]string" 113 description: "A list of patterns that should be excluded from the coverage scan." 114 scope: 115 - PARAMETERS 116 - STAGES 117 - STEPS 118 - name: inferJavaBinaries 119 type: bool 120 description: "Find the location of generated Java class files in all modules 121 and pass the option `sonar.java.binaries to the sonar tool." 122 scope: 123 - PARAMETERS 124 - STAGES 125 - STEPS 126 - name: inferJavaLibraries 127 type: bool 128 description: "If the parameter `m2Path` is configured for the step `mavenExecute` 129 in the general section of the configuration, pass it as option `sonar.java.libraries` 130 to the sonar tool." 131 scope: 132 - PARAMETERS 133 - STAGES 134 - STEPS 135 - name: options 136 type: "[]string" 137 description: "A list of options which are passed to the sonar-scanner." 138 scope: 139 - PARAMETERS 140 - STAGES 141 - STEPS 142 aliases: 143 - name: sonarProperties 144 deprecated: true 145 # Parameters for non-PR scans 146 - name: branchName 147 type: string 148 description: "Non-Pull-Request only: Name of the SonarQube branch that should be used to report findings to. Automatically inferred from environment variables on supported orchestrators if `inferBranchName` is set to true." 149 scope: 150 - PARAMETERS 151 - STAGES 152 - STEPS 153 - name: inferBranchName 154 type: bool 155 description: "Whether to infer the `branchName` parameter automatically based on the 156 orchestrator-specific environment variable in runs of the pipeline." 157 scope: 158 - PARAMETERS 159 - STAGES 160 - STEPS 161 # Parameters for PR-Handling 162 - name: changeId 163 type: string 164 description: "Pull-Request only: The id of the pull-request. Automatically inferred from environment variables on supported orchestrators." 165 scope: 166 - PARAMETERS 167 - name: changeBranch 168 type: string 169 description: "Pull-Request only: The name of the pull-request branch. Automatically inferred from environment variables on supported orchestrators." 170 scope: 171 - PARAMETERS 172 - name: changeTarget 173 type: string 174 description: "Pull-Request only: The name of the base branch. Automatically inferred from environment variables on supported orchestrators." 175 scope: 176 - PARAMETERS 177 - name: pullRequestProvider 178 type: string 179 description: "Pull-Request only: The scm provider." 180 default: GitHub 181 possibleValues: 182 - GitHub 183 scope: 184 - PARAMETERS 185 - STAGES 186 - STEPS 187 - name: owner 188 type: string 189 description: "Pull-Request only: The owner of the scm repository." 190 scope: 191 - GENERAL 192 - PARAMETERS 193 - STAGES 194 - STEPS 195 aliases: 196 - name: githubOrg 197 resourceRef: 198 - name: commonPipelineEnvironment 199 param: github/owner 200 - name: repository 201 type: string 202 description: "Pull-Request only: The scm repository." 203 scope: 204 - GENERAL 205 - PARAMETERS 206 - STAGES 207 - STEPS 208 aliases: 209 - name: githubRepo 210 resourceRef: 211 - name: commonPipelineEnvironment 212 param: github/repository 213 # Parameters for legacy PR-Handling 214 - name: githubToken 215 type: string 216 description: "Pull-Request only: Token for Github to set status on the Pull-Request." 217 scope: 218 - PARAMETERS 219 secret: true 220 aliases: 221 - name: access_token 222 resourceRef: 223 - name: githubTokenCredentialsId 224 type: secret 225 - type: vaultSecret 226 name: githubVaultSecretName 227 default: github 228 - name: disableInlineComments 229 type: bool 230 description: "Pull-Request only: Disables the pull-request decoration with inline comments. 231 DEPRECATED: only supported in SonarQube < 7.2" 232 scope: 233 - PARAMETERS 234 - STAGES 235 - STEPS 236 - name: legacyPRHandling 237 type: bool 238 description: "Pull-Request only: Activates the pull-request handling using 239 the [GitHub Plugin](https://docs.sonarqube.org/display/PLUG/GitHub+Plugin). 240 DEPRECATED: only supported in SonarQube < 7.2" 241 scope: 242 - PARAMETERS 243 - STAGES 244 - STEPS 245 - name: githubApiUrl 246 type: string 247 description: "Pull-Request only: The URL to the Github API. 248 See [GitHub plugin docs](https://docs.sonarqube.org/display/PLUG/GitHub+Plugin#GitHubPlugin-Usage) 249 DEPRECATED: only supported in SonarQube < 7.2" 250 scope: 251 - GENERAL 252 - PARAMETERS 253 - STAGES 254 - STEPS 255 default: https://api.github.com 256 257 # Global maven settings, should be added to all maven steps 258 - name: m2Path 259 type: string 260 description: "Path to the location of the local repository that should be used." 261 scope: 262 - GENERAL 263 - STEPS 264 - STAGES 265 - PARAMETERS 266 aliases: 267 - name: maven/m2Path 268 269 outputs: 270 resources: 271 - name: reports 272 type: reports 273 params: 274 - filePattern: "**/sonarscan.json" 275 type: sonarqube 276 - filePattern: "**/sonarscan-result.json" 277 type: sonarqube 278 - name: influx 279 type: influx 280 params: 281 - name: step_data 282 fields: 283 - name: sonar 284 type: bool 285 - name: sonarqube_data 286 fields: 287 - name: blocker_issues 288 type: int 289 - name: critical_issues 290 type: int 291 - name: major_issues 292 type: int 293 - name: minor_issues 294 type: int 295 - name: info_issues 296 type: int 297 containers: 298 - name: sonar 299 image: sonarsource/sonar-scanner-cli:4.6