-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
55 lines (55 loc) · 1.91 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
pipeline {
environment {
APIKEY = credentials('api_key_dtrack')
SONARTOKEN = credentials('sonar-jenkins')
}
agent {
kubernetes {
inheritFrom 'maven'
defaultContainer 'maven'
}
}
stages{
stage('build and sonar') {
steps {
container('maven') {
script {
scannerHome = tool 'SonarQube Scanner'
}
withSonarQubeEnv('EFS_Sonar') {
withMaven(
mavenSettingsConfig: '5b6df7e0-ccd7-4cf8-87f1-281c1eebc89f'
) {
sh "mvn test"
sh "mvn clean verify sonar:sonar -Dsonar.token=$SONARTOKEN -Dsonar.host.url=https://sonarqube.efs-techhub.com -Dsonar.projectKey=storagemanager"
}
}
}
}
}
stage('executing syft') {
steps {
container('maven') {
script{
sh 'wget https://github.com/anchore/syft/releases/download/v0.88.0/syft_0.88.0_linux_amd64.tar.gz'
sh 'tar -xf syft_0.88.0_linux_amd64.tar.gz'
sh 'chmod +x syft'
sh './syft packages -o cyclonedx-json --file result.json dir:.'
}
}
}
}
stage('upload artefact') {
steps {
container('maven') {
sh 'curl -v -X "POST" "https://dtrack-api.efs-techhub.com/api/v1/bom" -H "Content-Type:multipart/form-data" -H "X-Api-Key: $APIKEY" -F "project=eae6ab0f-2cc3-42cb-a216-18b62ccfbf00" -F "bom=@result.json"'
}
}
}
stage('cleaning Workspace'){
steps {
cleanWs()
}
}
}
}