-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitbucket-pipelines.yml
60 lines (58 loc) · 1.92 KB
/
bitbucket-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
image: node:18-alpine
definitions:
options:
docker: true
services:
docker:
memory: 4096
caches:
sonar: ~/.sonar/cache
steps:
- step: &build-test-sonarcloud
name: Build, test and analyze on SonarCloud
caches:
- node
- sonar
size: 2x
script:
- source JenkinsParams
- export VERSION=$(node -p "require('./package.json').version")
- export REPOSITORY_NAME=$(echo $BITBUCKET_REPO_FULL_NAME | sed 's|.*/||')
- npm install --quiet
- npm run test:cov
- pipe: sonarsource/sonarcloud-scan:1.4.0
variables:
EXTRA_ARGS: >
-Dsonar.projectKey=\"${BITBUCKET_PROJECT_KEY}_${REPOSITORY_NAME}\"
-Dsonar.projectName=\"${BITBUCKET_PROJECT_KEY}_${REPOSITORY_NAME}\"
-Dsonar.projectVersion=\"$VERSION\"
-Dsonar.sources=\"$SCAN_SOURCE\"
-Dsonar.exclusions=\"$SCAN_EXCLUDE_FILES\"
-Dsonar.javascript.lcov.reportPaths=\"$SCAN_COVERAGE_REPORT\"
-Dsonar.coverage.exclusions=\"$SCAN_COVERAGE_EXCLUSIONS\"
-Dsonar.cpd.exclusions=\"$SCAN_COVERAGE_EXCLUSIONS\"
- step: &check-quality-gate-sonarcloud
name: Check the Quality Gate on SonarCloud
caches:
- sonar
size: 2x
script:
- pipe: sonarsource/sonarcloud-quality-gate:0.1.6
pipelines:
branches:
development:
- step: *build-test-sonarcloud
- step: *check-quality-gate-sonarcloud
staging:
- step: *build-test-sonarcloud
- step: *check-quality-gate-sonarcloud
qa:
- step: *build-test-sonarcloud
- step: *check-quality-gate-sonarcloud
master:
- step: *build-test-sonarcloud
- step: *check-quality-gate-sonarcloud
pull-requests:
'**':
- step: *build-test-sonarcloud
- step: *check-quality-gate-sonarcloud