forked from chuckaude/hello-c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
56 lines (54 loc) · 1.48 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
pipeline {
agent any
environment {
CONNECT = 'https://coverity.chuckaude.com:8443/'
PROJECT = 'hello-c'
}
stages {
stage('Build') {
steps {
sh 'make hello'
}
}
stage('Test') {
steps {
sh 'make test'
}
}
stage('Coverity Full Scan') {
when {
allOf {
not { changeRequest() }
expression { BRANCH_NAME ==~ /(master|stage|release)/ }
}
}
steps {
withCoverityEnvironment(coverityInstanceUrl: "$CONNECT", projectName: "$PROJECT", streamName: "$PROJECT-$BRANCH_NAME") {
sh '''
cov-build --dir idir make clean hello
cov-analyze --dir idir --ticker-mode none --strip-path $WORKSPACE
cov-commit-defects --dir idir --ticker-mode none --url $COV_URL --stream $COV_STREAM \
--description $BUILD_TAG --target Linux_x86_64 --version $GIT_COMMIT
'''
}
}
}
stage('Coverity Incremental Scan') {
when {
allOf {
changeRequest()
expression { CHANGE_TARGET ==~ /(master|stage|release)/ }
}
}
steps {
withCoverityEnvironment(coverityInstanceUrl: "$CONNECT", projectName: "$PROJECT", streamName: "$PROJECT-$CHANGE_TARGET") {
sh '''
cov-build --dir idir make clean hello
cov-run-desktop --dir idir --url $COV_URL --stream $COV_STREAM --reference-snapshot latest --present-in-reference false \
--ignore-uncapturable-inputs true --set-new-defect-owner false --exit1-if-defects true $(git --no-pager diff origin/$CHANGE_TARGET --name-only)
'''
}
}
}
}
}