forked from eurodyn/QLACK1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
47 lines (46 loc) · 1.44 KB
/
Jenkinsfile
File metadata and controls
47 lines (46 loc) · 1.44 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
pipeline {
agent {
docker {
image 'eddevopsd2/maven-java-npm-docker:mvn3.6.3-jdk11-npm6.14.4-docker'
args '-v /root/.m2/Qlack1-GIT:/root/.m2'
}
}
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '10'))
}
stages {
stage('Build') {
steps {
sh 'mvn clean install'
}
}
stage('Sonar Analysis') {
steps {
withSonarQubeEnv('sonar'){
sh 'mvn sonar:sonar -Dsonar.projectName=Qlack1-Git -Dsonar.host.url=${SONAR_HOST_URL} -Dsonar.login=${SONAR_KEY_QLACK1}'
}
}
}
stage('Produce bom.xml'){
steps{
sh 'mvn org.cyclonedx:cyclonedx-maven-plugin:makeAggregateBom'
}
}
stage('Dependency-Track Analysis'){
steps{
sh '''
cat > payload.json <<__HERE__
{
"project": "df0a0f88-a3bc-4f85-9e14-77908a6cf4cb",
"bom": "$(cat target/bom.xml |base64 -w 0 -)"
}
__HERE__
'''
sh '''
curl -X "PUT" ${DEPENDENCY_TRACK_URL} -H 'Content-Type: application/json' -H 'X-API-Key: '${DEPENDENCY_TRACK_API_KEY} -d @payload.json
'''
}
}
}
}