-
Notifications
You must be signed in to change notification settings - Fork 8.6k
/
Jenkinsfile_old
62 lines (52 loc) · 1.83 KB
/
Jenkinsfile_old
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
@Library('javahome-libs') _
pipeline{
agent any
options {
timeout(30)
}
stages{
stage('Maven and Sonar'){
parallel{
stage('Sonar Analysis'){
steps{
withSonarQubeEnv('sonar7') {
sh 'mvn sonar:sonar'
}
timeout(time: 1, unit: 'HOURS') {
script{
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
}
}
}
stage('Mvn Build'){
steps{
sh 'mvn clean package'
}
}
}
}
stage("Nexus Deploy"){
steps{
script{
def pomFile = readMavenPom file: 'pom.xml'
nexusArtifactUploader artifacts: [[artifactId: 'myweb', classifier: '', file: "target/myweb-${pomFile.version}.war", type: 'war']],
credentialsId: 'nexus3',
groupId: 'in.javahome',
nexusUrl: '172.31.71.247:8081',
nexusVersion: 'nexus3',
protocol: 'http', repository: 'javahome-my-app',
version: pomFile.version
}
}
}
stage('Tomcat Deploy'){
steps{
tomcatDeploy("172.31.35.55","ec2-user","myweb")
}
}
}
}