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