-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJenkinsfile-coverity-plugin-docker
More file actions
52 lines (51 loc) · 2.09 KB
/
Jenkinsfile-coverity-plugin-docker
File metadata and controls
52 lines (51 loc) · 2.09 KB
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
def GIT_REPO = 'https://github.com/chuckaude/hello-java.git'
def BRANCH = 'main'
def CONNECT = 'https://coverity.chuckaude.com:8443'
def PROJECT = 'hello-java'
def STREAM = "$PROJECT-$BRANCH"
def CHECKERS = '--webapp-security --enable-callgraph-metrics'
def BLDCMD = 'mvn -B package -DskipTests'
pipeline {
agent {
docker {
image 'maven:latest'
args '-v $HOME/.m2:/home/build/.m2 -v /opt/coverity/analysis:/opt/coverity/analysis -v $HOME/.coverity:/home/build/.coverity'
}
}
environment {
HOME = '/home/build'
JAVA_TOOL_OPTIONS = '-Duser.home=/home/build'
}
stages {
stage('checkout') {
steps {
git url: "$GIT_REPO", branch: "$BRANCH", credentialsId: 'github-chuckaude'
}
}
stage('coverity') {
steps {
withCoverityEnvironment(coverityInstanceUrl: "$CONNECT", projectName: "$PROJECT", streamName: "$STREAM") {
sh """
export PATH=$PATH:$COVERITY_TOOL_HOME/bin
export COVERITY_NO_LOG_ENVIRONMENT_VARIABLES=1
cov-build --dir idir --fs-capture-search $WORKSPACE $BLDCMD
cov-analyze --dir idir --ticker-mode none --strip-path $WORKSPACE $CHECKERS
cov-commit-defects --dir idir --ticker-mode none --url $COV_URL --stream $COV_STREAM \
--description $BUILD_TAG --version \$(git log -n 1 --pretty=format:%H)
"""
script {
count = coverityIssueCheck viewName: 'Newly Detected Issues', returnIssueCount: true
if (count != 0) { unstable 'new issues detected' }
count = coverityIssueCheck viewName: 'Outstanding Issues', returnIssueCount: true
}
}
}
}
}
post {
always {
archiveArtifacts artifacts: 'idir/build-log.txt, idir/output/analysis-log.txt, idir/output/callgraph-metrics.csv'
cleanWs()
}
}
}