123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- // Jest Snapshot v1, https://goo.gl/fbAQLP
-
- exports[`should follow and complete all steps: .NET: gitlab-ci.yml 1`] = `
- "stages:
- - sonarqube-check
- - sonarqube-vulnerability-report
-
- sonarqube-check:
- stage: sonarqube-check
- image: mcr.microsoft.com/dotnet/sdk:7.0
- variables:
- SONAR_USER_HOME: "\${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
- GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
- cache:
- key: "\${CI_JOB_NAME}"
- paths:
- - .sonar/cache
- script:
- - "apt-get update"
- - "apt-get install --yes --no-install-recommends openjdk-17-jre"
- - "dotnet tool install --global dotnet-sonarscanner"
- - "export PATH=\\"$PATH:$HOME/.dotnet/tools\\""
- - "dotnet sonarscanner begin /k:\\"my-project\\" /d:sonar.token=\\"$SONAR_TOKEN\\" /d:\\"sonar.host.url=$SONAR_HOST_URL\\" "
- - "dotnet build"
- - "dotnet sonarscanner end /d:sonar.token=\\"$SONAR_TOKEN\\""
- allow_failure: true
- only:
- - merge_requests
- - master
- - main
- - develop
-
- sonarqube-vulnerability-report:
- stage: sonarqube-vulnerability-report
- script:
- - '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'
- allow_failure: true
- only:
- - merge_requests
- - master
- - main
- - develop
- artifacts:
- expire_in: 1 day
- reports:
- sast: gl-sast-sonar-report.json
- dependencies:
- - sonarqube-check
- "
- `;
-
- exports[`should follow and complete all steps: Gradle: gitlab-ci.yml 1`] = `
- "stages:
- - sonarqube-check
- - sonarqube-vulnerability-report
-
- sonarqube-check:
- stage: sonarqube-check
- image: gradle:8.2.0-jdk17-jammy
- variables:
- SONAR_USER_HOME: "\${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
- GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
- cache:
- key: "\${CI_JOB_NAME}"
- paths:
- - .sonar/cache
- script: gradle sonar
- allow_failure: true
- only:
- - merge_requests
- - master
- - main
- - develop
-
- sonarqube-vulnerability-report:
- stage: sonarqube-vulnerability-report
- script:
- - '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'
- allow_failure: true
- only:
- - merge_requests
- - master
- - main
- - develop
- artifacts:
- expire_in: 1 day
- reports:
- sast: gl-sast-sonar-report.json
- dependencies:
- - sonarqube-check
- "
- `;
-
- exports[`should follow and complete all steps: Groovy: build.gradle 1`] = `
- "plugins {
- id "org.sonarqube" version "5.0.0.4638"
- }
-
- sonar {
- properties {
- property "sonar.projectKey", "my-project"
- property "sonar.projectName", "MyProject"
- property "sonar.qualitygate.wait", true
- }
- }"
- `;
-
- exports[`should follow and complete all steps: Kotlin: build.gradle.kts 1`] = `
- "plugins {
- id ("org.sonarqube") version "5.0.0.4638"
- }
-
- sonar {
- properties {
- property("sonar.projectKey", "my-project")
- property("sonar.projectName", "MyProject")
- property("sonar.qualitygate.wait", true)
- }
- }"
- `;
-
- exports[`should follow and complete all steps: Maven: gitlab-ci.yml 1`] = `
- "stages:
- - sonarqube-check
- - sonarqube-vulnerability-report
-
- sonarqube-check:
- stage: sonarqube-check
- image: maven:3-eclipse-temurin-17
- variables:
- SONAR_USER_HOME: "\${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
- GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
- cache:
- key: "\${CI_JOB_NAME}"
- paths:
- - .sonar/cache
- script:
- - mvn verify sonar:sonar
- allow_failure: true
- only:
- - merge_requests
- - master
- - main
- - develop
-
- sonarqube-vulnerability-report:
- stage: sonarqube-vulnerability-report
- script:
- - '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'
- allow_failure: true
- only:
- - merge_requests
- - master
- - main
- - develop
- artifacts:
- expire_in: 1 day
- reports:
- sast: gl-sast-sonar-report.json
- dependencies:
- - sonarqube-check
- "
- `;
-
- exports[`should follow and complete all steps: Maven: pom.xml 1`] = `
- "<properties>
- <sonar.projectKey>my-project</sonar.projectKey>
- <sonar.projectName>MyProject</sonar.projectName>
- <sonar.qualitygate.wait>true</sonar.qualitygate.wait>
- </properties>"
- `;
-
- exports[`should follow and complete all steps: Other: gitlab-ci.yml 1`] = `
- "stages:
- - sonarqube-check
- - sonarqube-vulnerability-report
-
- sonarqube-check:
- stage: sonarqube-check
- image:
- name: sonarsource/sonar-scanner-cli:5.0
- entrypoint: [""]
- variables:
- SONAR_USER_HOME: "\${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
- GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
- cache:
- key: "\${CI_JOB_NAME}"
- paths:
- - .sonar/cache
- script:
- - sonar-scanner
- allow_failure: true
- only:
- - merge_requests
- - master
- - main
- - develop
-
- sonarqube-vulnerability-report:
- stage: sonarqube-vulnerability-report
- script:
- - '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'
- allow_failure: true
- only:
- - merge_requests
- - master
- - main
- - develop
- artifacts:
- expire_in: 1 day
- reports:
- sast: gl-sast-sonar-report.json
- dependencies:
- - sonarqube-check
- "
- `;
-
- exports[`should follow and complete all steps: Other: sonar-project.properties 1`] = `
- "sonar.projectKey=my-project
- sonar.qualitygate.wait=true
- "
- `;
-
- exports[`should follow and complete all steps: sonar token key 1`] = `"SONAR_TOKEN"`;
-
- exports[`should follow and complete all steps: sonarqube host url key 1`] = `"SONAR_HOST_URL"`;
-
- exports[`should follow and complete all steps: sonarqube host url value 1`] = `"http://localhost:9000"`;
|