-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathjenkinsfile
More file actions
56 lines (54 loc) · 1.65 KB
/
Copy pathjenkinsfile
File metadata and controls
56 lines (54 loc) · 1.65 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
53
54
55
56
pipeline {
agent any
stages {
stage('clone git repo') {
steps {
git branch: 'main', url: 'https://github.com/learndevops-083/samplejavaapp.git'
}
}
stage('unit-test') {
steps {
echo 'unittesting..'
sh script: '/usr/share/maven/bin/mvn test'
}
post {
success {
junit 'target/surefire-reports/*.xml'
}
}
}
stage('Sonar Code Analysis') {
environment {
scannerHome = tool 'sonarqube-scanner'
}
steps {
withSonarQubeEnv('sonarqube') {
sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=maven-code-analysis"
}
timeout(time: 3, unit: 'MINUTES') {
waitForQualityGate abortPipeline: true
}
}
}
stage('maven package'){
steps{
sh '/usr/share/maven/bin/mvn package'
}
}
stage('publish to jfrog') {
steps {
rtUpload (
serverId: 'jfrog-dev',
spec: '''{
"files": [
{
"pattern": "target/sampleapp.war",
"target": "generic-local/"
}
]
}'''
)
}
}
}
}