This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 458
/
Copy pathJenkinsfile.sonar
54 lines (53 loc) · 1.63 KB
/
Jenkinsfile.sonar
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
@Library('lisk-jenkins') _
pipeline {
agent { node { label 'lisk-sdk' } }
stages {
stage('Install TypeScript') {
steps {
nvm(getNodejsVersion()) {
sh 'npm ci'
}
}
}
stage('Run sonar-scanner') {
steps {
nvm(getNodejsVersion()) {
script {
def scannerHome = tool 'sonar';
withSonarQubeEnv() {
if (env.CHANGE_ID) {
sh """#!/bin/bash
${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=LiskHQ_lisk-sdk \
-Dsonar.organization=liskhq \
-Dsonar.exclusions=**/test/**,**/migrations/**,reset_mem_tables.sql,**/protocol-specs/**,**/templates/browsertest.tmpl/**,**/lisk-p2p/examples/** \
-Dsonar.scm.revision=$GIT_COMMIT \
-Dsonar.projectVersion=\${GIT_COMMIT::7} \
-Dsonar.pullrequest.key=$CHANGE_ID \
-Dsonar.pullrequest.branch=$CHANGE_BRANCH \
-Dsonar.pullrequest.base=$CHANGE_TARGET \
-Dsonar.typescript.tsconfigPath=tsconfig.json
"""
} else {
sh """#!/bin/bash
${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=LiskHQ_lisk-sdk \
-Dsonar.organization=liskhq \
-Dsonar.exclusions=**/test/**,**/migrations/**,reset_mem_tables.sql,**/protocol-specs/**,**/templates/browsertest.tmpl/**,**/lisk-p2p/examples/** \
-Dsonar.scm.revision=$GIT_COMMIT \
-Dsonar.projectVersion=\${GIT_COMMIT::7} \
-Dsonar.branch.name=$GIT_BRANCH \
-Dsonar.typescript.tsconfigPath=tsconfig.json
"""
}
}
}
}
}
}
}
post {
cleanup {
cleanWs()
}
}
}
// vim: filetype=groovy