-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
102 lines (102 loc) · 3.4 KB
/
Jenkinsfile
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
pipeline {
agent {
label 'master'
}
environment {
KLOCWORK_BUILDSPEC = "kwinject.out"
KLOCWORK_TABLES = "kwtables"
KLOCWORK_URL = 'http://localhost:8082'
KLOCWORK_PROJECT = "cxx_testsuite"
KLOCWORK_LTOKEN = "/opt/klocwork/ltoken"
PATH = "/opt/klocwork/server/bin:/opt/klocwork/kwciagent/bin:${env.PATH}"
}
stages {
stage('Full, clean compile & link') {
steps {
sh '''
kwinject make
'''
}
}
stage('Full static code analysis'){
when {
branch 'master'
}
steps {
echo "Performing Integration Analysis"
klocworkIntegrationStep1 (
[
buildSpec: "${KLOCWORK_BUILDSPEC}",
tablesDir: "${KLOCWORK_TABLES}",
incrementalAnalysis: true,
ignoreCompileErrors: false,
importConfig: "",
additionalOpts: "--replace-path ${WORKSPACE}=workspace",
disableKwdeploy: true
]
)
echo "Performing Integration Load"
klocworkIntegrationStep2 (
serverConfig:[
tablesDir: "${KLOCWORK_TABLES}",
buildName: "${GIT_COMMIT}",
additionalOpts: ""
],
reportConfig:[
displayChart: true,
chartHeight: "",
chartWidth: "",
query: "status:+Analyze,+Fix"
]
)
echo "Performing Quality Gateway Checks"
klocworkFailureCondition([enableServerFailureCondition: true, failureConditionCiConfigs: [[diffFileList: 'diff_file_list.txt', enableHTMLReporting: true, failUnstable: true, name: 'New Issues', reportFile: 'kw_results.xml', threshold: '1', withDiffList: true]], failureConditionServerConfigs: [[conditionName: 'New High Severity', enableHTMLReporting: true, jobResult: 'unstable', query: 'state:+New status:Analyze severity:1,2', stopBuild: false, threshold: '1']]])
}
}
stage('Diff static code analysis'){
when {
not {
branch 'master'
}
}
steps {
sh '''
git diff --name-only --diff-filter=d origin/master > diff_file_list.txt
'''
echo "Performing CI Analysis"
klocworkIncremental(
[
additionalOpts: '',
buildSpec: 'kwinject.out',
cleanupProject: false,
differentialAnalysisConfig: [
diffFileList: 'diff_file_list.txt',
diffType: 'manual',
gitPreviousCommit: ''
],
incrementalAnalysis: true,
projectDir: '',
reportFile: 'kw_results.xml'
]
)
echo "Performing Quality Gateway Checks"
klocworkFailureCondition(
[
enableCiFailureCondition: true,
failureConditionCiConfigs: [
[
diffFileList: 'diff_file_list.txt',
enableHTMLReporting: true,
failUnstable: true,
name: 'New Issues',
reportFile: 'kw_results.xml',
threshold: '1',
withDiffList: true
]
]
]
)
}
}
}
}