]> source.dussan.org Git - sonarqube.git/blob
ac895b8390a1f147a11c7e050c83c746694ed87b
[sonarqube.git] /
1 // Jest Snapshot v1, https://goo.gl/fbAQLP
2
3 exports[`should render correctly for cfamily 1`] = `
4 <Fragment>
5   <PreambuleYaml
6     buildTool="cfamily"
7     component={
8       {
9         "breadcrumbs": [],
10         "key": "my-project",
11         "name": "MyProject",
12         "qualifier": "TRK",
13         "qualityGate": {
14           "isDefault": true,
15           "key": "30",
16           "name": "Sonar way",
17         },
18         "qualityProfiles": [
19           {
20             "deleted": false,
21             "key": "my-qp",
22             "language": "ts",
23             "name": "Sonar way",
24           },
25         ],
26         "tags": [],
27       }
28     }
29   />
30   <CreateYmlFile
31     yamlFileName="bitbucket-pipelines.yml"
32     yamlTemplate="image: <image ready for your build toolchain>
33
34 definitions:
35   steps:
36     - step: &build-step
37         name: Build the project, and run the SonarQube analysis
38         script:
39           - export SONAR_SCANNER_VERSION=4.6.2.2472
40           - mkdir $HOME/.sonar
41           - curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip \${SONAR_HOST_URL}/static/cpp/build-wrapper-linux-x86.zip
42           - unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
43           - curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-\${SONAR_SCANNER_VERSION}-linux.zip
44           - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
45           - export PATH="$PATH:$HOME/.sonar/sonar-scanner-\${SONAR_SCANNER_VERSION}-linux/bin"
46           - <any step required before running your build, like ./configure>
47           - $HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output <your clean build command>
48           - sonar-scanner -Dsonar.cfamily.build-wrapper-output=bw-output  
49   caches:
50     sonar: ~/.sonar
51
52 clone:
53   depth: full
54
55 pipelines:
56   branches:
57     '{main}':
58       - step: *build-step
59 "
60   />
61   <CompilationInfo
62     className="abs-width-800"
63   />
64 </Fragment>
65 `;
66
67 exports[`should render correctly for cfamily: with branch enabled 1`] = `
68 <Fragment>
69   <PreambuleYaml
70     buildTool="cfamily"
71     component={
72       {
73         "breadcrumbs": [],
74         "key": "my-project",
75         "name": "MyProject",
76         "qualifier": "TRK",
77         "qualityGate": {
78           "isDefault": true,
79           "key": "30",
80           "name": "Sonar way",
81         },
82         "qualityProfiles": [
83           {
84             "deleted": false,
85             "key": "my-qp",
86             "language": "ts",
87             "name": "Sonar way",
88           },
89         ],
90         "tags": [],
91       }
92     }
93   />
94   <CreateYmlFile
95     yamlFileName="bitbucket-pipelines.yml"
96     yamlTemplate="image: <image ready for your build toolchain>
97
98 definitions:
99   steps:
100     - step: &build-step
101         name: Build the project, and run the SonarQube analysis
102         script:
103           - export SONAR_SCANNER_VERSION=4.6.2.2472
104           - mkdir $HOME/.sonar
105           - curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip \${SONAR_HOST_URL}/static/cpp/build-wrapper-linux-x86.zip
106           - unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
107           - curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-\${SONAR_SCANNER_VERSION}-linux.zip
108           - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
109           - export PATH="$PATH:$HOME/.sonar/sonar-scanner-\${SONAR_SCANNER_VERSION}-linux/bin"
110           - <any step required before running your build, like ./configure>
111           - $HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output <your clean build command>
112           - sonar-scanner -Dsonar.cfamily.build-wrapper-output=bw-output  
113   caches:
114     sonar: ~/.sonar
115
116 clone:
117   depth: full
118
119 pipelines:
120   branches:
121     '{main}':
122       - step: *build-step
123
124   pull-requests:
125     '**':
126       - step: *build-step"
127   />
128   <CompilationInfo
129     className="abs-width-800"
130   />
131 </Fragment>
132 `;
133
134 exports[`should render correctly for dotnet 1`] = `
135 <Fragment>
136   <PreambuleYaml
137     buildTool="dotnet"
138     component={
139       {
140         "breadcrumbs": [],
141         "key": "my-project",
142         "name": "MyProject",
143         "qualifier": "TRK",
144         "qualityGate": {
145           "isDefault": true,
146           "key": "30",
147           "name": "Sonar way",
148         },
149         "qualityProfiles": [
150           {
151             "deleted": false,
152             "key": "my-qp",
153             "language": "ts",
154             "name": "Sonar way",
155           },
156         ],
157         "tags": [],
158       }
159     }
160   />
161   <CreateYmlFile
162     yamlFileName="bitbucket-pipelines.yml"
163     yamlTemplate="image: mcr.microsoft.com/dotnet/core/sdk:latest
164
165 definitions:
166   steps:
167     - step: &build-step
168         name: SonarQube analysis
169         caches:
170           - dotnetcore
171           - sonar
172         script:
173           - apt-get update
174           - apt-get install --yes openjdk-11-jre
175           - dotnet tool install --global dotnet-sonarscanner
176           - export PATH="$PATH:/root/.dotnet/tools"
177           - dotnet sonarscanner begin /k:"my-project" /d:"sonar.login=\${SONAR_TOKEN}"  /d:"sonar.host.url=\${SONAR_HOST_URL}"
178           - dotnet build 
179           - dotnet sonarscanner end /d:"sonar.login=\${SONAR_TOKEN}"
180   caches:
181     sonar: ~/.sonar
182
183 pipelines:
184   branches:
185     '{main}':
186       - step: *build-step
187 "
188   />
189 </Fragment>
190 `;
191
192 exports[`should render correctly for dotnet: with branch enabled 1`] = `
193 <Fragment>
194   <PreambuleYaml
195     buildTool="dotnet"
196     component={
197       {
198         "breadcrumbs": [],
199         "key": "my-project",
200         "name": "MyProject",
201         "qualifier": "TRK",
202         "qualityGate": {
203           "isDefault": true,
204           "key": "30",
205           "name": "Sonar way",
206         },
207         "qualityProfiles": [
208           {
209             "deleted": false,
210             "key": "my-qp",
211             "language": "ts",
212             "name": "Sonar way",
213           },
214         ],
215         "tags": [],
216       }
217     }
218   />
219   <CreateYmlFile
220     yamlFileName="bitbucket-pipelines.yml"
221     yamlTemplate="image: mcr.microsoft.com/dotnet/core/sdk:latest
222
223 definitions:
224   steps:
225     - step: &build-step
226         name: SonarQube analysis
227         caches:
228           - dotnetcore
229           - sonar
230         script:
231           - apt-get update
232           - apt-get install --yes openjdk-11-jre
233           - dotnet tool install --global dotnet-sonarscanner
234           - export PATH="$PATH:/root/.dotnet/tools"
235           - dotnet sonarscanner begin /k:"my-project" /d:"sonar.login=\${SONAR_TOKEN}"  /d:"sonar.host.url=\${SONAR_HOST_URL}"
236           - dotnet build 
237           - dotnet sonarscanner end /d:"sonar.login=\${SONAR_TOKEN}"
238   caches:
239     sonar: ~/.sonar
240
241 pipelines:
242   branches:
243     '{main}':
244       - step: *build-step
245
246   pull-requests:
247     '**':
248       - step: *build-step"
249   />
250 </Fragment>
251 `;
252
253 exports[`should render correctly for gradle 1`] = `
254 <Fragment>
255   <PreambuleYaml
256     buildTool="gradle"
257     component={
258       {
259         "breadcrumbs": [],
260         "key": "my-project",
261         "name": "MyProject",
262         "qualifier": "TRK",
263         "qualityGate": {
264           "isDefault": true,
265           "key": "30",
266           "name": "Sonar way",
267         },
268         "qualityProfiles": [
269           {
270             "deleted": false,
271             "key": "my-qp",
272             "language": "ts",
273             "name": "Sonar way",
274           },
275         ],
276         "tags": [],
277       }
278     }
279   />
280   <CreateYmlFile
281     yamlFileName="bitbucket-pipelines.yml"
282     yamlTemplate="image: openjdk:8
283
284 definitions:
285   steps:
286     - step: &build-step
287         name: SonarQube analysis
288         caches:
289           - gradle
290           - sonar
291         script:
292           - bash ./gradlew sonar
293   caches:
294     sonar: ~/.sonar
295
296 clone:
297   depth: full
298   
299 pipelines:
300   branches:
301     '{main}':
302       - step: *build-step
303 "
304   />
305 </Fragment>
306 `;
307
308 exports[`should render correctly for gradle: with branch enabled 1`] = `
309 <Fragment>
310   <PreambuleYaml
311     buildTool="gradle"
312     component={
313       {
314         "breadcrumbs": [],
315         "key": "my-project",
316         "name": "MyProject",
317         "qualifier": "TRK",
318         "qualityGate": {
319           "isDefault": true,
320           "key": "30",
321           "name": "Sonar way",
322         },
323         "qualityProfiles": [
324           {
325             "deleted": false,
326             "key": "my-qp",
327             "language": "ts",
328             "name": "Sonar way",
329           },
330         ],
331         "tags": [],
332       }
333     }
334   />
335   <CreateYmlFile
336     yamlFileName="bitbucket-pipelines.yml"
337     yamlTemplate="image: openjdk:8
338
339 definitions:
340   steps:
341     - step: &build-step
342         name: SonarQube analysis
343         caches:
344           - gradle
345           - sonar
346         script:
347           - bash ./gradlew sonar
348   caches:
349     sonar: ~/.sonar
350
351 clone:
352   depth: full
353   
354 pipelines:
355   branches:
356     '{main}':
357       - step: *build-step
358
359   pull-requests:
360     '**':
361       - step: *build-step"
362   />
363 </Fragment>
364 `;
365
366 exports[`should render correctly for maven 1`] = `
367 <Fragment>
368   <PreambuleYaml
369     buildTool="maven"
370     component={
371       {
372         "breadcrumbs": [],
373         "key": "my-project",
374         "name": "MyProject",
375         "qualifier": "TRK",
376         "qualityGate": {
377           "isDefault": true,
378           "key": "30",
379           "name": "Sonar way",
380         },
381         "qualityProfiles": [
382           {
383             "deleted": false,
384             "key": "my-qp",
385             "language": "ts",
386             "name": "Sonar way",
387           },
388         ],
389         "tags": [],
390       }
391     }
392   />
393   <CreateYmlFile
394     yamlFileName="bitbucket-pipelines.yml"
395     yamlTemplate="image: maven:3-openjdk-11
396
397 definitions:
398   steps:
399     - step: &build-step
400         name: SonarQube analysis
401         caches:
402           - maven
403           - sonar
404         script:
405           - mvn verify sonar:sonar -Dsonar.projectKey=my-project -Dsonar.projectName='MyProject'
406   caches:
407     sonar: ~/.sonar
408
409 clone:
410   depth: full
411   
412 pipelines:
413   branches:
414     '{main}':
415       - step: *build-step
416 "
417   />
418 </Fragment>
419 `;
420
421 exports[`should render correctly for maven: with branch enabled 1`] = `
422 <Fragment>
423   <PreambuleYaml
424     buildTool="maven"
425     component={
426       {
427         "breadcrumbs": [],
428         "key": "my-project",
429         "name": "MyProject",
430         "qualifier": "TRK",
431         "qualityGate": {
432           "isDefault": true,
433           "key": "30",
434           "name": "Sonar way",
435         },
436         "qualityProfiles": [
437           {
438             "deleted": false,
439             "key": "my-qp",
440             "language": "ts",
441             "name": "Sonar way",
442           },
443         ],
444         "tags": [],
445       }
446     }
447   />
448   <CreateYmlFile
449     yamlFileName="bitbucket-pipelines.yml"
450     yamlTemplate="image: maven:3-openjdk-11
451
452 definitions:
453   steps:
454     - step: &build-step
455         name: SonarQube analysis
456         caches:
457           - maven
458           - sonar
459         script:
460           - mvn verify sonar:sonar -Dsonar.projectKey=my-project -Dsonar.projectName='MyProject'
461   caches:
462     sonar: ~/.sonar
463
464 clone:
465   depth: full
466   
467 pipelines:
468   branches:
469     '{main}':
470       - step: *build-step
471
472   pull-requests:
473     '**':
474       - step: *build-step"
475   />
476 </Fragment>
477 `;
478
479 exports[`should render correctly for other 1`] = `
480 <Fragment>
481   <PreambuleYaml
482     buildTool="other"
483     component={
484       {
485         "breadcrumbs": [],
486         "key": "my-project",
487         "name": "MyProject",
488         "qualifier": "TRK",
489         "qualityGate": {
490           "isDefault": true,
491           "key": "30",
492           "name": "Sonar way",
493         },
494         "qualityProfiles": [
495           {
496             "deleted": false,
497             "key": "my-qp",
498             "language": "ts",
499             "name": "Sonar way",
500           },
501         ],
502         "tags": [],
503       }
504     }
505   />
506   <CreateYmlFile
507     yamlFileName="bitbucket-pipelines.yml"
508     yamlTemplate="image: maven:3.3.9
509
510 definitions:
511   steps:
512     - step: &build-step
513         name: SonarQube analysis
514         script:
515           - pipe: sonarsource/sonarqube-scan:1.0.0
516             variables:
517               SONAR_HOST_URL: \${SONAR_HOST_URL} # Get the value from the repository/workspace variable.
518               SONAR_TOKEN: \${SONAR_TOKEN} # Get the value from the repository/workspace variable. You shouldn't set secret in clear text here.
519   caches:
520     sonar: ~/.sonar
521
522 clone:
523   depth: full
524
525 pipelines:
526   branches:
527     '{main}':
528       - step: *build-step
529 "
530   />
531 </Fragment>
532 `;
533
534 exports[`should render correctly for other: with branch enabled 1`] = `
535 <Fragment>
536   <PreambuleYaml
537     buildTool="other"
538     component={
539       {
540         "breadcrumbs": [],
541         "key": "my-project",
542         "name": "MyProject",
543         "qualifier": "TRK",
544         "qualityGate": {
545           "isDefault": true,
546           "key": "30",
547           "name": "Sonar way",
548         },
549         "qualityProfiles": [
550           {
551             "deleted": false,
552             "key": "my-qp",
553             "language": "ts",
554             "name": "Sonar way",
555           },
556         ],
557         "tags": [],
558       }
559     }
560   />
561   <CreateYmlFile
562     yamlFileName="bitbucket-pipelines.yml"
563     yamlTemplate="image: maven:3.3.9
564
565 definitions:
566   steps:
567     - step: &build-step
568         name: SonarQube analysis
569         script:
570           - pipe: sonarsource/sonarqube-scan:1.0.0
571             variables:
572               SONAR_HOST_URL: \${SONAR_HOST_URL} # Get the value from the repository/workspace variable.
573               SONAR_TOKEN: \${SONAR_TOKEN} # Get the value from the repository/workspace variable. You shouldn't set secret in clear text here.
574   caches:
575     sonar: ~/.sonar
576
577 clone:
578   depth: full
579
580 pipelines:
581   branches:
582     '{main}':
583       - step: *build-step
584
585   pull-requests:
586     '**':
587       - step: *build-step
588 "
589   />
590 </Fragment>
591 `;