1 // Jest Snapshot v1, https://goo.gl/fbAQLP
3 exports[`should follow and complete all steps: .NET: gitlab-ci.yml 1`] = `
4 "image: mcr.microsoft.com/dotnet/sdk:7.0
7 SONAR_USER_HOME: "\${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
8 GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
12 - sonarqube-vulnerability-report
15 stage: sonarqube-check
18 - "dotnet tool install --global dotnet-sonarscanner"
19 - "export PATH=\\"$PATH:$HOME/.dotnet/tools\\""
20 - "dotnet sonarscanner begin /k:\\"my-project\\" /d:sonar.token=\\"$SONAR_TOKEN\\" /d:\\"sonar.host.url=$SONAR_HOST_URL\\" "
22 - "dotnet sonarscanner end /d:sonar.token=\\"$SONAR_TOKEN\\""
25 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
26 - if: $CI_COMMIT_BRANCH == 'master'
27 - if: $CI_COMMIT_BRANCH == 'main'
28 - if: $CI_COMMIT_BRANCH == 'develop'
30 sonarqube-vulnerability-report:
31 stage: sonarqube-vulnerability-report
33 - 'curl -u "\${SONAR_TOKEN}:" "\${SONAR_HOST_URL}/api/issues/gitlab_sast_export?projectKey=my-project&branch=\${CI_COMMIT_BRANCH}&pullRequest=\${CI_MERGE_REQUEST_IID}" -o gl-sast-sonar-report.json'
36 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
37 - if: $CI_COMMIT_BRANCH == 'master'
38 - if: $CI_COMMIT_BRANCH == 'main'
39 - if: $CI_COMMIT_BRANCH == 'develop'
43 sast: gl-sast-sonar-report.json
47 exports[`should follow and complete all steps: CPP - manual: gitlab-ci.yml 1`] = `
51 SONAR_USER_HOME: "\${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
52 GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
53 BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
58 - sonarqube-vulnerability-report
64 key: "\${CI_COMMIT_SHORT_SHA}"
69 # Download sonar-scanner
70 - curl -sSLo ./sonar-scanner.zip 'https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.1.0.4477-linux-x64.zip'
71 - unzip -o sonar-scanner.zip
72 - mv sonar-scanner-6.1.0.4477-linux-x64 sonar-scanner
73 # Download build-wrapper
74 - curl -sSLo ./build-wrapper-linux-x86.zip "$SONAR_HOST_URL/static/cpp/build-wrapper-linux-x86.zip"
75 - unzip -o build-wrapper-linux-x86.zip
76 - mv build-wrapper-linux-x86 build-wrapper
79 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
80 - if: $CI_COMMIT_BRANCH == 'master'
81 - if: $CI_COMMIT_BRANCH == 'main'
82 - if: $CI_COMMIT_BRANCH == 'develop'
87 - build-wrapper/build-wrapper-linux-x86-64 --out-dir "\${BUILD_WRAPPER_OUT_DIR}" <your clean build command>
88 - sonar-scanner/bin/sonar-scanner --define sonar.host.url="\${SONAR_HOST_URL}" --define sonar.cfamily.compile-commands="\${BUILD_WRAPPER_OUT_DIR}/compile_commands.json"
91 key: "\${CI_COMMIT_SHORT_SHA}"
96 sonarqube-vulnerability-report:
97 stage: sonarqube-vulnerability-report
99 - 'curl -u "\${SONAR_TOKEN}:" "\${SONAR_HOST_URL}/api/issues/gitlab_sast_export?projectKey=my-project&branch=\${CI_COMMIT_BRANCH}&pullRequest=\${CI_MERGE_REQUEST_IID}" -o gl-sast-sonar-report.json'
102 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
103 - if: $CI_COMMIT_BRANCH == 'master'
104 - if: $CI_COMMIT_BRANCH == 'main'
105 - if: $CI_COMMIT_BRANCH == 'develop'
109 sast: gl-sast-sonar-report.json
113 exports[`should follow and complete all steps: CPP: gitlab-ci.yml 1`] = `
117 SONAR_USER_HOME: "\${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
118 GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
124 - sonarqube-vulnerability-report
130 key: "\${CI_COMMIT_SHORT_SHA}"
135 # Download sonar-scanner
136 - curl -sSLo ./sonar-scanner.zip 'https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.1.0.4477-linux-x64.zip'
137 - unzip -o sonar-scanner.zip
138 - mv sonar-scanner-6.1.0.4477-linux-x64 sonar-scanner
141 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
142 - if: $CI_COMMIT_BRANCH == 'master'
143 - if: $CI_COMMIT_BRANCH == 'main'
144 - if: $CI_COMMIT_BRANCH == 'develop'
147 stage: sonarqube-check
152 key: "\${CI_COMMIT_SHORT_SHA}"
156 script: sonar-scanner/bin/sonar-scanner --define sonar.host.url="\${SONAR_HOST_URL}"
159 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
160 - if: $CI_COMMIT_BRANCH == 'master'
161 - if: $CI_COMMIT_BRANCH == 'main'
162 - if: $CI_COMMIT_BRANCH == 'develop'
164 sonarqube-vulnerability-report:
165 stage: sonarqube-vulnerability-report
167 - 'curl -u "\${SONAR_TOKEN}:" "\${SONAR_HOST_URL}/api/issues/gitlab_sast_export?projectKey=my-project&branch=\${CI_COMMIT_BRANCH}&pullRequest=\${CI_MERGE_REQUEST_IID}" -o gl-sast-sonar-report.json'
170 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
171 - if: $CI_COMMIT_BRANCH == 'master'
172 - if: $CI_COMMIT_BRANCH == 'main'
173 - if: $CI_COMMIT_BRANCH == 'develop'
177 sast: gl-sast-sonar-report.json
181 exports[`should follow and complete all steps: CPP: sonar-project.properties 1`] = `
182 "sonar.projectKey=my-project
183 sonar.qualitygate.wait=true
187 exports[`should follow and complete all steps: Dart: gitlab-ci.yml 1`] = `
188 "image: ghcr.io/cirruslabs/flutter:stable
191 SONAR_USER_HOME: "\${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
192 GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
197 - sonarqube-vulnerability-report
203 key: "\${CI_COMMIT_SHORT_SHA}"
208 # Download sonar-scanner
209 - curl -sSLo ./sonar-scanner.zip 'https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.1.0.4477-linux-x64.zip'
210 - unzip -o sonar-scanner.zip
211 - mv sonar-scanner-6.1.0.4477-linux-x64 sonar-scanner
214 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
215 - if: $CI_COMMIT_BRANCH == 'master'
216 - if: $CI_COMMIT_BRANCH == 'main'
217 - if: $CI_COMMIT_BRANCH == 'develop'
220 stage: sonarqube-check
223 - <commands to build your project>
224 - sonar-scanner/bin/sonar-scanner --define sonar.host.url="\${SONAR_HOST_URL}"
227 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
228 - if: $CI_COMMIT_BRANCH == 'master'
229 - if: $CI_COMMIT_BRANCH == 'main'
230 - if: $CI_COMMIT_BRANCH == 'develop'
232 sonarqube-vulnerability-report:
233 stage: sonarqube-vulnerability-report
235 - 'curl -u "\${SONAR_TOKEN}:" "\${SONAR_HOST_URL}/api/issues/gitlab_sast_export?projectKey=my-project&branch=\${CI_COMMIT_BRANCH}&pullRequest=\${CI_MERGE_REQUEST_IID}" -o gl-sast-sonar-report.json'
238 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
239 - if: $CI_COMMIT_BRANCH == 'master'
240 - if: $CI_COMMIT_BRANCH == 'main'
241 - if: $CI_COMMIT_BRANCH == 'develop'
245 sast: gl-sast-sonar-report.json
249 exports[`should follow and complete all steps: Dart: sonar-project.properties 1`] = `
250 "sonar.projectKey=my-project
251 sonar.qualitygate.wait=true
255 exports[`should follow and complete all steps: Gradle: gitlab-ci.yml 1`] = `
256 "image: gradle:8.2.0-jdk17-jammy
259 SONAR_USER_HOME: "\${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
260 GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
264 - sonarqube-vulnerability-report
267 stage: sonarqube-check
272 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
273 - if: $CI_COMMIT_BRANCH == 'master'
274 - if: $CI_COMMIT_BRANCH == 'main'
275 - if: $CI_COMMIT_BRANCH == 'develop'
277 sonarqube-vulnerability-report:
278 stage: sonarqube-vulnerability-report
280 - 'curl -u "\${SONAR_TOKEN}:" "\${SONAR_HOST_URL}/api/issues/gitlab_sast_export?projectKey=my-project&branch=\${CI_COMMIT_BRANCH}&pullRequest=\${CI_MERGE_REQUEST_IID}" -o gl-sast-sonar-report.json'
283 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
284 - if: $CI_COMMIT_BRANCH == 'master'
285 - if: $CI_COMMIT_BRANCH == 'main'
286 - if: $CI_COMMIT_BRANCH == 'develop'
290 sast: gl-sast-sonar-report.json
294 exports[`should follow and complete all steps: Groovy: build.gradle 1`] = `
296 id "org.sonarqube" version "5.1.0.4882"
301 property "sonar.projectKey", "my-project"
302 property "sonar.projectName", "MyProject"
303 property "sonar.qualitygate.wait", true
308 exports[`should follow and complete all steps: Kotlin: build.gradle.kts 1`] = `
310 id ("org.sonarqube") version "5.1.0.4882"
315 property("sonar.projectKey", "my-project")
316 property("sonar.projectName", "MyProject")
317 property("sonar.qualitygate.wait", true)
322 exports[`should follow and complete all steps: Maven: gitlab-ci.yml 1`] = `
323 "image: maven:3-eclipse-temurin-17
326 SONAR_USER_HOME: "\${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
327 GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
331 - sonarqube-vulnerability-report
334 stage: sonarqube-check
337 - mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
340 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
341 - if: $CI_COMMIT_BRANCH == 'master'
342 - if: $CI_COMMIT_BRANCH == 'main'
343 - if: $CI_COMMIT_BRANCH == 'develop'
345 sonarqube-vulnerability-report:
346 stage: sonarqube-vulnerability-report
348 - 'curl -u "\${SONAR_TOKEN}:" "\${SONAR_HOST_URL}/api/issues/gitlab_sast_export?projectKey=my-project&branch=\${CI_COMMIT_BRANCH}&pullRequest=\${CI_MERGE_REQUEST_IID}" -o gl-sast-sonar-report.json'
351 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
352 - if: $CI_COMMIT_BRANCH == 'master'
353 - if: $CI_COMMIT_BRANCH == 'main'
354 - if: $CI_COMMIT_BRANCH == 'develop'
358 sast: gl-sast-sonar-report.json
362 exports[`should follow and complete all steps: Maven: pom.xml 1`] = `
364 <sonar.projectKey>my-project</sonar.projectKey>
365 <sonar.projectName>MyProject</sonar.projectName>
366 <sonar.qualitygate.wait>true</sonar.qualitygate.wait>
370 exports[`should follow and complete all steps: Other: gitlab-ci.yml 1`] = `
372 name: sonarsource/sonar-scanner-cli:latest
376 SONAR_USER_HOME: "\${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
377 GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
381 - sonarqube-vulnerability-report
384 stage: sonarqube-check
387 - sonar-scanner --define sonar.host.url="\${SONAR_HOST_URL}"
390 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
391 - if: $CI_COMMIT_BRANCH == 'master'
392 - if: $CI_COMMIT_BRANCH == 'main'
393 - if: $CI_COMMIT_BRANCH == 'develop'
395 sonarqube-vulnerability-report:
396 stage: sonarqube-vulnerability-report
398 - 'curl -u "\${SONAR_TOKEN}:" "\${SONAR_HOST_URL}/api/issues/gitlab_sast_export?projectKey=my-project&branch=\${CI_COMMIT_BRANCH}&pullRequest=\${CI_MERGE_REQUEST_IID}" -o gl-sast-sonar-report.json'
401 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
402 - if: $CI_COMMIT_BRANCH == 'master'
403 - if: $CI_COMMIT_BRANCH == 'main'
404 - if: $CI_COMMIT_BRANCH == 'develop'
408 sast: gl-sast-sonar-report.json
412 exports[`should follow and complete all steps: Other: sonar-project.properties 1`] = `
413 "sonar.projectKey=my-project
414 sonar.qualitygate.wait=true
418 exports[`should follow and complete all steps: sonar token key 1`] = `"SONAR_TOKEN"`;
420 exports[`should follow and complete all steps: sonarqube host url key 1`] = `"SONAR_HOST_URL"`;
422 exports[`should follow and complete all steps: sonarqube host url value 1`] = `"http://localhost:9000"`;