-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJenkinsfile-coverity-noplugin-docker
More file actions
50 lines (49 loc) · 2.06 KB
/
Jenkinsfile-coverity-noplugin-docker
File metadata and controls
50 lines (49 loc) · 2.06 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
def GIT_REPO = 'https://github.com/chuckaude/hello-java.git'
def BRANCH = 'main'
def COV_URL = 'https://coverity.chuckaude.com:8443'
def COV_PROJECT = 'hello-java'
def COV_STREAM = "$COV_PROJECT-$BRANCH"
def CHECKERS = '--webapp-security --enable-callgraph-metrics'
def BLDCMD = 'mvn -B package -DskipTests'
def COVBIN = '/opt/coverity/analysis/latest/bin'
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 {
withCredentials([usernamePassword(credentialsId: 'coverity-committer', usernameVariable: 'COV_USER', passwordVariable: 'COVERITY_PASSPHRASE')]) {
sh """
export PATH=$PATH:$COVBIN
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)
curl -fLsS --user $COV_USER:$COVERITY_PASSPHRASE $COV_URL/api/viewContents/issues/v1/Outstanding%20Issues?projectId=$COV_PROJECT | \
tee results.json | python3 -m json.tool
"""
}
}
}
}
post {
always {
archiveArtifacts artifacts: 'idir/build-log.txt, idir/output/analysis-log.txt, idir/output/callgraph-metrics.csv'
cleanWs()
}
}
}