]> source.dussan.org Git - sonarqube.git/blob
ee7000676dd426104a799e887f713d28a7031e47
[sonarqube.git] /
1 // Jest Snapshot v1, https://goo.gl/fbAQLP
2
3 exports[`should follow and complete all steps: .NET: bitbucket-pipelines.yml 1`] = `
4 "image: mcr.microsoft.com/dotnet/core/sdk:latest
5
6 definitions:
7   steps:
8     - step: &build-step
9         name: SonarQube analysis
10         caches:
11           - dotnetcore
12           - sonar
13         script:
14           - apt-get update
15           - apt-get install --yes openjdk-11-jre
16           - dotnet tool install --global dotnet-sonarscanner
17           - export PATH="$PATH:/root/.dotnet/tools"
18           - dotnet sonarscanner begin /k:"my-project" /d:"sonar.login=\${SONAR_TOKEN}"  /d:"sonar.host.url=\${SONAR_HOST_URL}"
19           - dotnet build 
20           - dotnet sonarscanner end /d:"sonar.login=\${SONAR_TOKEN}"
21   caches:
22     sonar: ~/.sonar
23
24 pipelines:
25   branches:
26     '{main}':
27       - step: *build-step
28
29   pull-requests:
30     '**':
31       - step: *build-step"
32 `;
33
34 exports[`should follow and complete all steps: CFamily: bitbucket-pipelines.yml 1`] = `
35 "image: <image ready for your build toolchain>
36
37 definitions:
38   steps:
39     - step: &build-step
40         name: Build the project, and run the SonarQube analysis
41         script:
42           - export SONAR_SCANNER_VERSION=4.6.2.2472
43           - mkdir $HOME/.sonar
44           - curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip \${SONAR_HOST_URL}/static/cpp/build-wrapper-linux-x86.zip
45           - unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
46           - curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-\${SONAR_SCANNER_VERSION}-linux.zip
47           - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
48           - export PATH="$PATH:$HOME/.sonar/sonar-scanner-\${SONAR_SCANNER_VERSION}-linux/bin"
49           - <any step required before running your build, like ./configure>
50           - $HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output <your clean build command>
51           - sonar-scanner -Dsonar.cfamily.build-wrapper-output=bw-output  
52   caches:
53     sonar: ~/.sonar
54
55 clone:
56   depth: full
57
58 pipelines:
59   branches:
60     '{main}':
61       - step: *build-step
62
63   pull-requests:
64     '**':
65       - step: *build-step"
66 `;
67
68 exports[`should follow and complete all steps: CFamily: sonar-project.properties 1`] = `"sonar.projectKey=my-project"`;
69
70 exports[`should follow and complete all steps: Gradle: bitbucket-pipelines.yml 1`] = `
71 "image: openjdk:8
72
73 definitions:
74   steps:
75     - step: &build-step
76         name: SonarQube analysis
77         caches:
78           - gradle
79           - sonar
80         script:
81           - bash ./gradlew sonar
82   caches:
83     sonar: ~/.sonar
84
85 clone:
86   depth: full
87   
88 pipelines:
89   branches:
90     '{main}':
91       - step: *build-step
92
93   pull-requests:
94     '**':
95       - step: *build-step"
96 `;
97
98 exports[`should follow and complete all steps: Gradle: build.gradle 1`] = `
99 "plugins {
100   id "org.sonarqube" version "3.5.0.2730"
101 }
102
103 sonar {
104   properties {
105     property "sonar.projectKey", "my-project"
106     property "sonar.projectName", "MyProject"
107   }
108 }"
109 `;
110
111 exports[`should follow and complete all steps: Maven: bitbucket-pipelines.yml 1`] = `
112 "image: maven:3-openjdk-11
113
114 definitions:
115   steps:
116     - step: &build-step
117         name: SonarQube analysis
118         caches:
119           - maven
120           - sonar
121         script:
122           - mvn verify sonar:sonar -Dsonar.projectKey=my-project -Dsonar.projectName='MyProject'
123   caches:
124     sonar: ~/.sonar
125
126 clone:
127   depth: full
128   
129 pipelines:
130   branches:
131     '{main}':
132       - step: *build-step
133
134   pull-requests:
135     '**':
136       - step: *build-step"
137 `;
138
139 exports[`should follow and complete all steps: Other: .github/workflows/build.yml 1`] = `
140 "image: maven:3.3.9
141
142 definitions:
143   steps:
144     - step: &build-step
145         name: SonarQube analysis
146         script:
147           - pipe: sonarsource/sonarqube-scan:1.0.0
148             variables:
149               SONAR_HOST_URL: \${SONAR_HOST_URL} # Get the value from the repository/workspace variable.
150               SONAR_TOKEN: \${SONAR_TOKEN} # Get the value from the repository/workspace variable. You shouldn't set secret in clear text here.
151   caches:
152     sonar: ~/.sonar
153
154 clone:
155   depth: full
156
157 pipelines:
158   branches:
159     '{main}':
160       - step: *build-step
161
162   pull-requests:
163     '**':
164       - step: *build-step
165 "
166 `;
167
168 exports[`should follow and complete all steps: Other: sonar-project.properties 1`] = `"sonar.projectKey=my-project"`;
169
170 exports[`should follow and complete all steps: sonar token key 1`] = `"SONAR_TOKEN"`;
171
172 exports[`should follow and complete all steps: sonarqube host url key 1`] = `"SONAR_HOST_URL"`;
173
174 exports[`should follow and complete all steps: sonarqube host url value 1`] = `"http://localhost:9000"`;