forked from spring-projects/spring-petclinic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile3
82 lines (77 loc) · 2.31 KB
/
Jenkinsfile3
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
pipeline {
agent none
stages {
stage('checkout') {
agent { label 'JDK-11' }
steps {
mail subject: 'build started',
body: 'build started',
to: '[email protected]'
git branch: "main", url: 'https://github.com/satishnamgadda/spring-petclinic.git'
}
}
stage('artifactory configuaration') {
agent { label 'JDK-11' }
steps {
rtMavenDeployer(
id : "MAVEN_DEPLOYER",
releaseRepo : "default-libs-release",
snapshotRepo : "default-libs-snapshot",
serverId : "JFROG_ID"
)
}
}
stage('Exec Maven') {
agent { label 'JDK-11' }
steps {
rtMavenRun(
pom : "pom.xml",
goals : "clean install",
tool : "mvn",
deployerId : "MAVEN_DEPLOYER"
)
}
}
stage('sonar scan') {
agent { label 'JDK-11' }
steps {
withSonarQubeEnv('SONAR_SH') {
sh script: 'mvn clean package sonar:sonar'
}
}
}
// create webhooks: <jenkins_url:8080/sonarqube-webhook/>
stage('Quality Gate') {
agent { label 'JDK-11' }
steps {
timeout(time: 20, unit: 'MINUTES') {
waitForQualityGate abortPipeline: true
}
}
}
stage('publish build info') {
agent { label 'JDK-11' }
steps {
rtPublishBuildInfo(
serverId : "JFROG_ID"
)
}
}
stage('vcs') {
agent { label 'ANS-M' }
steps {
git url: 'https://github.com/satishnamgadda/spring-petclinic.git',
branch: 'main'
}
}
stage('ansible') {
agent { label 'ANS-M'}
steps {
sh """
ansible -i hosts -m ping all
ansible-playbook -i hosts spc-playbook.yml
"""
}
}
}
}